From af9d30eff5150241e4edecee53283a313da7179f Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 13 Jan 2022 21:40:58 +0100 Subject: [PATCH] [codecs filter] MT call: apply remote call leg codecs Collect either the SDP or the Bearer Capabilites in the incoming MNCC in the new codecs filter. So far just collect the info and do not change the behavior, using the filter result will follow in a subsequent patch. Related: SYS#5066 Change-Id: I84d9bbca3e4061da622b1b2fc0bde8868e7e3521 --- src/libmsc/gsm_04_08_cc.c | 19 +++++++++++++++++++ tests/msc_vlr/msc_vlr_test_call.err | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c index 93dcdf8eb..12f2c8925 100644 --- a/src/libmsc/gsm_04_08_cc.c +++ b/src/libmsc/gsm_04_08_cc.c @@ -739,9 +739,28 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg) codec_filter_init(&trans->cc.codecs); codec_filter_set_ran(&trans->cc.codecs, trans->msc_a->c.ran->type); codec_filter_set_bss(&trans->cc.codecs, &trans->msc_a->cc.compl_l3_codec_list_bss_supported); + /* sdp.remote: if SDP is included in the MNCC, take that as definitive list of remote audio codecs. */ + if (setup->sdp[0]) { + rc = sdp_msg_from_sdp_str(&trans->cc.codecs.remote, setup->sdp); + if (rc) + LOG_TRANS(trans, LOGL_ERROR, "Failed to parse remote call leg SDP: %d\n", rc); + } + /* sdp.remote: if there is no SDP information or we failed to parse it, try using the Bearer Capability from + * MNCC, if any. */ + if (!trans->cc.codecs.remote.audio_codecs.count && (setup->fields & MNCC_F_BEARER_CAP)) { + trans->cc.codecs.remote = (struct sdp_msg){}; + sdp_audio_codecs_from_bearer_cap(&trans->cc.codecs.remote.audio_codecs, + &setup->bearer_cap); + } + if (!trans->cc.codecs.remote.audio_codecs.count) + LOG_TRANS(trans, LOGL_INFO, + "Got no information of remote audio codecs: neither SDP nor Bearer Capability. Trying anyway.\n"); + codec_filter_run(&trans->cc.codecs); LOG_TRANS(trans, LOGL_DEBUG, "codecs: %s\n", codec_filter_to_str(&trans->cc.codecs)); + /* NEAR FUTURE: upcoming patch will use the codecs filter to determine the Bearer Cap to send to the MS. + * So far just gathering information in the new codecs filter. */ /* bearer capability */ if (setup->fields & MNCC_F_BEARER_CAP) { /* Create a copy of the bearer capability in the transaction struct, so we diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err index d03ea7b24..3c31ab770 100644 --- a/tests/msc_vlr/msc_vlr_test_call.err +++ b/tests/msc_vlr/msc_vlr_test_call.err @@ -757,6 +757,7 @@ DREF msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RES DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_AUTHENTICATED}: Received Event MSC_A_EV_TRANSACTION_ACCEPTED DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_AUTHENTICATED}: state_chg to MSC_A_ST_COMMUNICATING DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) starting timer T303 with 30 seconds +DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) Got no information of remote audio codecs: neither SDP nor Bearer Capability. Trying anyway. DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) codecs: :0{AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113} (from: RAN={AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113}) DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP @@ -1226,6 +1227,7 @@ DREF msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RES DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_AUTHENTICATED}: Received Event MSC_A_EV_TRANSACTION_ACCEPTED DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_AUTHENTICATED}: state_chg to MSC_A_ST_COMMUNICATING DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) starting timer T303 with 30 seconds +DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) Got no information of remote audio codecs: neither SDP nor Bearer Capability. Trying anyway. DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) codecs: :0{AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113} (from: RAN={AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113}) DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP