aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-11-20 11:58:35 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-11-20 17:35:47 +0100
commita4e6f2e6e133b8c4316ec28067b73940c63e16c5 (patch)
tree9bb285a10ef7b6c61014d89d914e68f8cd090d25 /openbsc
parent7f71d99cc3f8bface8eda3004ae51c26ce9bb698 (diff)
[bssap] Support multiple multiplexers in the assignment command
When more than one trunk group is allocated to the BSC the MSC will start to assign channels from the different multiplexer. We will map them the following way onto MGCP endpoints Multiplex 0: 0 -> 1 1 -> signalling 2 -> 2 .. -> .. 16 -> signalling (might be 15) 30 -> 30 Multiplex 1: 0 -> 31 2 -> 32 ... Multiplex 3: ..
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/bssap.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/openbsc/src/bssap.c b/openbsc/src/bssap.c
index 874400fd1..14b6bb64f 100644
--- a/openbsc/src/bssap.c
+++ b/openbsc/src/bssap.c
@@ -353,9 +353,11 @@ static int bssmap_handle_assignm_req(struct sccp_connection *conn,
struct tlv_parsed tp;
struct bss_sccp_connection_data *msc_data;
u_int8_t *data;
+ u_int16_t cic;
+ u_int8_t timeslot;
u_int8_t multiplex;
enum gsm48_chan_mode chan_mode = GSM48_CMODE_SIGN;
- int i, supported;
+ int i, supported, port;
if (!msg->lchan || !msg->lchan->msc_data) {
DEBUGP(DMSC, "No lchan/msc_data in cipher mode command.\n");
@@ -376,7 +378,9 @@ static int bssmap_handle_assignm_req(struct sccp_connection *conn,
goto reject;
}
- multiplex = TLVP_VAL(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)[1] & 0x1f;
+ cic = ntohs(*(u_int16_t *)TLVP_VAL(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE));
+ timeslot = cic & 0x1f;
+ multiplex = (cic & ~0x1f) >> 5;
/*
* Currently we only support a limited subset of all
@@ -438,12 +442,13 @@ static int bssmap_handle_assignm_req(struct sccp_connection *conn,
bsc_schedule_timer(&msc_data->T10, GSM0808_T10_VALUE);
/* the mgcp call agent starts counting at one. a bit of a weird mapping */
- if (multiplex == 0)
- multiplex = 1;
- msc_data->rtp_port = rtp_calculate_port(multiplex,
+ if (timeslot == 0)
+ timeslot = 1;
+ port = timeslot + (31 * multiplex);
+ msc_data->rtp_port = rtp_calculate_port(port,
network->rtp_base_port);
- DEBUGP(DMSC, "Sending ChanModify for speech on: sccp: %p mode: 0x%x on 0x%x port: %u\n",
- conn, chan_mode, multiplex, msc_data->rtp_port);
+ DEBUGP(DMSC, "Sending ChanModify for speech on: sccp: %p mode: 0x%x on port %d %d/0x%x port: %u\n",
+ conn, chan_mode, port, multiplex, timeslot, msc_data->rtp_port);
if (chan_mode == GSM48_CMODE_SPEECH_AMR) {
msg->lchan->mr_conf.ver = 1;
msg->lchan->mr_conf.icmi = 1;