neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35263?usp=email )
Change subject: fix possible NULL deref on early media
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35263?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I9bfb55a343b3f2b1459e0aba4ee71a6133b992b3
Gerrit-Change-Number: 35263
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 13 Dec 2023 01:55:26 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35306?usp=email )
Change subject: sdp: allow more space for fmtp
......................................................................
sdp: allow more space for fmtp
In osmo-mgw, we recently chose 256 for maximum fmtp length.
Adjust to that here, too.
Change-Id: Ib9b9608d8d8f7ce34596a950dbc480e8a72ebf97
---
M include/osmocom/msc/sdp_msg.h
1 file changed, 13 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
diff --git a/include/osmocom/msc/sdp_msg.h b/include/osmocom/msc/sdp_msg.h
index e62f22b..724440c 100644
--- a/include/osmocom/msc/sdp_msg.h
+++ b/include/osmocom/msc/sdp_msg.h
@@ -25,7 +25,7 @@
/* Like "GSM", "AMR", "EFR", ... */
char subtype_name[16];
unsigned int rate;
- char fmtp[64];
+ char fmtp[256];
};
struct sdp_audio_codecs {
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35306?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ib9b9608d8d8f7ce34596a950dbc480e8a72ebf97
Gerrit-Change-Number: 35306
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35051?usp=email )
Change subject: implement re-assignment to match codecs
......................................................................
implement re-assignment to match codecs
This is the last missing piece that allows osmo-msc to make good TFO
codecs choices.
Since the codec_filter, osmo-msc properly gathers codec options and
limitations. But the MO call leg still assigns a voice channel before
getting a response from the MT call leg, and is then stuck with that.
Add the capability to adjust the MO call leg's codec in case the MT side
needs a different codec for TFO.
This is only relevant for 2G; on 3G we always have AMR/IuUP.
For inter-MSC handover, keep the behavior unchanged: offer only the
currently assigned codec to the remote side. Codec-changing HO should be
equally trivial to implement, but that is for another day.
msc_vlr_test_call's codec tests are adjusted to test the new feature in
Ib933554f826c1b4347dfa3f6c4f6fe086be8b133. For now, avoid change in
these tests by validating the first codec in SDP lists only.
Related: OS#6258
Related: osmo-ttcn3-hacks I402ed0523a2a87b83f29c5577b2c828102005d53
Change-Id: I8760feaa8598047369ef8c3ab2673013bac8ac8a
---
M include/osmocom/msc/msc_a.h
M src/libmsc/codec_filter.c
M src/libmsc/gsm_04_08_cc.c
M src/libmsc/msc_a.c
M src/libmsc/msc_ho.c
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_call.err
7 files changed, 120 insertions(+), 60 deletions(-)
Approvals:
neels: Looks good to me, approved
daniel: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
diff --git a/include/osmocom/msc/msc_a.h b/include/osmocom/msc/msc_a.h
index 0276d62..4099d4c 100644
--- a/include/osmocom/msc/msc_a.h
+++ b/include/osmocom/msc/msc_a.h
@@ -216,6 +216,7 @@
int msc_a_ensure_cn_local_rtp(struct msc_a *msc_a, struct gsm_trans *cc_trans);
int msc_a_try_call_assignment(struct gsm_trans *cc_trans);
+void msc_a_tx_assignment_cmd(struct msc_a *msc_a);
const char *msc_a_cm_service_type_to_use(struct msc_a *msc_a, enum osmo_cm_service_type cm_service_type);
diff --git a/src/libmsc/codec_filter.c b/src/libmsc/codec_filter.c
index a9d93a7..7511f90 100644
--- a/src/libmsc/codec_filter.c
+++ b/src/libmsc/codec_filter.c
@@ -98,46 +98,16 @@
if (remote->audio_codecs.count)
sdp_audio_codecs_intersection(r, &remote->audio_codecs, true);
-#if 0
- /* Future: If osmo-msc were able to trigger a re-assignment after the remote side has picked a codec mismatching
- * the initial Assignment, then this code here would make sense: keep the other codecs as available to choose
- * from, but put the currently assigned codec in the first position. So far we only offer the single assigned
- * codec, because we have no way to deal with the remote side picking a different codec.
- * Another approach would be to postpone assignment until we know the codecs from the remote side. */
if (sdp_audio_codec_is_set(a)) {
/* Assignment has completed, the chosen codec should be the first of the resulting SDP.
- * Make sure this is actually listed in the result SDP and move to first place. */
+ * If present, make sure this is listed in first place.
+ * If 'select' is NULL, the assigned codec is not present in the intersection of possible choices for
+ * TFO. Just omit the assigned codec from the filter result, and it is the CC code's responsibility to
+ * detect this and assign a working codec instead. */
struct sdp_audio_codec *select = sdp_audio_codecs_by_descr(r, a);
-
- if (!select) {
- /* Not present. Add. */
- if (sdp_audio_codec_by_payload_type(r, a->payload_type, false)) {
- /* Oh crunch, that payload type number is already in use.
- * Find an unused one. */
- for (a->payload_type = 96; a->payload_type <= 127; a->payload_type++) {
- if (!sdp_audio_codec_by_payload_type(r, a->payload_type, false))
- break;
- }
-
- if (a->payload_type > 127)
- return -ENOSPC;
- }
- select = sdp_audio_codecs_add_copy(r, a);
- }
-
- sdp_audio_codecs_select(r, select);
+ if (select)
+ sdp_audio_codecs_select(r, select);
}
-#else
- /* Currently, osmo-msc does not trigger re-assignment if the remote side has picked a codec that is different
- * from the already assigned codec.
- * So, if locally, Assignment has already chosen a codec, this is the single definitive result to be used
- * towards the CN. */
- if (sdp_audio_codec_is_set(a)) {
- /* Assignment has completed, the chosen codec should be the the only possible one. */
- *r = (struct sdp_audio_codecs){};
- sdp_audio_codecs_add_copy(r, a);
- }
-#endif
return 0;
}
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index fe34127..f6ec81b 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -270,7 +270,16 @@
break;
}
- if (sdp && sdp[0] && (sdp_msg_from_sdp_str(&sdp_msg, sdp) == 0)) {
+ if (sdp && sdp[0]) {
+ int rc = sdp_msg_from_sdp_str(&sdp_msg, sdp);
+ if (rc != 0) {
+ LOG_TRANS_CAT_SRC(trans, DMNCC, LOGL_ERROR, file, line, "%s %s: invalid SDP message (trying anyway)\n",
+ rx_tx,
+ get_mncc_name(mncc->msg_type));
+ LOG_TRANS_CAT_SRC(trans, DMNCC, LOGL_DEBUG, file, line, "erratic SDP: %s\n",
+ osmo_quote_cstr_c(OTC_SELECT, sdp, -1));
+ return;
+ }
LOG_TRANS_CAT_SRC(trans, DMNCC, LOGL_DEBUG, file, line, "%s %s (RTP=%s)\n",
rx_tx,
get_mncc_name(mncc->msg_type),
@@ -748,6 +757,7 @@
static void rx_mncc_sdp(struct gsm_trans *trans, uint32_t mncc_msg_type, const char *sdp,
const struct gsm_mncc_bearer_cap *bcap)
{
+ struct codec_filter *codecs = &trans->cc.codecs;
struct call_leg *cl = trans->msc_a ? trans->msc_a->cc.call_leg : NULL;
struct rtp_stream *rtp_cn = cl ? cl->rtp[RTP_TO_CN] : NULL;
@@ -775,6 +785,30 @@
rtp_stream_set_remote_addr_and_codecs(rtp_cn, &trans->cc.remote);
rtp_stream_commit(rtp_cn);
}
+
+ /* See if we need to switch codecs to maintain TFO: has the remote side changed the codecs information? If we
+ * have already assigned a specific codec here, but the remote call leg has now chosen a different codec, we
+ * need to re-assign this call leg to match the remote leg. */
+ if (!sdp_audio_codec_is_set(&codecs->assignment)) {
+ /* Voice channel assignment has not completed. Do not interfere. */
+ return;
+ }
+ if (!trans->cc.remote.audio_codecs.count) {
+ /* Don't know remote codecs, nothing to do. */
+ return;
+ }
+ if (sdp_audio_codecs_by_descr(&trans->cc.remote.audio_codecs, &codecs->assignment)) {
+ /* The assigned codec is part of the remote codec set. All is well. */
+ /* TODO: maybe this should require exactly the *first* remote codec to match, because we cannot flexibly
+ * transcode, and assume the actual payload we will receive is listed in the first place? */
+ return;
+ }
+
+ /* We've already completed Assignment of a voice channel (some time ago), and now the remote side has changed
+ * to a mismatching codec (list). Try to re-assign this side to a matching codec. */
+ LOG_TRANS(trans, LOGL_INFO, "Remote call leg mismatches assigned codec: %s\n",
+ codec_filter_to_str(&trans->cc.codecs, &trans->cc.local, &trans->cc.remote));
+ msc_a_tx_assignment_cmd(trans->msc_a);
}
static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
@@ -2049,17 +2083,23 @@
switch (trans->cc.state) {
case GSM_CSTATE_INITIATED:
case GSM_CSTATE_MO_CALL_PROC:
- /* MO call */
+ /* MO call, send ACK in form of an MNCC_RTP_CREATE (below) */
break;
case GSM_CSTATE_CALL_RECEIVED:
case GSM_CSTATE_MO_TERM_CALL_CONF:
- /* MT call */
+ /* MT call, send ACK in form of an MNCC_RTP_CREATE (below) */
break;
case GSM_CSTATE_ACTIVE:
- /* already active. MNCC finished before Abis completed the Assignment. */
- break;
+ /* already active. We decided to re-assign later on during the call - at time of writing this never
+ * happens. */
+ case GSM_CSTATE_CALL_DELIVERED:
+ case GSM_CSTATE_CONNECT_IND:
+ /* MNCC has progressed past the initial assignment. Usually it means that this happened: after
+ * MNCC_ALERT_REQ, MO has triggered a re-assignment, to adjust MO's codec to MT's codec. */
+ LOG_TRANS(trans, LOGL_DEBUG, "Re-Assignment complete\n");
+ return 0;
default:
LOG_TRANS(trans, LOGL_ERROR, "Assignment done in unexpected CC state: %d\n", trans->cc.state);
diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index e64b54d..a933bd2 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -636,7 +636,7 @@
}
/* The MGW has given us a local IP address for the RAN side. Ready to start the Assignment of a voice channel. */
-static void msc_a_call_leg_ran_local_addr_available(struct msc_a *msc_a)
+void msc_a_tx_assignment_cmd(struct msc_a *msc_a)
{
struct ran_msg msg;
struct gsm_trans *cc_trans = msc_a->cc.active_trans;
@@ -804,7 +804,7 @@
rtps->use_osmux ? "yes" : "no", rtps->local_osmux_cid);
switch (rtps->dir) {
case RTP_TO_RAN:
- msc_a_call_leg_ran_local_addr_available(msc_a);
+ msc_a_tx_assignment_cmd(msc_a);
return;
case RTP_TO_CN:
cc_on_cn_local_rtp_port_known(rtps->for_trans);
diff --git a/src/libmsc/msc_ho.c b/src/libmsc/msc_ho.c
index f826975..47f000b 100644
--- a/src/libmsc/msc_ho.c
+++ b/src/libmsc/msc_ho.c
@@ -380,7 +380,7 @@
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 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,
@@ -442,7 +442,13 @@
ran_enc_msg.handover_request.call_id_present = true;
ran_enc_msg.handover_request.call_id = cc_trans->call_id;
- sdp_audio_codecs_to_speech_codec_list(&scl, &cc_trans->cc.local.audio_codecs);
+ /* Call assignment is now capable of re-assigning to overcome a codec mismatch with the remote call leg.
+ * But for inter-MSC handover, that is not supported yet. So keep here the old limitation of only
+ * offering the assigned codec. */
+ if (sdp_audio_codec_is_set(&cc_trans->cc.codecs.assignment))
+ sdp_audio_codec_to_speech_codec_list(&scl, &cc_trans->cc.codecs.assignment);
+ else
+ sdp_audio_codecs_to_speech_codec_list(&scl, &cc_trans->cc.local.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");
diff --git a/tests/msc_vlr/msc_vlr_test_call.c b/tests/msc_vlr/msc_vlr_test_call.c
index cb3c77b..3b91524 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -1083,6 +1083,9 @@
return false;
}
expect_pos++;
+
+ /* only match first codec */
+ return true;
}
if (*expect_pos) {
BTW("%s: %s: ERROR: mismatch: expected %s to be listed, but not found", func, desc, *expect_pos);
diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err
index 4af1bce..5758175 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -2636,19 +2636,22 @@
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-6:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-6:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-6:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) Assignment Complete: RAN: AMR:octet-align=1#112, CN: AMR:octet-align=1#112
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
-DMNCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23{AMR:octet-align=1#112})
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) Assignment Complete: RAN: AMR:octet-align=1#112, CN: AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
+DMNCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
MSC --> MNCC: callref 0x80000004: MNCC_RTP_CREATE
v=0
o=OsmoMSC 0 0 IN IP4 10.23.23.1
s=GSM Call
c=IN IP4 10.23.23.1
t=0 0
-m=audio 23 RTP/AVP 112
+m=audio 23 RTP/AVP 112 110 3 111
a=rtpmap:112 AMR/8000
a=fmtp:112 octet-align=1
+a=rtpmap:110 GSM-EFR/8000
+a=rtpmap:3 GSM/8000
+a=rtpmap:111 GSM-HR-08/8000
a=ptime:20
- VALIDATE_SDP OK: cc_to_mncc_tx_last_sdp == t->mo_tx_sdp_mncc_rtp_create == AMR
@@ -4457,19 +4460,22 @@
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-12:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-12:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-12:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) Assignment Complete: RAN: AMR:octet-align=1#112, CN: AMR:octet-align=1#112
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
-DMNCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23{AMR:octet-align=1#112})
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) Assignment Complete: RAN: AMR:octet-align=1#112, CN: AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
+DMNCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
MSC --> MNCC: callref 0x80000007: MNCC_RTP_CREATE
v=0
o=OsmoMSC 0 0 IN IP4 10.23.23.1
s=GSM Call
c=IN IP4 10.23.23.1
t=0 0
-m=audio 23 RTP/AVP 112
+m=audio 23 RTP/AVP 112 110 3 111
a=rtpmap:112 AMR/8000
a=fmtp:112 octet-align=1
+a=rtpmap:110 GSM-EFR/8000
+a=rtpmap:3 GSM/8000
+a=rtpmap:111 GSM-HR-08/8000
a=ptime:20
- VALIDATE_SDP OK: cc_to_mncc_tx_last_sdp == t->mo_tx_sdp_mncc_rtp_create == AMR
@@ -4859,19 +4865,22 @@
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-14:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-14:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-14:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) Assignment Complete: RAN: AMR:octet-align=1#112, CN: AMR:octet-align=1#112
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
-DMNCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23{AMR:octet-align=1#112})
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) Assignment Complete: RAN: AMR:octet-align=1#112, CN: AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) codecs: 10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} (from: assigned=AMR:octet-align=1#112 MS={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111} bss={GSM#3,GSM-EFR#110,AMR:octet-align=1#112,GSM-HR-08#111} RAN={AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
+DMNCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) tx MNCC_RTP_CREATE (RTP=10.23.23.1:23{AMR:octet-align=1#112,GSM-EFR#110,GSM#3,GSM-HR-08#111})
MSC --> MNCC: callref 0x80000008: MNCC_RTP_CREATE
v=0
o=OsmoMSC 0 0 IN IP4 10.23.23.1
s=GSM Call
c=IN IP4 10.23.23.1
t=0 0
-m=audio 23 RTP/AVP 112
+m=audio 23 RTP/AVP 112 110 3 111
a=rtpmap:112 AMR/8000
a=fmtp:112 octet-align=1
+a=rtpmap:110 GSM-EFR/8000
+a=rtpmap:3 GSM/8000
+a=rtpmap:111 GSM-HR-08/8000
a=ptime:20
- VALIDATE_SDP OK: cc_to_mncc_tx_last_sdp == t->mo_tx_sdp_mncc_rtp_create == AMR
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35051?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I8760feaa8598047369ef8c3ab2673013bac8ac8a
Gerrit-Change-Number: 35051
Gerrit-PatchSet: 8
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35050?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: add sdp_audio_codec_to_speech_codec_list()
......................................................................
add sdp_audio_codec_to_speech_codec_list()
Used by I8760feaa8598047369ef8c3ab2673013bac8ac8a to add just a single
codec to a speech codec list, instead of a list.
Change-Id: I6ac23c54bc26939e048ff2df06eb987421cfb1c5
---
M include/osmocom/msc/codec_mapping.h
M src/libmsc/codec_mapping.c
2 files changed, 33 insertions(+), 9 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
neels: Looks good to me, approved
diff --git a/include/osmocom/msc/codec_mapping.h b/include/osmocom/msc/codec_mapping.h
index 1232d2d..3b502a9 100644
--- a/include/osmocom/msc/codec_mapping.h
+++ b/include/osmocom/msc/codec_mapping.h
@@ -56,6 +56,7 @@
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);
+int sdp_audio_codec_to_speech_codec_list(struct gsm0808_speech_codec_list *scl, const struct sdp_audio_codec *codec);
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);
diff --git a/src/libmsc/codec_mapping.c b/src/libmsc/codec_mapping.c
index 114abaa..4063514 100644
--- a/src/libmsc/codec_mapping.c
+++ b/src/libmsc/codec_mapping.c
@@ -414,6 +414,24 @@
}
}
+/* Append an entry for the given sdp_audio_codec to the gsm0808_speech_codec_list.
+ * Return 0 if an entry was added, -ENOENT when there is no mapping to gsm0808_speech_codec for the given
+ * sdp_audio_codec, and -ENOSPC when scl is full and nothing could be added. */
+int sdp_audio_codec_to_speech_codec_list(struct gsm0808_speech_codec_list *scl, const struct sdp_audio_codec *codec)
+{
+ const struct codec_mapping *m = codec_mapping_by_subtype_name(codec->subtype_name);
+ if (!m)
+ return -ENOENT;
+ if (!m->has_gsm0808_speech_codec)
+ return -ENOENT;
+ if (scl->len >= ARRAY_SIZE(scl->codec))
+ return -ENOSPC;
+ scl->codec[scl->len] = m->gsm0808_speech_codec;
+ /* FIXME: apply AMR configuration according to codec->fmtp */
+ scl->len++;
+ return 0;
+}
+
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;
@@ -421,16 +439,9 @@
*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))
+ int rc = sdp_audio_codec_to_speech_codec_list(scl, codec);
+ if (rc == -ENOSPC)
break;
- scl->codec[scl->len] = m->gsm0808_speech_codec;
- /* FIXME: apply AMR configuration according to codec->fmtp */
- scl->len++;
}
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35050?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I6ac23c54bc26939e048ff2df06eb987421cfb1c5
Gerrit-Change-Number: 35050
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35139?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: add comment in codec_mapping.c
......................................................................
add comment in codec_mapping.c
Related: OS#6258
Change-Id: I0905a1264cd8f940c7a9964addf241091425fe72
---
M src/libmsc/codec_mapping.c
1 file changed, 11 insertions(+), 0 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/codec_mapping.c b/src/libmsc/codec_mapping.c
index 4063514..8eea242 100644
--- a/src/libmsc/codec_mapping.c
+++ b/src/libmsc/codec_mapping.c
@@ -111,6 +111,7 @@
},
{
.sdp = {
+ /* 112 is just what we use by default. The other call leg may impose a different number. */
.payload_type = 112,
.subtype_name = "AMR",
.rate = 8000,
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35139?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I0905a1264cd8f940c7a9964addf241091425fe72
Gerrit-Change-Number: 35139
Gerrit-PatchSet: 4
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