[libpri-commits] mattf: branch mattf/libpri-1.4-ntptmp r945 - /team/mattf/libpri-1.4-ntptmp/

SVN commits to the libpri project libpri-commits at lists.digium.com
Tue Jul 21 15:23:47 CDT 2009


Author: mattf
Date: Tue Jul 21 15:23:44 2009
New Revision: 945

URL: http://svn.asterisk.org/svn-view/libpri?view=rev&rev=945
Log:
Add functional handling for unmatched TEI/SAPI messages that are received.  Right now we tell the other end to remove the TEI

Modified:
    team/mattf/libpri-1.4-ntptmp/pri_internal.h
    team/mattf/libpri-1.4-ntptmp/q921.c

Modified: team/mattf/libpri-1.4-ntptmp/pri_internal.h
URL: http://svn.asterisk.org/svn-view/libpri/team/mattf/libpri-1.4-ntptmp/pri_internal.h?view=diff&rev=945&r1=944&r2=945
==============================================================================
--- team/mattf/libpri-1.4-ntptmp/pri_internal.h (original)
+++ team/mattf/libpri-1.4-ntptmp/pri_internal.h Tue Jul 21 15:23:44 2009
@@ -295,21 +295,25 @@
 
 void __pri_free_tei(struct pri *p);
 
-static inline int BRI_NT_PTMP(struct pri *ctrl)
+static inline struct pri * PRI_MASTER(struct pri *pri)
 {
-	while (ctrl->master)
-		ctrl = ctrl->master;
-
-	return ctrl->bri && (((ctrl)->localtype == PRI_NETWORK) && ((ctrl)->tei == Q921_TEI_GROUP));
+	while (pri->master)
+		pri = pri->master;
+	return pri;
 }
 
-static inline int BRI_TE_PTMP(struct pri *ctrl)
+static inline int BRI_NT_PTMP(struct pri *pri)
 {
-	while (ctrl->master)
-		ctrl = ctrl->master;
-
-	return ctrl->bri && (((ctrl)->localtype == PRI_CPE) && ((ctrl)->tei == Q921_TEI_GROUP));
+	return pri->bri && (((pri)->localtype == PRI_NETWORK) && ((pri)->tei == Q921_TEI_GROUP));
 }
 
+static inline int BRI_TE_PTMP(struct pri *pri)
+{
+	while (pri->master)
+		pri = pri->master;
+
+	return pri->bri && (((pri)->localtype == PRI_CPE) && ((pri)->tei == Q921_TEI_GROUP));
+}
+
 
 #endif

Modified: team/mattf/libpri-1.4-ntptmp/q921.c
URL: http://svn.asterisk.org/svn-view/libpri/team/mattf/libpri-1.4-ntptmp/q921.c?view=diff&rev=945&r1=944&r2=945
==============================================================================
--- team/mattf/libpri-1.4-ntptmp/q921.c (original)
+++ team/mattf/libpri-1.4-ntptmp/q921.c Tue Jul 21 15:23:44 2009
@@ -1266,27 +1266,29 @@
 	return NULL;
 }
 
-#if 0
 static pri_event *q921_handle_unmatched_frame(struct pri *pri, q921_h *h, int len)
 {
+	pri = PRI_MASTER(pri);
+
 	pri_error(pri, "Could not find candidate subchannel for received frame with SAPI/TEI of %d/%d.\n", h->h.sapi, h->h.tei);
+
 	if (h->h.tei < 64) {
 		pri_error(pri, "Do not support manual TEI range. Discarding\n");
 		return NULL;
 	}
 
-	if (h->h.sapi != Q921_CALL_CTRL) {
+	if (h->h.sapi != Q921_SAPI_CALL_CTRL) {
 		pri_error(pri, "Message with SAPI other than CALL CTRL is discarded\n");
 		return NULL;
 	}
 
-	pri_message(pri, "Sending TEI release, in order to re-establish TEI state\n");
+	pri_error(pri, "Sending TEI release, in order to re-establish TEI state\n");
 
 	/* TODO: Send TEI release message here */
+	q921_send_tei(pri, Q921_TEI_IDENTITY_REMOVE, 0, h->h.tei, 1);
 
 	return NULL;
 }
-#endif
 
 static pri_event *__q921_receive(struct pri *pri, q921_h *h, int len)
 {
@@ -1316,14 +1318,7 @@
 			/* This means we couldn't find a candidate subchannel for it...
 			 * Time for some corrective action */
 
-#if 0
-			if (pri->master)
-				return q921_handle_unmatched_frame(pri->master, h, len);
-			else
-				return NULL;
-#else
-			return NULL;
-#endif
+			return q921_handle_unmatched_frame(pri, h, len);
 		}
 
 	}




More information about the libpri-commits mailing list