[libpri-commits] rmudgett: branch rmudgett/mwi2 r2198 - /team/rmudgett/mwi2/q931.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Wed Feb 9 13:51:23 CST 2011


Author: rmudgett
Date: Wed Feb  9 13:51:19 2011
New Revision: 2198

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2198
Log:
The called number did not go out in the FACILITY message.

* Fix sending called number ie in FACILITY message.  The called number
needs to be staged in the call->overlap_digits string.

* Protect the call->called.number.str when receiving the called number in
an unexpected message.

Modified:
    team/rmudgett/mwi2/q931.c

Modified: team/rmudgett/mwi2/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/mwi2/q931.c?view=diff&rev=2198&r1=2197&r2=2198
==============================================================================
--- team/rmudgett/mwi2/q931.c (original)
+++ team/rmudgett/mwi2/q931.c Wed Feb  9 13:51:19 2011
@@ -2342,26 +2342,42 @@
 		return -1;
 	}
 
+	switch (msgtype) {
+	case Q931_FACILITY:
+		if (!q931_is_dummy_call(call) {
+			/* Discard the number. */
+			return 0;
+		}
+		/* Fall through */
+	case Q931_REGISTER:
+		/* Accept the number for REGISTER only because it is so similar to SETUP. */
+	case Q931_SETUP:
+		q931_get_number((unsigned char *) call->called.number.str,
+			sizeof(call->called.number.str), ie->data + 1, len - 3);
+		break;
+	case Q931_INFORMATION:
+		if (call->ourcallstate == Q931_CALL_STATE_OVERLAP_RECEIVING) {
+			/*
+			 * Since we are receiving overlap digits now, we need to append
+			 * them to any previously received digits in call->called.number.str.
+			 */
+			called_len = strlen(call->called.number.str);
+			called_end = call->called.number.str + called_len;
+			max_len = (sizeof(call->called.number.str) - 1) - called_len;
+			if (max_len < len - 3) {
+				called_len = max_len;
+			} else {
+				called_len = len - 3;
+			}
+			strncat(called_end, (char *) ie->data + 1, called_len);
+		}
+		break;
+	default:
+		/* Discard the number. */
+		return 0;
+	}
 	call->called.number.valid = 1;
 	call->called.number.plan = ie->data[0] & 0x7f;
-	if (msgtype == Q931_SETUP) {
-		q931_get_number((unsigned char *) call->called.number.str,
-			sizeof(call->called.number.str), ie->data + 1, len - 3);
-	} else if (call->ourcallstate == Q931_CALL_STATE_OVERLAP_RECEIVING) {
-		/*
-		 * Since we are receiving overlap digits now, we need to append
-		 * them to any previously received digits in call->called.number.str.
-		 */
-		called_len = strlen(call->called.number.str);
-		called_end = call->called.number.str + called_len;
-		max_len = (sizeof(call->called.number.str) - 1) - called_len;
-		if (max_len < len - 3) {
-			called_len = max_len;
-		} else {
-			called_len = len - 3;
-		}
-		strncat(called_end, (char *) ie->data + 1, called_len);
-	}
 
 	q931_get_number((unsigned char *) call->overlap_digits, sizeof(call->overlap_digits),
 		ie->data + 1, len - 3);
@@ -5014,6 +5030,8 @@
 	};
 
 	q931_party_id_copy_to_address(&call->called, called);
+	libpri_copy_string(call->overlap_digits, call->called.number.str,
+		sizeof(call->overlap_digits));
 	return send_message(ctrl, call, Q931_FACILITY, facility_called_ies);
 }
 




More information about the libpri-commits mailing list