[libpri-commits] rmudgett: tag 1.4.11.4 r1945 - /tags/1.4.11.4/q931.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Mon Aug 30 17:21:54 CDT 2010


Author: rmudgett
Date: Mon Aug 30 17:21:52 2010
New Revision: 1945

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1945
Log:
Merged revisions 1853 via svnmerge from 
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1853 | rmudgett | 2010-08-06 13:35:35 -0500 (Fri, 06 Aug 2010) | 18 lines
  
  No audio on inbound J1 calls.
  
  Incoming calls specifying the channel using a slot map could not negotiate
  a B channel correctly.  Libpri historically has handled this as an any
  channel request.  However, when chan_dahdi picked a new channel, libpri
  sent out the recorded slot map and not the new channel selected.  Thus the
  two endpoints would be attached to different B channels and the parties
  would not hear anything or would hear the wrong parties.
  
  This patch restores the historical preference of sending out the channel
  id using the channel number method if a channel number is available.
  
  JIRA LIBPRI-35
  Patches:
        libpri-35_v1.4.11.3.patch uploaded by rmudgett (license 664)
        libpri-35_v1.4.patch uploaded by rmudgett (license 664)
  Tested by: rmudgett
........

Modified:
    tags/1.4.11.4/q931.c

Modified: tags/1.4.11.4/q931.c
URL: http://svnview.digium.com/svn/libpri/tags/1.4.11.4/q931.c?view=diff&rev=1945&r1=1944&r2=1945
==============================================================================
--- tags/1.4.11.4/q931.c (original)
+++ tags/1.4.11.4/q931.c Mon Aug 30 17:21:52 2010
@@ -885,7 +885,12 @@
 			return -1;
 		}
 		if (ie->data[pos] & 0x10) {
-			/* Expect Slot Map */
+			/*
+			 * Expect Slot Map
+			 * Note that we are assuming only T1's use slot maps which is wrong
+			 * but oh well...  We would need to know what type of line we are
+			 * connected with (T1 or E1) to interpret the map correctly anyway.
+			 */
 			call->slotmap = 0;
 			pos++;
 			for (x=0;x<3;x++) {
@@ -963,22 +968,26 @@
 		&& !(call->chanflags & FLAG_WHOLE_INTERFACE)) {
 		/* The 3.2 and 3.3 octets need to be present */
 		ie->data[pos] = 0x83;
-		if (call->slotmap != -1) {
-			int octet;
-
-			/* We have to send a channel map */
-			ie->data[pos++] |= 0x10;
-			for (octet = 3; octet--;) {
-				ie->data[pos++] = (call->slotmap >> (8 * octet)) & 0xff;
-			}
-		} else {
-			/* Channel number specified */
+		if (0 < call->channelno && call->channelno != 0xff) {
+			/* Channel number specified and preferred over slot map if we have one. */
 			++pos;
 			if (ctrl->chan_mapping_logical && call->channelno > 16) {
 				ie->data[pos++] = 0x80 | (call->channelno - 1);
 			} else {
 				ie->data[pos++] = 0x80 | call->channelno;
 			}
+		} else if (call->slotmap != -1) {
+			int octet;
+
+			/* We have to send a slot map */
+			ie->data[pos++] |= 0x10;
+			for (octet = 3; octet--;) {
+				ie->data[pos++] = (call->slotmap >> (8 * octet)) & 0xff;
+			}
+		} else {
+			pri_error(ctrl, "XXX We need either a channelno or slotmap but have neither!\n");
+			/* Discard this malformed ie. */
+			return 0;
 		}
 	}
 




More information about the libpri-commits mailing list