[libpri-commits] rmudgett: branch rmudgett/v1.4.11.5 r2125 - /team/rmudgett/v1.4.11.5/q921.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Wed Nov 17 12:37:37 CST 2010


Author: rmudgett
Date: Wed Nov 17 12:37:34 2010
New Revision: 2125

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2125
Log:
Merged revision 2101 from
https://origsvn.digium.com/svn/libpri/branches/1.4

..........
  r2101 | rmudgett | 2010-11-05 14:24:01 -0500 (Fri, 05 Nov 2010) | 9 lines

  Remove all TEIs when NT PTMP starts.

  Remove all TEIs when a NT PTMP link is started and there are no other
  links to make sure there are no devices that think they have a TEI.  A
  device may think it has a TEI if the upper layer program is restarted or
  the system reboots.

  This fixes the bug portion of JIRA LIBPRI-51/SWP-2453.
..........

Modified:
    team/rmudgett/v1.4.11.5/q921.c

Modified: team/rmudgett/v1.4.11.5/q921.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/v1.4.11.5/q921.c?view=diff&rev=2125&r1=2124&r2=2125
==============================================================================
--- team/rmudgett/v1.4.11.5/q921.c (original)
+++ team/rmudgett/v1.4.11.5/q921.c Wed Nov 17 12:37:34 2010
@@ -233,6 +233,16 @@
 {
 	ctrl->n202_counter = 0;
 	t202_expire(ctrl);
+}
+
+static void q921_tei_remove(struct pri *ctrl, int tei)
+{
+	/*
+	 * Q.921 Section 5.3.2 says we should send the remove message
+	 * twice, in case of message loss.
+	 */
+	q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, tei, 1);
+	q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, tei, 1);
 }
 
 static void q921_send_dm(struct pri *ctrl, int fbit)
@@ -2455,9 +2465,7 @@
 			pri_message(ctrl, "Sending TEI release, in order to re-establish TEI state\n");
 		}
 	
-		/* Q.921 says we should send the remove message twice, in case of link corruption */
-		q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, h->h.tei, 1);
-		q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, h->h.tei, 1);
+		q921_tei_remove(ctrl, h->h.tei);
 	}
 
 	return NULL;
@@ -2556,6 +2564,16 @@
 		} else {
 			q921_setstate(ctrl, Q921_TEI_UNASSIGNED);
 			pri_schedule_event(ctrl, 0, nt_ptmp_dchannel_up, ctrl);
+			ctrl = PRI_MASTER(ctrl);
+			if (!ctrl->subchannel) {
+				/*
+				 * We do not have any TEI's so make sure there are no devices
+				 * that think they have a TEI.  A device may think it has a TEI
+				 * if the upper layer program is restarted or the system
+				 * reboots.
+				 */
+				q921_tei_remove(ctrl, Q921_TEI_GROUP);
+			}
 		}
 	} else {
 		/* PTP mode, no need for TEI management junk */




More information about the libpri-commits mailing list