[svn-commits] mattf: trunk r491 - in /trunk: q921.c q931.c testprilib.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 4 12:01:51 CST 2007


Author: mattf
Date: Tue Dec  4 12:01:51 2007
New Revision: 491

URL: http://svn.digium.com/view/libpri?view=rev&rev=491
Log:
More magic to make BRI CPE PTMP work

Modified:
    trunk/q921.c
    trunk/q931.c
    trunk/testprilib.c

Modified: trunk/q921.c
URL: http://svn.digium.com/view/libpri/trunk/q921.c?view=diff&rev=491&r1=490&r2=491
==============================================================================
--- trunk/q921.c (original)
+++ trunk/q921.c Tue Dec  4 12:01:51 2007
@@ -438,6 +438,11 @@
 int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr)
 {
 	q921_frame *f, *prev=NULL;
+
+	/* Exception for BRI CPE PTMP */
+	if (pri->bri && (pri->localtype == PRI_CPE) && pri->subchannel)
+		return q921_transmit_iframe(pri->subchannel, buf, len, cr);
+
 	for (f=pri->txqueue; f; f = f->next) prev = f;
 	f = malloc(sizeof(q921_frame) + len + 2);
 	if (f) {
@@ -968,8 +973,16 @@
 			} else if (!h->u.m2) {
 				if ((pri->sapi == Q921_SAPI_LAYER2_MANAGEMENT) && (pri->tei == Q921_TEI_GROUP))
 					q921_receive_MDL(pri, (q921_u *)h, len);
-				else
-					pri_message(pri, "XXX Unnumbered Information not implemented XXX\n");
+				else {
+					int res;
+
+					res = q931_receive(pri, (q931_h *) h->u.data, len - 3);
+					if (res == -1) {
+						return NULL;
+					}
+					if (res & Q931_RES_HAVEEVENT)
+						return &pri->ev;
+				}
 			}
 			break;
 		case 2:
@@ -1048,8 +1061,9 @@
 		return NULL;
 #endif
 
+	if (!((h->h.sapi == pri->sapi) && ((h->h.tei == pri->tei) || (h->h.tei == Q921_TEI_GROUP)))) {
 	/* Check for SAPIs we don't yet handle */
-	if ((h->h.sapi != pri->sapi) || (h->h.tei != pri->tei)) {
+	//if ((h->h.sapi != pri->sapi) || ((h->h.tei != pri->tei) && (h->h.tei != Q921_TEI_GROUP))) {
 //#ifdef PROCESS_SUBCHANNELS
 		/* If it's not us, try any subchannels we have */
 		if (pri->subchannel)

Modified: trunk/q931.c
URL: http://svn.digium.com/view/libpri/trunk/q931.c?view=diff&rev=491&r1=490&r2=491
==============================================================================
--- trunk/q931.c (original)
+++ trunk/q931.c Tue Dec  4 12:01:51 2007
@@ -657,7 +657,7 @@
 		return 0;
 
 	tc = call->transcapability;
-	if (pri->subchannel) {
+	if (pri->subchannel && !pri->bri) {
 		/* Bearer capability is *hard coded* in GR-303 */
 		ie->data[0] = 0x88;
 		ie->data[1] = 0x90;
@@ -1285,7 +1285,7 @@
 {
 	int code, mask;
 	/* Can't send progress indicator on GR-303 -- EVER! */
-	if (pri->subchannel)
+	if (pri->subchannel && !pri->bri)
 		return 0;
 	if (call->progressmask > 0) {
 		if (call->progressmask & (mask = PRI_PROG_CALL_NOT_E2E_ISDN))
@@ -2231,6 +2231,11 @@
 static void q931_destroy(struct pri *pri, int cr, q931_call *c)
 {
 	q931_call *cur, *prev;
+
+	/* Magic for BRI PTMP CPE */
+	if (pri->subchannel && (pri->localtype == PRI_CPE) && pri->bri)
+		return q931_destroy(pri->subchannel, cr, c);
+
 	prev = NULL;
 	cur = *pri->callpool;
 	while(cur) {
@@ -2408,7 +2413,7 @@
 			h->crv[0] = 0;
 			h->crv[1] = 0;
 		}
-		if (pri->subchannel) {
+		if (pri->subchannel && !pri->bri) {
 			/* On GR-303, top bit is always 0 */
 			h->crv[0] &= 0x7f;
 		}
@@ -2744,7 +2749,7 @@
 	if (c->retranstimer)
 		pri_schedule_del(pri, c->retranstimer);
 	c->retranstimer = 0;
-	if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (!pri->subchannel))
+	if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (pri->bri || (!pri->subchannel)))
 		c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T313], pri_connect_timeout, c);
 	return send_message(pri, c, Q931_CONNECT, connect_ies);
 }
@@ -2838,7 +2843,7 @@
 	c->ds1no = (req->channel & 0xff00) >> 8;
 	c->ds1explicit = (req->channel & 0x10000) >> 16;
 	req->channel &= 0xff;
-	if ((pri->localtype == PRI_CPE) && pri->subchannel) {
+	if ((pri->localtype == PRI_CPE) && pri->subchannel && !pri->bri) {
 		req->channel = 0;
 		req->exclusive = 0;
 	}
@@ -2908,7 +2913,7 @@
 
 	pri_call_add_standard_apdus(pri, c);
 
-	if (pri->subchannel)
+	if (pri->subchannel && !pri->bri)
 		res = send_message(pri, c, Q931_SETUP, gr303_setup_ies);
 	else if (c->justsignalling)
 		res = send_message(pri, c, Q931_SETUP, cis_setup_ies);
@@ -2952,7 +2957,7 @@
 
 static int q931_connect_acknowledge(struct pri *pri, q931_call *c)
 {
-	if (pri->subchannel) {
+	if (pri->subchannel && !pri->bri) {
 		if (pri->localtype == PRI_CPE)
 			return send_message(pri, c, Q931_CONNECT_ACKNOWLEDGE, gr303_connect_acknowledge_ies);
 	} else

Modified: trunk/testprilib.c
URL: http://svn.digium.com/view/libpri/trunk/testprilib.c?view=diff&rev=491&r1=490&r2=491
==============================================================================
--- trunk/testprilib.c (original)
+++ trunk/testprilib.c Tue Dec  4 12:01:51 2007
@@ -254,7 +254,7 @@
 		perror("socketpair");
 		exit(1);
 	}
-	if (!(pri = pri_new_bri(pair[0], PRI_NETWORK, PRI_DEF_SWITCHTYPE))) {
+	if (!(pri = pri_new_bri(pair[0], 0, PRI_NETWORK, PRI_DEF_SWITCHTYPE))) {
 		perror("pri(0)");
 		exit(1);
 	}
@@ -265,7 +265,7 @@
 		perror("thread(0)");
 		exit(1);
 	}
-	if (!(pri = pri_new_bri(pair[1], PRI_CPE, PRI_DEF_SWITCHTYPE))) {
+	if (!(pri = pri_new_bri(pair[1], 0, PRI_CPE, PRI_DEF_SWITCHTYPE))) {
 		perror("pri(1)");
 		exit(1);
 	}




More information about the svn-commits mailing list