[libpri-commits] rmudgett: branch 1.4 r1426 - in /branches/1.4: q921.c q931.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Tue Jan 19 15:53:35 CST 2010


Author: rmudgett
Date: Tue Jan 19 15:53:31 2010
New Revision: 1426

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1426
Log:
Fix TE PTMP side sending FACILITY messages on the dummy call reference.

Only the NT PTMP side can send Q.931 broadcast messages.

Also removed an inaccurate comment in Q.921 and made
q921_mdl_handle_error_callback() call the correct struct pri free
function.

Modified:
    branches/1.4/q921.c
    branches/1.4/q931.c

Modified: branches/1.4/q921.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/q921.c?view=diff&rev=1426&r1=1425&r2=1426
==============================================================================
--- branches/1.4/q921.c (original)
+++ branches/1.4/q921.c Tue Jan 19 15:53:31 2010
@@ -564,7 +564,6 @@
 
 		if (pri->q921_state == Q921_TEI_UNASSIGNED) {
 			q921_tei_request(pri);
-			/* We don't setstate here because the pri with the TEI we need hasn't been created */
 			q921_setstate(pri, Q921_ESTABLISH_AWAITING_TEI);
 		}
 	} else {
@@ -1299,7 +1298,7 @@
 			pri_message(pri, "Freeing TEI of %d\n", freep->tei);
 		}
 
-		free(freep);
+		__pri_free_tei(freep);
 	}
 
 	return;

Modified: branches/1.4/q931.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/q931.c?view=diff&rev=1426&r1=1425&r2=1426
==============================================================================
--- branches/1.4/q931.c (original)
+++ branches/1.4/q931.c Tue Jan 19 15:53:31 2010
@@ -3969,6 +3969,7 @@
 	int offset=0;
 	int x;
 	int codeset;
+	int uiframe;
 
 	if (call->outboundbroadcast && call->master_call == call && msgtype != Q931_SETUP) {
 		pri_error(ctrl,
@@ -3997,10 +3998,9 @@
 	/* Invert the logic */
 	len = sizeof(buf) - len;
 
-	ctrl = call->pri;
-	if (ctrl) {
-		int uiframe;
-
+	uiframe = 0;
+	if (BRI_NT_PTMP(ctrl)) {
+		/* NT PTMP is the only mode that can broadcast Q.931 messages. */
 		switch (msgtype) {
 		case Q931_SETUP:
 			/* 
@@ -4011,13 +4011,10 @@
 			 * If those are true, we need to send the SETUP in a UI frame
 			 * instead of an I-frame.
 			 */
-			if (BRI_NT_PTMP(ctrl))
-				uiframe = 1;
-			else
-				uiframe = 0;
+			uiframe = 1;
 			break;
 		case Q931_FACILITY:
-			if (ctrl->tei == Q921_TEI_GROUP) {
+			if (call->pri->tei == Q921_TEI_GROUP) {
 				/* Broadcast TEI. */
 				if (q931_is_dummy_call(call)) {
 					/*
@@ -4031,23 +4028,19 @@
 						msg2str(msgtype), call->cr);
 					return -1;
 				}
-			} else {
-				uiframe = 0;
 			}
 			break;
 		default:
-			uiframe = 0;
 			break;
 		}
 		if (ctrl->debug & PRI_DEBUG_Q931_STATE) {
+			/* This message is only interesting for NT PTMP mode. */
 			pri_message(ctrl,
-				"Sending message for call %p on %p TEI/SAPI %d/%d, call->pri is %p, TEI/SAPI %d/%d\n",
-				call,
-				ctrl, ctrl->tei, ctrl->sapi,
-				call->pri, call->pri->tei, call->pri->sapi);
-		}
-		q931_xmit(ctrl, ctrl->tei, h, len, 1, uiframe);
-	}
+				"Sending message for call %p on call->pri: %p with TEI/SAPI %d/%d\n",
+				call, call->pri, call->pri->tei, call->pri->sapi);
+		}
+	}
+	q931_xmit(call->pri, call->pri->tei, h, len, 1, uiframe);
 	call->acked = 1;
 	return 0;
 }




More information about the libpri-commits mailing list