[svn-commits] rmudgett: mISDNuser/trunk r108 - /mISDNuser/trunk/i4lnet/net_l3.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon May 11 14:44:42 CDT 2009


Author: rmudgett
Date: Mon May 11 14:44:38 2009
New Revision: 108

URL: http://svn.asterisk.org/svn-view/thirdparty?view=rev&rev=108
Log:
NT PTMP mode can cause TE's to ring endlessly if NT hangs up before they respond.

Incomplete state machine in mISDNuser net_l3.c.
A CC_DISCONNECT request changes L3 state to 22 (Call Abort), sends a
RELEASE to all child call processes, (i.e. to all TE's that have responded
up to this point).  All other TE's which respond subsequently never get a
RELEASE because the master call process is deleted too early, (before T312
times out).  Those TE's will ring endlessly.  (See Q.931 ch. 5.3.2.e.1)

The patch implements 5.3.2.e.1.  It keeps the master call process alive
as long as T312 is pending, and the additional (m)datastatelist
transitions allow the master call process to send a RELEASE to the TEs
that respond during T312.

Patches:
    misdnuser-l3state22.patch uploaded by customer (modified by me).

JIRA ABE-1862

Modified:
    mISDNuser/trunk/i4lnet/net_l3.c

Modified: mISDNuser/trunk/i4lnet/net_l3.c
URL: http://svn.asterisk.org/svn-view/thirdparty/mISDNuser/trunk/i4lnet/net_l3.c?view=diff&rev=108&r1=107&r2=108
==============================================================================
--- mISDNuser/trunk/i4lnet/net_l3.c (original)
+++ mISDNuser/trunk/i4lnet/net_l3.c Mon May 11 14:44:38 2009
@@ -1412,6 +1412,9 @@
 		free_msg(umsg);
 }
 
+static void
+l3dss1_release_state_22(layer3_proc_t *pc, int pr, void *arg);
+
 static struct stateentry datastatelist[] =
 {
 	{ALL_STATES,
@@ -1434,6 +1437,14 @@
 		MT_ALERTING, l3dss1_alerting_i},
 	{SBIT(6) | SBIT(7)  | SBIT(9) | SBIT(25),
 		MT_CONNECT, l3dss1_connect_i},
+	{SBIT(22),
+		MT_SETUP_ACKNOWLEDGE, l3dss1_release_state_22},
+	{SBIT(22),
+		MT_CALL_PROCEEDING, l3dss1_release_state_22},
+	{SBIT(22),
+		MT_ALERTING, l3dss1_release_state_22},
+	{SBIT(22),
+		MT_CONNECT, l3dss1_release_state_22},
 	{SBIT(1) | SBIT(2) | SBIT(3) | SBIT(4) | SBIT(10) | SBIT(19),
 		MT_DISCONNECT, l3dss1_disconnect},
 	{SBIT(7) | SBIT(8) | SBIT(9) | SBIT(25),
@@ -1591,6 +1602,14 @@
 		MT_ALERTING, l3dss1_alerting_m},
 	{SBIT(6) | SBIT(7) | SBIT(9) | SBIT(25),
 		MT_CONNECT, l3dss1_connect_m},
+	{SBIT(22),
+		MT_SETUP_ACKNOWLEDGE, l3dss1_release_state_22},
+	{SBIT(22),
+		MT_CALL_PROCEEDING, l3dss1_release_state_22},
+	{SBIT(22),
+		MT_ALERTING, l3dss1_release_state_22},
+	{SBIT(22),
+		MT_CONNECT, l3dss1_release_state_22},
 	{SBIT(2) | SBIT(3) | SBIT(4) | SBIT(7) | SBIT(8) | SBIT(9) | SBIT(10) |
 	 SBIT(11) | SBIT(12) | SBIT(15) | SBIT(17) | SBIT(19) | SBIT(25),
 		MT_INFORMATION, l3dss1_information_mx},
@@ -2086,6 +2105,26 @@
 	}
 	test_and_clear_bit(FLG_L3P_TIMER308_1, &pc->Flags);
 	L3AddTimer(&pc->timer1, T308, 0x308);
+}
+
+static void
+l3dss1_release_state_22(layer3_proc_t *pc, int pr, void *arg)
+{
+	RELEASE_t release;
+	u_char cause[3];
+
+	if (!pc->master) {
+		create_child_proc(pc, pr, arg, 22);
+	} else {
+		/* Build cause code ie contents for message */
+		memset(&release, 0, sizeof(RELEASE_t));
+		release.CAUSE = cause;
+		cause[0] = 2;
+		cause[1] = 0x80 | CAUSE_LOC_PNET_LOCUSER;
+		cause[2] = 0x80 | CAUSE_NONSELECTED_USER;
+
+		l3dss1_release_req(pc, pr, &release);
+	}
 }
 
 static void
@@ -2615,7 +2654,12 @@
 			}
 			break;
 		case 22:
-			if (!master->child) {
+			/*
+			 * Never end master proc if T312 is pending, more TEs might
+			 * answer the UI SETUP and must get a RELEASE so they don't
+			 * ring endlessly.  T312 will expire and finish the job.
+			 */
+			if (!master->child && !test_bit(FLG_L3P_TIMER312, &master->Flags)) {
 				send_proc(master, IMSG_END_PROC, NULL);
 			}
 			break;
@@ -2658,6 +2702,9 @@
 					proc->master->child = proc->next;
 				if (op == IMSG_END_PROC_M)
 					imsg_intrelease(proc->master, proc);
+			}
+			if (proc->l3 && proc->l3->debug & L3_DEB_PROC) {
+				l3_debug(proc->l3, "free(%p)", proc);  
 			}
 			free(proc);
 			break;




More information about the svn-commits mailing list