neels has submitted this change. (
https://gerrit.osmocom.org/c/osmo-msc/+/30126 )
Change subject: [codecs filter] use filter result in Assignment
......................................................................
[codecs filter] use filter result in Assignment
So far, patches have set up rtp_stream to allow setting multiple codecs,
and collected the codecs information into the codecs filter struct.
Now actually use the codecs filter result to choose a codec.
Setting up the call leg FSMs and codecs still looks rather confusing in
this patch, because this is an incremental step in a larger series. The
upcoming patch 'do CN CRCX first' clarifies this substantially.
The resulting codecs behavior is tested in upcoming patch
I879ec61f523ad4ffc69a0b02810591f7c0261ff9. (The test ideally should have
come before this patch, but my time to rework this branch is up.)
With the codecs filter in place, we are ready for sending and receiving
full SDP via MNCC, see upcoming Ie0668c0e079ec69da1532b52d00621efe114fc2c
and Ie433db1ba0c46d4b97538a969233c155cefac21c
Related: SYS#5066
Change-Id: I66e7c8c5e401f4f3a7d3d42b9525b2c6e99691d9
---
M src/libmsc/gsm_04_08_cc.c
M tests/msc_vlr/msc_vlr_test_call.err
2 files changed, 46 insertions(+), 23 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index f0aca9c..214d81f 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -1840,46 +1840,38 @@
struct call_leg *cl = msc_a->cc.call_leg;
struct osmo_sockaddr_str *rtp_cn_local;
struct rtp_stream *rtp_cn = cl ? cl->rtp[RTP_TO_CN] : NULL;
- uint32_t payload_type;
- int payload_msg_type;
- const struct mgcp_conn_peer *mgcp_info;
+ int mncc_payload_msg_type;
+ struct sdp_audio_codec *codec;
const struct codec_mapping *m;
+ struct sdp_audio_codecs *codecs;
if (!rtp_cn) {
LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "Cannot RTP CREATE to MNCC, no RTP set up
for the CN side\n");
return -EINVAL;
}
- if (!rtp_cn->codecs_known) {
+ codec_filter_run(&trans->cc.codecs);
+ LOG_TRANS(trans, LOGL_DEBUG, "codecs: %s\n",
codec_filter_to_str(&trans->cc.codecs));
+ codecs = &trans->cc.codecs.result.audio_codecs;
+ if (!codecs->count) {
LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR,
- "Cannot RTP CREATE to MNCC, no codec set up for the RTP CN side\n");
+ "Cannot RTP CREATE to MNCC, there is no codec available\n");
return -EINVAL;
}
- /* Codec */
- m = codec_mapping_by_subtype_name(rtp_cn->codecs.codec[0].subtype_name);
- if (!m) {
- LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR,
- "Cannot RTP CREATE to MNCC, cannot resolve codec '%s'\n",
- sdp_audio_codec_to_str(&rtp_cn->codecs.codec[0]));
- return -EINVAL;
- }
- payload_msg_type = m->mncc_payload_msg_type;
-
- /* Payload Type number */
- mgcp_info = osmo_mgcpc_ep_ci_get_rtp_info(rtp_cn->ci);
- if (mgcp_info && mgcp_info->ptmap_len)
- payload_type = map_codec_to_pt(mgcp_info->ptmap, mgcp_info->ptmap_len,
m->mgcp);
- else
- payload_type = m->mgcp;
+ /* Populate the legacy MNCC codec elements: payload_type and payload_msg_type */
+ codec = &codecs->codec[0];
+ m = codec_mapping_by_subtype_name(codec->subtype_name);
+ mncc_payload_msg_type = m ? m->mncc_payload_msg_type : 0;
rtp_cn_local = call_leg_local_ip(cl, RTP_TO_CN);
if (!rtp_cn_local) {
- LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "Cannot RTP CREATE to MNCC, no local RTP
IP:port set up\n");
+ LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "Cannot RTP CREATE to MNCC, no local RTP
IP:port to CN set up\n");
return -EINVAL;
}
- return mncc_recv_rtp(net, trans, trans->callref, MNCC_RTP_CREATE, rtp_cn_local,
payload_type, payload_msg_type);
+ return mncc_recv_rtp(net, trans, trans->callref, MNCC_RTP_CREATE, rtp_cn_local,
+ codec->payload_type, mncc_payload_msg_type);
}
static int tch_rtp_connect(struct gsm_network *net, const struct gsm_mncc_rtp *rtp)
diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err
index e1d2f4d..e87c25e 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -325,6 +325,7 @@
DCC
call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}:
Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
DMSC
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
Received Event MSC_EV_CALL_LEG_RTP_LOCAL_ADDR_AVAILABLE
DIUCS
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
MGW endpoint's RTP address available for the CI RTP_TO_CN: 10.23.23.1:23
(osmux=no:-2)
+DCC trans(CC:INITIATED
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ
callref-0x80000001 tid-8) codecs: :0{VND.3GPP.IUFP/16000#96} (from:
assigned=VND.3GPP.IUFP/16000#96 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111}
RAN={AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113})
DMNCC trans(CC:INITIATED
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ
callref-0x80000001 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23)
MSC --> MNCC: callref 0x80000001: MNCC_RTP_CREATE
- MNCC says that's fine
@@ -810,6 +811,7 @@
DCC
call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}:
Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
DMSC
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}:
Received Event MSC_EV_CALL_LEG_RTP_LOCAL_ADDR_AVAILABLE
DIUCS
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}:
MGW endpoint's RTP address available for the CI RTP_TO_CN: 10.23.23.1:23
(osmux=no:-2)
+DCC trans(CC:MO_TERM_CALL_CONF
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423
tid-0) codecs: :0{VND.3GPP.IUFP/16000#96} (from: assigned=VND.3GPP.IUFP/16000#96
MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111}
RAN={AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113})
DMNCC trans(CC:MO_TERM_CALL_CONF
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423
tid-0) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23)
MSC --> MNCC: callref 0x423: MNCC_RTP_CREATE
- Total time passed: 1.000023 s
@@ -1279,6 +1281,7 @@
DCC
call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}:
Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
DMSC
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}:
Received Event MSC_EV_CALL_LEG_RTP_LOCAL_ADDR_AVAILABLE
DIUCS
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}:
MGW endpoint's RTP address available for the CI RTP_TO_CN: 10.23.23.1:23
(osmux=no:-2)
+DCC trans(CC:MO_TERM_CALL_CONF
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423
tid-0) codecs: :0{VND.3GPP.IUFP/16000#96} (from: assigned=VND.3GPP.IUFP/16000#96
MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111}
RAN={AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113})
DMNCC trans(CC:MO_TERM_CALL_CONF
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423
tid-0) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23)
MSC --> MNCC: callref 0x423: MNCC_RTP_CREATE
- Total time passed: 1.000023 s
@@ -1688,6 +1691,7 @@
DCC
call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}:
Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
DMSC
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
Received Event MSC_EV_CALL_LEG_RTP_LOCAL_ADDR_AVAILABLE
DIUCS
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
MGW endpoint's RTP address available for the CI RTP_TO_CN: 10.23.23.1:23
(osmux=no:-2)
+DCC trans(CC:INITIATED
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ
callref-0x80000002 tid-8) codecs: :0{VND.3GPP.IUFP/16000#96} (from:
assigned=VND.3GPP.IUFP/16000#96 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111}
RAN={AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113})
DMNCC trans(CC:INITIATED
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ
callref-0x80000002 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23)
MSC --> MNCC: callref 0x80000002: MNCC_RTP_CREATE
- MNCC says that's fine
@@ -2114,6 +2118,7 @@
DCC
call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}:
Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
DMSC
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
Received Event MSC_EV_CALL_LEG_RTP_LOCAL_ADDR_AVAILABLE
DIUCS
msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}:
MGW endpoint's RTP address available for the CI RTP_TO_CN: 10.23.23.1:23
(osmux=no:-2)
+DCC trans(CC:INITIATED
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ
callref-0x80000003 tid-8) codecs: :0{VND.3GPP.IUFP/16000#96} (from:
assigned=VND.3GPP.IUFP/16000#96 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111}
RAN={AMR:octet-align=1#112,AMR-WB/16000:octet-align=1#113})
DMNCC trans(CC:INITIATED
IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ
callref-0x80000003 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23)
MSC --> MNCC: callref 0x80000003: MNCC_RTP_CREATE
- MNCC says that's fine
--
To view, visit
https://gerrit.osmocom.org/c/osmo-msc/+/30126
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I66e7c8c5e401f4f3a7d3d42b9525b2c6e99691d9
Gerrit-Change-Number: 30126
Gerrit-PatchSet: 9
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged