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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1853 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Richard Mudgett
2010-08-06 18:35:35 +00:00
parent 9d1fa7f276
commit b2e28bd1e4

31
q931.c
View File

@@ -1003,7 +1003,12 @@ static int receive_channel_id(int full_ie, struct pri *ctrl, q931_call *call, in
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++) {
@@ -1085,22 +1090,26 @@ static int transmit_channel_id(int full_ie, struct pri *ctrl, q931_call *call, i
&& !(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;
}
}