diff options
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-08-20 19:10:58 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-14 10:12:29 +0200
commit53122b09d0e0890aa656e0d23a879bd61999d4fb (patch)
parentc21dcb20e5a7e5f9317ac797d03639c191de4eae (diff)
mncc: Use the default codec from the built-in mncc modezecke/features/rtp-bridge
In case of the RTP bridge mode we need to select the codec ourselves. Rely on the same (incomplete) codec selection that can be done using the mncc-int configuration node. This might gain bearer capabilities support. In case of a SDCCH a TCH/F will be attempted to be assigned. This is an open issue for both modes and there should be a preference for full or half-rate channels somewhere.
3 files changed, 14 insertions, 6 deletions
diff --git a/openbsc/include/openbsc/mncc_int.h b/openbsc/include/openbsc/mncc_int.h
index 4f30f08c0..213ce1414 100644
--- a/openbsc/include/openbsc/mncc_int.h
+++ b/openbsc/include/openbsc/mncc_int.h
@@ -9,4 +9,6 @@ struct mncc_int {
extern struct mncc_int mncc_int;
+uint8_t mncc_codec_for_mode(int lchan_type);
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 4cfba1c1f..7db758666 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -52,6 +52,7 @@
#include <openbsc/bsc_api.h>
#include <openbsc/osmo_msc.h>
#include <openbsc/handover.h>
+#include <openbsc/mncc_int.h>
#include <osmocom/abis/e1_input.h>
#include <osmocom/core/bitvec.h>
@@ -3033,13 +3034,13 @@ static int tch_rtp_create(struct gsm_network *net, uint32_t callref)
* *sigh* we need to pick a codec now. Pick the most generic one
* right now and hope we could fix that later on. This is very
- * similiar to the above routine.
- * TODO: Use the default codec version...
+ * similiar to the routine above.
+ * Fallback to the internal MNCC mode to select a route.
if (lchan->tch_mode == GSM48_CMODE_SIGN) {
trans->conn->mncc_rtp_create_pending = 1;
- /* TODO... transport or fix the default type... */
- return gsm0808_assign_req(trans->conn, GSM48_CMODE_SPEECH_V1,
+ return gsm0808_assign_req(trans->conn,
+ mncc_codec_for_mode(lchan->type),
lchan->type != GSM_LCHAN_TCH_H);
diff --git a/openbsc/src/libmsc/mncc_builtin.c b/openbsc/src/libmsc/mncc_builtin.c
index 5c3461bea..7d5a7f163 100644
--- a/openbsc/src/libmsc/mncc_builtin.c
+++ b/openbsc/src/libmsc/mncc_builtin.c
@@ -65,16 +65,21 @@ static struct gsm_call *get_call_ref(uint32_t callref)
return NULL;
-static uint8_t determine_lchan_mode(struct gsm_mncc *setup)
+uint8_t mncc_codec_for_mode(int lchan_type)
/* FIXME: check codec capabilities of the phone */
- if (setup->lchan_type != GSM_LCHAN_TCH_H)
+ if (lchan_type != GSM_LCHAN_TCH_H)
return mncc_int.def_codec[0];
return mncc_int.def_codec[1];
+static uint8_t determine_lchan_mode(struct gsm_mncc *setup)
+ return mncc_codec_for_mode(setup->lchan_type);
/* on incoming call, look up database and send setup to remote subscr. */
static int mncc_setup_ind(struct gsm_call *call, int msg_type,
struct gsm_mncc *setup)