summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-06 06:42:00 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-08-25 23:19:13 +0200
commitfee372e673b3b33ec2a67dc90242c2ff65fe43dc (patch)
tree018c9e4b22b8664f72349e7a4855d6223418fb9a
parent34ae47f8d3bf886f543c1aab77f94b7d78c7bcd4 (diff)
audio: Move the setting of MultiRateConfig to one place
Move it to one place so it is more easy to make changes to that.
-rw-r--r--openbsc/src/libbsc/bsc_api.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index 70d6413..351cc34 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -1,7 +1,7 @@
/* GSM 08.08 like API for OpenBSC. The bridge from MSC to BSC */
-/* (C) 2010 by Holger Hans Peter Freyther
- * (C) 2010 by On-Waves
+/* (C) 2010-2011 by Holger Hans Peter Freyther
+ * (C) 2010-2011 by On-Waves
* (C) 2009 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
@@ -145,6 +145,17 @@ static void assignment_t10_timeout(void *_conn)
api->assign_fail(conn, GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE, NULL);
}
+/**
+ * Handle the multirate config
+ */
+static void handle_mr_config(struct gsm_subscriber_connection *conn,
+ struct gsm_lchan *lchan)
+{
+ lchan->mr_conf.ver = 1;
+ lchan->mr_conf.icmi = 1;
+ lchan->mr_conf.m5_90 = 1;
+}
+
/*
* Start a new assignment and make sure that it is completed within T10 either
* positively, negatively or by the timeout.
@@ -184,11 +195,8 @@ static int handle_new_assignment(struct gsm_subscriber_connection *conn, int cha
new_lchan->rsl_cmode = RSL_CMOD_SPD_SPEECH;
/* handle AMR correctly */
- if (chan_mode == GSM48_CMODE_SPEECH_AMR) {
- new_lchan->mr_conf.ver = 1;
- new_lchan->mr_conf.icmi = 1;
- new_lchan->mr_conf.m5_90 = 1;
- }
+ if (chan_mode == GSM48_CMODE_SPEECH_AMR)
+ handle_mr_config(conn, new_lchan);
if (rsl_chan_activate_lchan(new_lchan, 0x1, 0, 0) < 0) {
LOGP(DHO, LOGL_ERROR, "could not activate channel\n");
@@ -299,8 +307,8 @@ int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
* Send a GSM08.08 Assignment Request. Right now this does not contain the
* audio codec type or the allowed rates for the config. It is assumed that
* this is for audio handling and that when we have a TCH it is capable of
- * handling the audio codec. On top of that it is assumed that we are using
- * AMR 5.9 when assigning a TCH/H.
+ * handling the audio codec. In case AMR is used we will leave the multi
+ * rate configuration to someone else.
*/
int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate)
{
@@ -313,11 +321,8 @@ int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, in
} else {
LOGP(DMSC, LOGL_NOTICE,
"Sending ChanModify for speech %d %d\n", chan_mode, full_rate);
- if (chan_mode == GSM48_CMODE_SPEECH_AMR) {
- conn->lchan->mr_conf.ver = 1;
- conn->lchan->mr_conf.icmi = 1;
- conn->lchan->mr_conf.m5_90 = 1;
- }
+ if (chan_mode == GSM48_CMODE_SPEECH_AMR)
+ handle_mr_config(conn, conn->lchan);
gsm48_lchan_modify(conn->lchan, chan_mode);
}