[libpri-commits] rmudgett: branch 1.4 r2104 - /branches/1.4/q921.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Fri Nov 5 14:59:49 CDT 2010


Author: rmudgett
Date: Fri Nov  5 14:59:45 2010
New Revision: 2104

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2104
Log:
Q.921 TEI assignment procedure corrections.

* We should send the TEI identity denied message with TEI=127 when the TEI
pool is exhausted.

* We should remove our TEI if we see a TEI identity assign message
assigning our TEI to someone else.

Modified:
    branches/1.4/q921.c

Modified: branches/1.4/q921.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/q921.c?view=diff&rev=2104&r1=2103&r2=2104
==============================================================================
--- branches/1.4/q921.c (original)
+++ branches/1.4/q921.c Fri Nov  5 14:59:45 2010
@@ -1243,6 +1243,7 @@
 					}
 					/* XXX : TODO later sometime: Implement the TEI check procedure to reclaim some dead TEIs. */
 					pri_error(ctrl, "Reached maximum TEI quota, cannot assign new TEI\n");
+					q921_send_tei(ctrl, Q921_TEI_IDENTITY_DENIED, ri, Q921_TEI_GROUP, 1);
 					return NULL;
 				}
 			}
@@ -1268,18 +1269,35 @@
 		link = ctrl->link.next;
 		
 		switch (link->state) {
+		case Q921_TEI_UNASSIGNED:
+			/* We do not have a TEI and we are not asking for one. */
+			return NULL;
 		case Q921_ASSIGN_AWAITING_TEI:
 		case Q921_ESTABLISH_AWAITING_TEI:
+			/* We do not have a TEI and we want one. */
 			break;
 		default:
-			pri_message(ctrl, "Ignoring unrequested TEI assign message\n");
+			/* We already have a TEI. */
+			if (tei == link->tei) {
+				/*
+				 * The TEI assignment conflicts with ours.  Our TEI is the
+				 * duplicate so we should remove it.  Q.921 Section 5.3.4.2
+				 * condition c.
+				 */
+				pri_error(ctrl, "TEI=%d Conflicting TEI assignment.  Removing our TEI.\n",
+					tei);
+				q921_mdl_remove(link);
+				q921_start(link);
+			}
 			return NULL;
 		}
 
 		if (ri != link->ri) {
-			pri_message(ctrl,
-				"TEI assignment received for another Ri %02x (ours is %02x)\n",
-				ri, link->ri);
+			if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
+				pri_message(ctrl,
+					"TEI assignment received for another Ri %02x (ours is %02x)\n",
+					ri, link->ri);
+			}
 			return NULL;
 		}
 




More information about the libpri-commits mailing list