aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-08-21 15:00:39 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2020-09-10 14:19:17 +0200
commitf85337f7dff2645e86cd101779c625c3de426008 (patch)
treeb296fd7214b27896ba52055fae4d705fa0466226
parent03643e3c3f99fa3195c5600b20b40bd1b9de29c4 (diff)
WIP cc codecs to gsm0808_speech_codec_listneels/mncc_codecs
-rw-r--r--include/osmocom/msc/ran_msg.h1
-rw-r--r--src/libmsc/codec_sdp_cc_t9n.c45
2 files changed, 46 insertions, 0 deletions
diff --git a/include/osmocom/msc/ran_msg.h b/include/osmocom/msc/ran_msg.h
index 3b08b466c..ae5aef38d 100644
--- a/include/osmocom/msc/ran_msg.h
+++ b/include/osmocom/msc/ran_msg.h
@@ -83,6 +83,7 @@ struct ran_clear_command {
struct ran_assignment_command {
const struct osmo_sockaddr_str *cn_rtp;
const struct gsm0808_channel_type *channel_type;
+ const struct gsm0808_speech_codec_list *speech_codec_list_msc_preferred;
enum nsap_addr_enc rab_assign_addr_enc;
bool osmux_present;
uint8_t osmux_cid;
diff --git a/src/libmsc/codec_sdp_cc_t9n.c b/src/libmsc/codec_sdp_cc_t9n.c
index 75b91abfb..cbb746433 100644
--- a/src/libmsc/codec_sdp_cc_t9n.c
+++ b/src/libmsc/codec_sdp_cc_t9n.c
@@ -336,6 +336,51 @@ void sdp_audio_codecs_from_speech_codec_list(struct sdp_audio_codecs *ac, const
}
}
+static enum gsm0808_speech_codec_defaults codec_cfg(enum gsm0808_speech_codec_type type)
+{
+ switch (type) {
+ case GSM0808_SCT_FR3:
+ return GSM0808_SC_CFG_DEFAULT_FR_AMR;
+ case GSM0808_SCT_FR4:
+ return GSM0808_SC_CFG_DEFAULT_OFR_AMR_WB;
+ case GSM0808_SCT_FR5:
+ return GSM0808_SC_CFG_DEFAULT_FR_AMR_WB;
+ case GSM0808_SCT_HR3:
+ return GSM0808_SC_CFG_DEFAULT_HR_AMR;
+ case GSM0808_SCT_HR4:
+ return GSM0808_SC_CFG_DEFAULT_OHR_AMR_WB;
+ case GSM0808_SCT_HR6:
+ return GSM0808_SC_CFG_DEFAULT_OHR_AMR;
+ default:
+ return 0;
+ }
+}
+
+void sdp_audio_codecs_to_speech_codec_list(struct gsm0808_speech_codec_list *cl, const struct sdp_audio_codecs *ac)
+{
+ const struct sdp_audio_codec *codec;
+
+ *cl = (struct gsm0808_speech_codec_list){};
+
+ foreach_sdp_audio_codec(codec, ac) {
+ const struct codec_mapping *m;
+ foreach_codec_mapping(m) {
+ if (strcmp(m->sdp.subtype_name, codec->subtype_name))
+ continue;
+ if (!m->has_gsm0808_speech_codec_type)
+ continue;
+ if (cl->len >= ARRAY_SIZE(cl->codec))
+ break;
+ cl->codec[cl->len] = (struct gsm0808_speech_codec){
+ .fi = true,
+ .type = m->gsm0808_speech_codec_type,
+ .cfg = codec_cfg(m->gsm0808_speech_codec_type),
+ };
+ cl->len++;
+ }
+ }
+}
+
int sdp_audio_codecs_to_gsm0808_channel_type(struct gsm0808_channel_type *ct, const struct sdp_audio_codecs *ac)
{
const struct sdp_audio_codec *codec;