aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-08-08 19:11:51 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-10-13 16:12:26 +0200
commit39bbbb92d79d6a104434490972e617e11dc1c16f (patch)
tree3d6f44ae6741cf10924b51133e17c8155df37b87
parentabf41fa68a1689a189396f2888ba63e071360f8f (diff)
HO Req: include IE Codec List (MSC Preferred)
-rw-r--r--include/osmocom/msc/codec_sdp_cc_t9n.h1
-rw-r--r--src/libmsc/codec_sdp_cc_t9n.c19
-rw-r--r--src/libmsc/msc_ho.c9
3 files changed, 29 insertions, 0 deletions
diff --git a/include/osmocom/msc/codec_sdp_cc_t9n.h b/include/osmocom/msc/codec_sdp_cc_t9n.h
index 0c62b5361..150fd265b 100644
--- a/include/osmocom/msc/codec_sdp_cc_t9n.h
+++ b/include/osmocom/msc/codec_sdp_cc_t9n.h
@@ -60,6 +60,7 @@ struct sdp_audio_codec *sdp_audio_codecs_add_speech_ver(struct sdp_audio_codecs
struct sdp_audio_codec *sdp_audio_codecs_add_mgcp_codec(struct sdp_audio_codecs *ac, enum mgcp_codecs mgcp_codec);
void sdp_audio_codecs_from_bearer_cap(struct sdp_audio_codecs *ac, const struct gsm_mncc_bearer_cap *bc);
+void sdp_audio_codecs_to_speech_codec_list(struct gsm0808_speech_codec_list *cl, const struct sdp_audio_codecs *ac);
void sdp_audio_codecs_from_speech_codec_list(struct sdp_audio_codecs *ac, const struct gsm0808_speech_codec_list *cl);
int sdp_audio_codecs_to_gsm0808_channel_type(struct gsm0808_channel_type *ct, const struct sdp_audio_codecs *ac);
diff --git a/src/libmsc/codec_sdp_cc_t9n.c b/src/libmsc/codec_sdp_cc_t9n.c
index 4632fc106..251fe66ce 100644
--- a/src/libmsc/codec_sdp_cc_t9n.c
+++ b/src/libmsc/codec_sdp_cc_t9n.c
@@ -380,6 +380,25 @@ void sdp_audio_codecs_from_bearer_cap(struct sdp_audio_codecs *ac, const struct
}
}
+void sdp_audio_codecs_to_speech_codec_list(struct gsm0808_speech_codec_list *scl, const struct sdp_audio_codecs *ac)
+{
+ const struct sdp_audio_codec *codec;
+
+ *scl = (struct gsm0808_speech_codec_list){};
+
+ foreach_sdp_audio_codec(codec, ac) {
+ const struct codec_mapping *m = codec_mapping_by_subtype_name(codec->subtype_name);
+ if (!m)
+ continue;
+ if (!m->has_gsm0808_speech_codec)
+ continue;
+ if (scl->len >= ARRAY_SIZE(scl->codec))
+ break;
+ scl->codec[scl->len] = m->gsm0808_speech_codec;
+ scl->len++;
+ }
+}
+
void sdp_audio_codecs_from_speech_codec_list(struct sdp_audio_codecs *ac, const struct gsm0808_speech_codec_list *cl)
{
int i;
diff --git a/src/libmsc/msc_ho.c b/src/libmsc/msc_ho.c
index c33ed7e0d..9e5954c7b 100644
--- a/src/libmsc/msc_ho.c
+++ b/src/libmsc/msc_ho.c
@@ -380,6 +380,7 @@ static void msc_ho_send_handover_request(struct msc_a *msc_a)
struct vlr_subscr *vsub = msc_a_vsub(msc_a);
struct gsm_network *net = msc_a_net(msc_a);
struct gsm0808_channel_type channel_type;
+ struct gsm0808_speech_codec_list scl;
struct gsm_trans *cc_trans = msc_a->cc.active_trans;
struct ran_msg ran_enc_msg = {
.msg_type = RAN_MSG_HANDOVER_REQUEST,
@@ -421,6 +422,14 @@ static void msc_ho_send_handover_request(struct msc_a *msc_a)
return;
}
ran_enc_msg.handover_request.geran.channel_type = &channel_type;
+
+ sdp_audio_codecs_to_speech_codec_list(&scl, &cc_trans->cc.codecs.result.audio_codecs);
+ if (!scl.len) {
+ msc_ho_failed(msc_a, GSM0808_CAUSE_EQUIPMENT_FAILURE, "Failed to compose"
+ " Codec List (MSC Preferred) for Handover Request message\n");
+ return;
+ }
+ ran_enc_msg.handover_request.codec_list_msc_preferred = &scl;
}
gsm0808_cell_id_from_cgi(&ran_enc_msg.handover_request.cell_id_serving, CELL_IDENT_WHOLE_GLOBAL, &vsub->cgi);