aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-06 07:00:52 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-01-07 16:10:31 +0100
commit25aa749f10f477ea82847df12c5993721dd1aa1f (patch)
treef7b24c89d1d7df87758934ad1e7ac4a5c68daf5b
parentff799f091230d5214b4ba9e08e146fd0d989a458 (diff)
audio: Make the BSC handle the new mr_config request of the BSC API
Handle the mr_config request and set the AMR multirate config for the given MSC. Initialize the mr_config with the AMR5.9 default we have been using until now.
-rw-r--r--openbsc/include/openbsc/bsc_api.h7
-rw-r--r--openbsc/include/openbsc/osmo_msc_data.h2
-rw-r--r--openbsc/src/libbsc/bsc_api.c6
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_api.c29
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_msc.c3
5 files changed, 47 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/bsc_api.h b/openbsc/include/openbsc/bsc_api.h
index 472c8e471..f52984f39 100644
--- a/openbsc/include/openbsc/bsc_api.h
+++ b/openbsc/include/openbsc/bsc_api.h
@@ -34,6 +34,13 @@ struct bsc_api {
void (*classmark_chg)(struct gsm_subscriber_connection *conn,
const uint8_t *cm2, uint8_t cm2_len,
const uint8_t *cm3, uint8_t cm3_len);
+
+ /**
+ * Configure the multirate setting on this channel. If it is
+ * not implemented AMR5.9 will be used.
+ */
+ void (*mr_config)(struct gsm_subscriber_connection *conn,
+ struct gsm48_multi_rate_conf *conf);
};
int bsc_api_init(struct gsm_network *network, struct bsc_api *api);
diff --git a/openbsc/include/openbsc/osmo_msc_data.h b/openbsc/include/openbsc/osmo_msc_data.h
index 6eebcdd41..8e255a0fd 100644
--- a/openbsc/include/openbsc/osmo_msc_data.h
+++ b/openbsc/include/openbsc/osmo_msc_data.h
@@ -26,6 +26,7 @@
#include "bsc_msc.h"
#include <osmocom/core/timer.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <regex.h>
@@ -68,6 +69,7 @@ struct osmo_msc_data {
int rtp_base;
/* audio codecs */
+ struct gsm48_multi_rate_conf amr_conf;
struct gsm_audio_support **audio_support;
int audio_length;
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index ad89fb2a6..2fab20b11 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -155,6 +155,12 @@ static void assignment_t10_timeout(void *_conn)
static void handle_mr_config(struct gsm_subscriber_connection *conn,
struct gsm_lchan *lchan)
{
+ struct bsc_api *api;
+ api = conn->bts->network->bsc_api;
+
+ if (api->mr_config)
+ return api->mr_config(conn, &lchan->mr_conf);
+
lchan->mr_conf.ver = 1;
lchan->mr_conf.icmi = 1;
lchan->mr_conf.m5_90 = 1;
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c
index 87d3f6e61..df8c0444f 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_api.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c
@@ -316,6 +316,34 @@ static void bsc_cm_update(struct gsm_subscriber_connection *conn,
queue_msg_or_return(resp);
}
+static void bsc_mr_config(struct gsm_subscriber_connection *conn,
+ struct gsm48_multi_rate_conf *conf)
+{
+ struct osmo_msc_data *msc;
+
+ if (!conn->sccp_con) {
+ LOGP(DMSC, LOGL_ERROR,
+ "No msc data available on conn %p. Audio will be broken.\n",
+ conn);
+ return;
+ }
+
+ msc = conn->sccp_con->msc;
+
+ conf->ver = 1;
+ conf->icmi = 1;
+
+ /* maybe gcc see's it is copy of _one_ byte */
+ conf->m4_75 = msc->amr_conf.m4_75;
+ conf->m5_15 = msc->amr_conf.m5_15;
+ conf->m5_90 = msc->amr_conf.m5_90;
+ conf->m6_70 = msc->amr_conf.m6_70;
+ conf->m7_40 = msc->amr_conf.m7_40;
+ conf->m7_95 = msc->amr_conf.m7_95;
+ conf->m10_2 = msc->amr_conf.m10_2;
+ conf->m12_2 = msc->amr_conf.m12_2;
+}
+
static struct bsc_api bsc_handler = {
.sapi_n_reject = bsc_sapi_n_reject,
.cipher_mode_compl = bsc_cipher_mode_compl,
@@ -325,6 +353,7 @@ static struct bsc_api bsc_handler = {
.assign_fail = bsc_assign_fail,
.clear_request = bsc_clear_request,
.classmark_chg = bsc_cm_update,
+ .mr_config = bsc_mr_config,
};
struct bsc_api *osmo_bsc_api()
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
index 55532dbd4..a97968175 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
@@ -494,5 +494,8 @@ struct osmo_msc_data *osmo_msc_data_alloc(struct gsm_network *net, int nr)
msc_data->nr = nr;
msc_data->allow_emerg = 1;
+ /* Defaults for the audio setup */
+ msc_data->amr_conf.m5_90 = 1;
+
return msc_data;
}