From 1efb27a04577f6952943b918d8880af40472cf1f Mon Sep 17 00:00:00 2001
From: Richard Mudgett <rmudgett@digium.com>
Date: Fri, 10 Sep 2010 21:03:08 +0000
Subject: [PATCH] Merged revisions 286118 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r286118 | rmudgett | 2010-09-10 15:55:37 -0500 (Fri, 10 Sep 2010) | 25 lines

  Merged revisions 286116 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2

  ................
    r286116 | rmudgett | 2010-09-10 15:42:44 -0500 (Fri, 10 Sep 2010) | 18 lines

    Merged revisions 286113 via svnmerge from
    https://origsvn.digium.com/svn/asterisk/branches/1.4

    ........
      r286113 | rmudgett | 2010-09-10 15:33:16 -0500 (Fri, 10 Sep 2010) | 11 lines

      An outgoing call may not get hung up if a pre-connect incoming ISDN call is disconnected.

      If the ISDN link a pre-connect incoming call is using fails or is reset,
      the outgoing leg may not hang up or be delayed in hanging up.  (Causes:
      PRI_CAUSE_NETWORK_OUT_OF_ORDER, PRI_CAUSE_DESTINATION_OUT_OF_ORDER, and
      PRI_CAUSE_NORMAL_TEMPORARY_FAILURE.)

      Just hang up the call if the incoming call leg hangs up before connecting
      for any reason.  It makes no sense to send a BUSY or CONGESTION control
      frame to the outgoing call leg under these circumstances.
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@286119 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/sig_pri.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index c75badd664..251e6a04a4 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -5225,6 +5225,14 @@ static void *pri_dchannel(void *vpri)
 									do_hangup = 1;
 									break;
 								default:
+									if (!pri->pvts[chanpos]->outgoing) {
+										/*
+										 * The incoming call leg hung up before getting
+										 * connected so just hangup the call.
+										 */
+										do_hangup = 1;
+										break;
+									}
 									switch (e->hangup.cause) {
 									case PRI_CAUSE_USER_BUSY:
 										pri_queue_control(pri, chanpos, AST_CONTROL_BUSY);
@@ -5358,6 +5366,14 @@ static void *pri_dchannel(void *vpri)
 								do_hangup = 1;
 								break;
 							default:
+								if (!pri->pvts[chanpos]->outgoing) {
+									/*
+									 * The incoming call leg hung up before getting
+									 * connected so just hangup the call.
+									 */
+									do_hangup = 1;
+									break;
+								}
 								switch (e->hangup.cause) {
 								case PRI_CAUSE_USER_BUSY:
 									pri_queue_control(pri, chanpos, AST_CONTROL_BUSY);
-- 
GitLab