Avoid setting audio codec if not available during assignment_complete (MDCX)

RAB Assignment Complete contains no codec info, hence
assignment_complete.codec is not set and
assignment_complete.codec_present is false.
As a result a wrong value is passed to rtp_stream_set_codec.

This fixes osmo-msc sending "a=rtpmap:112 AMR/8000/1" during MDCX in the
RAT-side connection of the call leg after having properly sent
VND.3GPP.IUFP/16000 in CRCX.

Change-Id: Ic028d35893d29f7d72f22f82ef89695229c9b01b
This commit is contained in:
Pau Espin 2022-01-07 16:27:04 +01:00
parent 3a02d29804
commit 9de384a28c
2 changed files with 6 additions and 2 deletions

View File

@ -1311,6 +1311,8 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct
{ {
struct gsm_trans *cc_trans = msc_a->cc.active_trans; struct gsm_trans *cc_trans = msc_a->cc.active_trans;
struct rtp_stream *rtps_to_ran = msc_a->cc.call_leg ? msc_a->cc.call_leg->rtp[RTP_TO_RAN] : NULL; struct rtp_stream *rtps_to_ran = msc_a->cc.call_leg ? msc_a->cc.call_leg->rtp[RTP_TO_RAN] : NULL;
const enum mgcp_codecs *codec_if_known = ac->assignment_complete.codec_present ?
&ac->assignment_complete.codec : NULL;
if (!rtps_to_ran) { if (!rtps_to_ran) {
LOG_MSC_A(msc_a, LOGL_ERROR, "Rx Assignment Complete, but no RTP stream is set up\n"); LOG_MSC_A(msc_a, LOGL_ERROR, "Rx Assignment Complete, but no RTP stream is set up\n");
@ -1329,7 +1331,8 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct
} }
/* Update RAN-side endpoint CI: */ /* Update RAN-side endpoint CI: */
rtp_stream_set_codec(rtps_to_ran, ac->assignment_complete.codec); if (codec_if_known)
rtp_stream_set_codec(rtps_to_ran, *codec_if_known);
rtp_stream_set_remote_addr(rtps_to_ran, &ac->assignment_complete.remote_rtp); rtp_stream_set_remote_addr(rtps_to_ran, &ac->assignment_complete.remote_rtp);
if (rtps_to_ran->use_osmux) if (rtps_to_ran->use_osmux)
rtp_stream_set_remote_osmux_cid(rtps_to_ran, rtp_stream_set_remote_osmux_cid(rtps_to_ran,
@ -1344,7 +1347,7 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct
* - the Assignment has chosen a speech codec * - the Assignment has chosen a speech codec
* go on to create the CN side RTP stream's CI. */ * go on to create the CN side RTP stream's CI. */
if (call_leg_ensure_ci(msc_a->cc.call_leg, RTP_TO_CN, cc_trans->callref, cc_trans, if (call_leg_ensure_ci(msc_a->cc.call_leg, RTP_TO_CN, cc_trans->callref, cc_trans,
&ac->assignment_complete.codec, NULL)) { codec_if_known, NULL)) {
LOG_MSC_A_CAT(msc_a, DCC, LOGL_ERROR, "Error creating MGW CI towards CN\n"); LOG_MSC_A_CAT(msc_a, DCC, LOGL_ERROR, "Error creating MGW CI towards CN\n");
call_leg_release(msc_a->cc.call_leg); call_leg_release(msc_a->cc.call_leg);
return; return;

View File

@ -1007,6 +1007,7 @@ void ms_sends_assignment_complete(enum mgcp_codecs assigned_codec)
ran_dec = (struct ran_msg){ ran_dec = (struct ran_msg){
.msg_type = RAN_MSG_ASSIGNMENT_COMPLETE, .msg_type = RAN_MSG_ASSIGNMENT_COMPLETE,
.assignment_complete = { .assignment_complete = {
.codec_present = true,
.codec = assigned_codec, .codec = assigned_codec,
}, },
}; };