Drop SS7 call if not connected yet when INCOMPLETE/BUSY/CONGESTION.
authorRichard Mudgett <rmudgett@digium.com>
Mon, 5 Mar 2012 22:32:48 +0000 (22:32 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 5 Mar 2012 22:32:48 +0000 (22:32 +0000)
SS7 is a trunk protocol and should clear a failed call as soon as
possible.

* Made SS7 hangup a call immediately if it has not connected yet for
INCOMPLETE/BUSY/CONGESTION causes.  Otherwise, play an appropriate inband
tone.

(closes issue ASTERISK-19372)
Reported by: Igor Nikolaev
........

Merged revisions 358278 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 358284 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358307 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/sig_ss7.c

index a23f9b2..ccea949 100644 (file)
@@ -1671,6 +1671,12 @@ int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condi
 
        switch (condition) {
        case AST_CONTROL_BUSY:
+               if (p->call_level < SIG_SS7_CALL_LEVEL_CONNECT) {
+                       ast_channel_hangupcause_set(chan, AST_CAUSE_USER_BUSY);
+                       ast_channel_softhangup_internal_flag_add(chan, AST_SOFTHANGUP_DEV);
+                       res = 0;
+                       break;
+               }
                res = sig_ss7_play_tone(p, SIG_SS7_TONE_BUSY);
                break;
        case AST_CONTROL_RINGING:
@@ -1729,15 +1735,23 @@ int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condi
                res = 0;
                break;
        case AST_CONTROL_INCOMPLETE:
-               /* If the channel is connected, wait for additional input */
-               if (p->call_level == SIG_SS7_CALL_LEVEL_CONNECT) {
+               if (p->call_level < SIG_SS7_CALL_LEVEL_CONNECT) {
+                       ast_channel_hangupcause_set(chan, AST_CAUSE_INVALID_NUMBER_FORMAT);
+                       ast_channel_softhangup_internal_flag_add(chan, AST_SOFTHANGUP_DEV);
                        res = 0;
                        break;
                }
-               ast_channel_hangupcause_set(chan, AST_CAUSE_INVALID_NUMBER_FORMAT);
+               /* Wait for DTMF digits to complete the dialed number. */
+               res = 0;
                break;
        case AST_CONTROL_CONGESTION:
-               ast_channel_hangupcause_set(chan, AST_CAUSE_CONGESTION);
+               if (p->call_level < SIG_SS7_CALL_LEVEL_CONNECT) {
+                       ast_channel_hangupcause_set(chan, AST_CAUSE_CONGESTION);
+                       ast_channel_softhangup_internal_flag_add(chan, AST_SOFTHANGUP_DEV);
+                       res = 0;
+                       break;
+               }
+               res = sig_ss7_play_tone(p, SIG_SS7_TONE_CONGESTION);
                break;
        case AST_CONTROL_HOLD:
                ast_moh_start(chan, data, p->mohinterpret);