Merged revisions 62419 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Mon, 30 Apr 2007 15:59:27 +0000 (15:59 +0000)
committerRussell Bryant <russell@russellbryant.com>
Mon, 30 Apr 2007 15:59:27 +0000 (15:59 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r62419 | russell | 2007-04-30 10:58:28 -0500 (Mon, 30 Apr 2007) | 12 lines

Merged revisions 62417 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r62417 | russell | 2007-04-30 10:57:26 -0500 (Mon, 30 Apr 2007) | 4 lines

This patch fixes an issue where depending on the cause code, when the network
sends a PRI disconnect, the call may not be properly hung up.
(issue #9588, reported and patched by softins)

........

................

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

channels/chan_zap.c

index 47904b8..a614194 100644 (file)
@@ -10087,25 +10087,17 @@ static void *pri_dchannel(void *vpri)
                                                        else if (pri->pvts[chanpos]->owner) {
                                                                /* Queue a BUSY instead of a hangup if our cause is appropriate */
                                                                pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
-                                                               switch (e->hangup.cause) {
-                                                               case PRI_CAUSE_USER_BUSY:
-                                                                       pri->pvts[chanpos]->subs[SUB_REAL].needbusy =1;
-                                                                       break;
-                                                               case PRI_CAUSE_CALL_REJECTED:
-                                                               case PRI_CAUSE_NETWORK_OUT_OF_ORDER:
-                                                               case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
-                                                               case PRI_CAUSE_SWITCH_CONGESTION:
-                                                               case PRI_CAUSE_DESTINATION_OUT_OF_ORDER:
-                                                               case PRI_CAUSE_NORMAL_TEMPORARY_FAILURE:
-                                                                       pri->pvts[chanpos]->subs[SUB_REAL].needcongestion =1;
-                                                                       break;
-                                                               default:
+
+                                                               if (pri->pvts[chanpos]->owner->_state == AST_STATE_UP)
                                                                        pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
-                                                               }
+                                                               else if (pri->pvts[chanpos]->owner->hangupcause == PRI_CAUSE_USER_BUSY)
+                                                                       pri->pvts[chanpos]->subs[SUB_REAL].needbusy = 1;
+                                                               else
+                                                                       pri->pvts[chanpos]->subs[SUB_REAL].needcongestion = 1;
                                                        }
                                                        if (option_verbose > 2) 
-                                                               ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup\n", 
-                                                                       pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
+                                                               ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup, cause %d\n", 
+                                                                       pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, e->hangup.cause);
                                                } else {
                                                        pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
                                                        pri->pvts[chanpos]->call = NULL;
@@ -10151,23 +10143,16 @@ static void *pri_dchannel(void *vpri)
                                                        pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
                                                else if (pri->pvts[chanpos]->owner) {
                                                        pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
-                                                       switch (e->hangup.cause) {
-                                                       case PRI_CAUSE_USER_BUSY:
-                                                               pri->pvts[chanpos]->subs[SUB_REAL].needbusy =1;
-                                                               break;
-                                                       case PRI_CAUSE_CALL_REJECTED:
-                                                       case PRI_CAUSE_NETWORK_OUT_OF_ORDER:
-                                                       case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
-                                                       case PRI_CAUSE_SWITCH_CONGESTION:
-                                                       case PRI_CAUSE_DESTINATION_OUT_OF_ORDER:
-                                                       case PRI_CAUSE_NORMAL_TEMPORARY_FAILURE:
-                                                               pri->pvts[chanpos]->subs[SUB_REAL].needcongestion =1;
-                                                               break;
-                                                       default:
+
+                                                       if (pri->pvts[chanpos]->owner->_state == AST_STATE_UP)
                                                                pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
-                                                       }
+                                                       else if (pri->pvts[chanpos]->owner->hangupcause == PRI_CAUSE_USER_BUSY)
+                                                               pri->pvts[chanpos]->subs[SUB_REAL].needbusy = 1;
+                                                       else
+                                                               pri->pvts[chanpos]->subs[SUB_REAL].needcongestion = 1;
+
                                                        if (option_verbose > 2) 
-                                                               ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup request\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
+                                                               ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup request, cause %d\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span, e->hangup.cause);
                                                        if (e->hangup.aoc_units > -1)
                                                                if (option_verbose > 2)
                                                                        ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d received AOC-E charging %d unit%s\n",