lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

March 2023

  • 1 participants
  • 3642 discussions
[L] Change in osmo-msc[master]: rtp_stream: allow multiple codecs / use codec filter from Assignment
by neels 24 Mar '23

24 Mar '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/30125 ) ( 7 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: rtp_stream: allow multiple codecs / use codec filter from Assignment ...................................................................... rtp_stream: allow multiple codecs / use codec filter from Assignment Allow configuring MGW conns with multiple codecs. The new codecs filter can have multiple results, and MGCP can configure multiple codecs. Get rid of this bottleneck, that so far limits to a single codec to MGW. On Assignment Complete, set codec_filter.assignment to the assigned codec, and use that to set the resulting codec (possibly multiple codecs in the future) to create the CN side MGW endpoint. Related: SYS#5066 Change-Id: If9c67b298b30f893ec661f84c9fc622ad01b5ee5 --- M include/osmocom/msc/call_leg.h M include/osmocom/msc/msc_ho.h M include/osmocom/msc/rtp_stream.h M src/libmsc/call_leg.c M src/libmsc/gsm_04_08_cc.c M src/libmsc/mncc_call.c M src/libmsc/msc_a.c M src/libmsc/msc_ho.c M src/libmsc/msc_t.c M src/libmsc/rtp_stream.c M tests/msc_vlr/msc_vlr_test_call.err M tests/msc_vlr/msc_vlr_tests.c 12 files changed, 205 insertions(+), 106 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve neels: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/msc/call_leg.h b/include/osmocom/msc/call_leg.h index a225b66..c7d3b97 100644 --- a/include/osmocom/msc/call_leg.h +++ b/include/osmocom/msc/call_leg.h @@ -12,6 +12,7 @@ struct gsm_trans; struct rtp_stream; enum rtp_direction; +struct sdp_audio_codecs; extern struct osmo_tdef g_mgw_tdefs[]; @@ -74,7 +75,8 @@ int call_leg_ensure_rtp_alloc(struct call_leg *cl, enum rtp_direction dir, uint32_t call_id, struct gsm_trans *for_trans); int call_leg_ensure_ci(struct call_leg *cl, enum rtp_direction dir, uint32_t call_id, struct gsm_trans *for_trans, - const enum mgcp_codecs *codec_if_known, const struct osmo_sockaddr_str *remote_addr_if_known); + const struct sdp_audio_codecs *codecs_if_known, + const struct osmo_sockaddr_str *remote_addr_if_known); struct osmo_sockaddr_str *call_leg_local_ip(struct call_leg *cl, enum rtp_direction dir); void call_leg_rtp_stream_gone(struct call_leg *cl, struct rtp_stream *rtps); diff --git a/include/osmocom/msc/msc_ho.h b/include/osmocom/msc/msc_ho.h index 99956f1..a3f60c7 100644 --- a/include/osmocom/msc/msc_ho.h +++ b/include/osmocom/msc/msc_ho.h @@ -31,7 +31,7 @@ #include <osmocom/msc/neighbor_ident.h> #include <osmocom/msc/ran_msg.h> #include <osmocom/msc/mncc_call.h> - +#include <osmocom/msc/sdp_msg.h> struct gsm0808_handover_required; @@ -92,7 +92,7 @@ struct { /* Saved RTP IP:port and codec in case we need to roll back */ struct osmo_sockaddr_str ran_remote_rtp; - enum mgcp_codecs codec; + struct sdp_audio_codecs codecs; } old_cell; }; diff --git a/include/osmocom/msc/rtp_stream.h b/include/osmocom/msc/rtp_stream.h index c53c4f1..afc5725 100644 --- a/include/osmocom/msc/rtp_stream.h +++ b/include/osmocom/msc/rtp_stream.h @@ -5,6 +5,7 @@ #include <osmocom/core/sockaddr_str.h> #include <osmocom/mgcp_client/mgcp_client.h> +#include <osmocom/msc/sdp_msg.h> struct gsm_trans; @@ -37,9 +38,9 @@ struct osmo_sockaddr_str remote; bool remote_sent_to_mgw; - bool codec_known; - enum mgcp_codecs codec; - bool codec_sent_to_mgw; + bool codecs_known; + struct sdp_audio_codecs codecs; + bool codecs_sent_to_mgw; struct osmo_mgcpc_ep_ci *ci; @@ -64,7 +65,9 @@ int rtp_stream_ensure_ci(struct rtp_stream *rtps, struct osmo_mgcpc_ep *at_endpoint); int rtp_stream_do_mdcx(struct rtp_stream *rtps); -void rtp_stream_set_codec(struct rtp_stream *rtps, enum mgcp_codecs codec); +bool rtp_stream_set_codecs_from_mgcp_codec(struct rtp_stream *rtps, enum mgcp_codecs codec); +void rtp_stream_set_one_codec(struct rtp_stream *rtps, const struct sdp_audio_codec *codec); +void rtp_stream_set_codecs(struct rtp_stream *rtps, const struct sdp_audio_codecs *codecs); void rtp_stream_set_remote_addr(struct rtp_stream *rtps, const struct osmo_sockaddr_str *r); void rtp_stream_set_remote_osmux_cid(struct rtp_stream *rtps, uint8_t osmux_cid); int rtp_stream_commit(struct rtp_stream *rtps); diff --git a/src/libmsc/call_leg.c b/src/libmsc/call_leg.c index 03c9882..a8c5c41 100644 --- a/src/libmsc/call_leg.c +++ b/src/libmsc/call_leg.c @@ -324,14 +324,15 @@ /* Make sure an MGW endpoint CI is set up for an RTP connection. * This is the one-stop for all to either completely set up a new endpoint connection, or to modify an existing one. * If not yet present, allocate the rtp_stream for the given direction. - * Then, call rtp_stream_set_codec() if codec_if_known is non-NULL, and/or rtp_stream_set_remote_addr() if + * Then, call rtp_stream_set_codecs() if codecs_if_known is non-NULL, and/or rtp_stream_set_remote_addr() if * remote_addr_if_known is non-NULL. * Finally make sure that a CRCX is sent out for this direction, if this has not already happened. * If the CRCX has already happened but new codec / remote_addr data was passed, call rtp_stream_commit() to trigger an * MDCX. */ int call_leg_ensure_ci(struct call_leg *cl, enum rtp_direction dir, uint32_t call_id, struct gsm_trans *for_trans, - const enum mgcp_codecs *codec_if_known, const struct osmo_sockaddr_str *remote_addr_if_known) + const struct sdp_audio_codecs *codecs_if_known, + const struct osmo_sockaddr_str *remote_addr_if_known) { if (call_leg_ensure_rtp_alloc(cl, dir, call_id, for_trans)) return -EIO; @@ -340,8 +341,8 @@ cl->rtp[dir]->use_osmux = true; cl->rtp[dir]->remote_osmux_cid = -1; /* wildcard */ } - if (codec_if_known) - rtp_stream_set_codec(cl->rtp[dir], *codec_if_known); + if (codecs_if_known) + rtp_stream_set_codecs(cl->rtp[dir], codecs_if_known); if (remote_addr_if_known && osmo_sockaddr_str_is_nonzero(remote_addr_if_known)) rtp_stream_set_remote_addr(cl->rtp[dir], remote_addr_if_known); return rtp_stream_ensure_ci(cl->rtp[dir], cl->mgw_endpoint); @@ -350,25 +351,25 @@ int call_leg_local_bridge(struct call_leg *cl1, uint32_t call_id1, struct gsm_trans *trans1, struct call_leg *cl2, uint32_t call_id2, struct gsm_trans *trans2) { - enum mgcp_codecs codec; + struct sdp_audio_codecs *codecs; cl1->local_bridge = cl2; cl2->local_bridge = cl1; /* We may just copy the codec info we have for the RAN side of the first leg to the CN side of both legs. This * also means that if both legs use different codecs the MGW must perform transcoding on the second leg. */ - if (!cl1->rtp[RTP_TO_RAN] || !cl1->rtp[RTP_TO_RAN]->codec_known) { + if (!cl1->rtp[RTP_TO_RAN] || !cl1->rtp[RTP_TO_RAN]->codecs_known) { LOG_CALL_LEG(cl1, LOGL_ERROR, "RAN-side RTP stream codec is not known, not ready for bridging\n"); return -EINVAL; } - codec = cl1->rtp[RTP_TO_RAN]->codec; + codecs = &cl1->rtp[RTP_TO_RAN]->codecs; if (!cl1->rtp[RTP_TO_CN] || !cl2->rtp[RTP_TO_CN]) return -ENOTCONN; call_leg_ensure_ci(cl1, RTP_TO_CN, call_id1, trans1, - &codec, &cl2->rtp[RTP_TO_CN]->local); + codecs, &cl2->rtp[RTP_TO_CN]->local); call_leg_ensure_ci(cl2, RTP_TO_CN, call_id2, trans2, - &codec, &cl1->rtp[RTP_TO_CN]->local); + codecs, &cl1->rtp[RTP_TO_CN]->local); return 0; } diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c index 4a484bb..269fd57 100644 --- a/src/libmsc/gsm_04_08_cc.c +++ b/src/libmsc/gsm_04_08_cc.c @@ -1822,18 +1822,18 @@ return -EINVAL; } - if (!rtp_cn->codec_known) { + if (!rtp_cn->codecs_known) { LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "Cannot RTP CREATE to MNCC, no codec set up for the RTP CN side\n"); return -EINVAL; } /* Codec */ - m = codec_mapping_by_mgcp_codec(rtp_cn->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", - osmo_mgcpc_codec_name(rtp_cn->codec)); + sdp_audio_codec_to_str(&rtp_cn->codecs.codec[0])); return -EINVAL; } payload_msg_type = m->mncc_payload_msg_type; @@ -1841,9 +1841,9 @@ /* 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, rtp_cn->codec); + payload_type = map_codec_to_pt(mgcp_info->ptmap, mgcp_info->ptmap_len, m->mgcp); else - payload_type = rtp_cn->codec; + payload_type = m->mgcp; rtp_cn_local = call_leg_local_ip(cl, RTP_TO_CN); if (!rtp_cn_local) { diff --git a/src/libmsc/mncc_call.c b/src/libmsc/mncc_call.c index fbf96f3..1cf0c3d 100644 --- a/src/libmsc/mncc_call.c +++ b/src/libmsc/mncc_call.c @@ -263,14 +263,14 @@ return true; } - if (!mncc_call->rtps->codec_known) { + if (!mncc_call->rtps->codecs_known) { LOG_MNCC_CALL(mncc_call, LOGL_DEBUG, "Got RTP_CREATE, but RTP stream has no codec set\n"); return true; } LOG_MNCC_CALL(mncc_call, LOGL_DEBUG, "Got RTP_CREATE, responding with " OSMO_SOCKADDR_STR_FMT " %s\n", OSMO_SOCKADDR_STR_FMT_ARGS(&mncc_call->rtps->local), - osmo_mgcpc_codec_name(mncc_call->rtps->codec)); + sdp_audio_codecs_to_str(&mncc_call->rtps->codecs)); /* Already know what RTP IP:port to tell the MNCC. Send it. */ return mncc_call_tx_rtp_create(mncc_call); } @@ -295,15 +295,16 @@ return false; } - if (mncc_call->rtps->codec_known) { - const struct codec_mapping *m = codec_mapping_by_mgcp_codec(mncc_call->rtps->codec); + if (mncc_call->rtps->codecs_known) { + struct sdp_audio_codec *codec = &mncc_call->rtps->codecs.codec[0]; + const struct codec_mapping *m = codec_mapping_by_subtype_name(codec->subtype_name); if (!m) { mncc_call_error(mncc_call, "Failed to resolve audio codec '%s'\n", - osmo_mgcpc_codec_name(mncc_call->rtps->codec)); + sdp_audio_codec_to_str(codec)); return false; } - mncc_msg.rtp.payload_type = m->sdp.payload_type; + mncc_msg.rtp.payload_type = codec->payload_type; mncc_msg.rtp.payload_msg_type = m->mncc_payload_msg_type; } diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c index 7db1d0a..e9f1840 100644 --- a/src/libmsc/msc_a.c +++ b/src/libmsc/msc_a.c @@ -1327,6 +1327,7 @@ 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; + const struct codec_mapping *codec_cn = NULL; if (!rtps_to_ran) { LOG_MSC_A(msc_a, LOGL_ERROR, "Rx Assignment Complete, but no RTP stream is set up\n"); @@ -1344,9 +1345,26 @@ return; } - /* Update RAN-side endpoint CI: */ - if (codec_if_known) - rtp_stream_set_codec(rtps_to_ran, *codec_if_known); + if (codec_if_known) { + codec_cn = codec_mapping_by_mgcp_codec(*codec_if_known); + if (!codec_cn) { + LOG_TRANS(cc_trans, LOGL_ERROR, "Unknown codec in Assignment Complete: %s\n", + osmo_mgcpc_codec_name(*codec_if_known)); + call_leg_release(msc_a->cc.call_leg); + return; + } + + /* Update RAN-side endpoint CI from Assignment result */ + rtp_stream_set_one_codec(rtps_to_ran, &codec_cn->sdp); + + /* Update codec filter with Assignment result, for the CN side */ + cc_trans->cc.codecs.assignment = codec_cn->sdp; + } else { + /* No codec passed in Assignment Complete, set 'codecs.assignment' to none. */ + cc_trans->cc.codecs.assignment = (struct sdp_audio_codec){}; + LOG_TRANS(cc_trans, LOGL_INFO, "Assignment Complete without voice codec\n"); + } + rtp_stream_set_remote_addr(rtps_to_ran, &ac->assignment_complete.remote_rtp); if (rtps_to_ran->use_osmux) rtp_stream_set_remote_osmux_cid(rtps_to_ran, @@ -1364,8 +1382,9 @@ * endpoint, * - the Assignment has chosen a speech codec * go on to create the CN side RTP stream's CI. */ + codec_filter_run(&cc_trans->cc.codecs); if (call_leg_ensure_ci(msc_a->cc.call_leg, RTP_TO_CN, cc_trans->callref, cc_trans, - codec_if_known, NULL)) { + &cc_trans->cc.codecs.result.audio_codecs, NULL)) { LOG_MSC_A_CAT(msc_a, DCC, LOGL_ERROR, "Error creating MGW CI towards CN\n"); call_leg_release(msc_a->cc.call_leg); return; @@ -1760,11 +1779,13 @@ struct call_leg *cl = msc_a->cc.call_leg; struct msc_i *msc_i = msc_a_msc_i(msc_a); struct gsm_network *net = msc_a_net(msc_a); - enum mgcp_codecs codec, *codec_ptr; + struct sdp_audio_codecs *codecs; OSMO_ASSERT(!msc_a->cc.active_trans); msc_a->cc.active_trans = cc_trans; + cc_trans->cc.codecs.assignment = (struct sdp_audio_codec){}; + OSMO_ASSERT(cc_trans && cc_trans->type == TRANS_CC); if (!cl) { @@ -1785,20 +1806,17 @@ } } - /* This will lead to either MSC_EV_CALL_LEG_LOCAL_ADDR_AVAILABLE or MSC_EV_CALL_LEG_TERM. - * If the local address is already known, then immediately trigger. */ + /* Make sure an MGW endpoint towards RAN is present. If it is already set up, "skip" to + * MSC_EV_CALL_LEG_LOCAL_ADDR_AVAILABLE immediately. If not, set it up. */ if (call_leg_local_ip(cl, RTP_TO_RAN)) return osmo_fsm_inst_dispatch(msc_a->c.fi, MSC_EV_CALL_LEG_RTP_LOCAL_ADDR_AVAILABLE, cl->rtp[RTP_TO_RAN]); - if (msc_a->c.ran->type == OSMO_RAT_UTRAN_IU) { - /* FUTURE: ran_infra->force_mgw_codecs_to_ran is intended to be used here instead of the special - * condition on OSMO_RAT_UTRAN_IU and the mgcp_codecs value CODEC_IUFP */ - codec = CODEC_IUFP; - codec_ptr = &codec; - } else { - codec_ptr = NULL; - } - return call_leg_ensure_ci(msc_a->cc.call_leg, RTP_TO_RAN, cc_trans->callref, cc_trans, codec_ptr, NULL); + codec_filter_run(&cc_trans->cc.codecs); + if (msc_a->c.ran->force_mgw_codecs_to_ran.count) + codecs = &msc_a->c.ran->force_mgw_codecs_to_ran; + else + codecs = &cc_trans->cc.codecs.result.audio_codecs; + return call_leg_ensure_ci(msc_a->cc.call_leg, RTP_TO_RAN, cc_trans->callref, cc_trans, codecs, NULL); } int msc_a_try_call_assignment(struct gsm_trans *cc_trans) diff --git a/src/libmsc/msc_ho.c b/src/libmsc/msc_ho.c index 7e7905b..d53bb9e 100644 --- a/src/libmsc/msc_ho.c +++ b/src/libmsc/msc_ho.c @@ -39,6 +39,7 @@ #include <osmocom/msc/call_leg.h> #include <osmocom/msc/rtp_stream.h> #include <osmocom/msc/mncc_call.h> +#include <osmocom/msc/codec_mapping.h> struct osmo_fsm msc_ho_fsm; @@ -570,7 +571,7 @@ /* Backup old cell's RTP IP:port and codec data */ msc_a->ho.old_cell.ran_remote_rtp = rtp_to_ran->remote; - msc_a->ho.old_cell.codec = rtp_to_ran->codec; + msc_a->ho.old_cell.codecs = rtp_to_ran->codecs; /* Blindly taken over from an MNCC trace of existing code: send an all-zero CCCAP: */ outgoing_call_req.fields |= MNCC_F_CCCAP; @@ -707,7 +708,7 @@ /* Backup old cell's RTP IP:port and codec data */ msc_a->ho.old_cell.ran_remote_rtp = rtp_to_ran->remote; - msc_a->ho.old_cell.codec = rtp_to_ran->codec; + msc_a->ho.old_cell.codecs = rtp_to_ran->codecs; LOG_HO(msc_a, LOGL_DEBUG, "Switching RTP stream to new cell: from " OSMO_SOCKADDR_STR_FMT " to " OSMO_SOCKADDR_STR_FMT "\n", OSMO_SOCKADDR_STR_FMT_ARGS(&msc_a->ho.old_cell.ran_remote_rtp), @@ -726,10 +727,17 @@ /* Switch over to the new peer */ rtp_stream_set_remote_addr(rtp_to_ran, &msc_a->ho.new_cell.ran_remote_rtp); - if (msc_a->ho.new_cell.codec_present) - rtp_stream_set_codec(rtp_to_ran, msc_a->ho.new_cell.codec); - else + if (msc_a->ho.new_cell.codec_present) { + struct sdp_audio_codecs codecs = {}; + if (!sdp_audio_codecs_add_mgcp_codec(&codecs, msc_a->ho.new_cell.codec)) { + LOG_HO(msc_a, LOGL_ERROR, + "Cannot resolve codec: %s\n", osmo_mgcpc_codec_name(msc_a->ho.new_cell.codec)); + } else { + rtp_stream_set_codecs(rtp_to_ran, &codecs); + } + } else { LOG_HO(msc_a, LOGL_ERROR, "No codec is set\n"); + } rtp_stream_commit(rtp_to_ran); } @@ -768,7 +776,7 @@ /* Switch back to the old cell */ rtp_stream_set_remote_addr(rtp_to_ran, &msc_a->ho.old_cell.ran_remote_rtp); - rtp_stream_set_codec(rtp_to_ran, msc_a->ho.old_cell.codec); + rtp_stream_set_codecs(rtp_to_ran, &msc_a->ho.old_cell.codecs); rtp_stream_commit(rtp_to_ran); } diff --git a/src/libmsc/msc_t.c b/src/libmsc/msc_t.c index 43bc74e..787d736 100644 --- a/src/libmsc/msc_t.c +++ b/src/libmsc/msc_t.c @@ -450,9 +450,9 @@ if (r->codec_present) { LOG_MSC_T(msc_t, LOGL_DEBUG, "From Handover Request Ack, got %s\n", osmo_mgcpc_codec_name(r->codec)); - rtp_stream_set_codec(rtp_ran, r->codec); + rtp_stream_set_codecs_from_mgcp_codec(rtp_ran, r->codec); if (rtp_cn) - rtp_stream_set_codec(rtp_cn, r->codec); + rtp_stream_set_codecs_from_mgcp_codec(rtp_cn, r->codec); } else { LOG_MSC_T(msc_t, LOGL_DEBUG, "No codec in Handover Request Ack\n"); } diff --git a/src/libmsc/rtp_stream.c b/src/libmsc/rtp_stream.c index b7e7381..ac44414 100644 --- a/src/libmsc/rtp_stream.c +++ b/src/libmsc/rtp_stream.c @@ -28,6 +28,7 @@ #include <osmocom/msc/transaction.h> #include <osmocom/msc/call_leg.h> #include <osmocom/msc/rtp_stream.h> +#include <osmocom/msc/codec_mapping.h> #define LOG_RTPS(rtps, level, fmt, args...) \ LOGPFSML(rtps->fi, level, fmt, ##args) @@ -78,10 +79,10 @@ OSMO_STRBUF_PRINTF(sb, ":no-remote-port"); else if (!rtps->remote_sent_to_mgw) OSMO_STRBUF_PRINTF(sb, ":remote-port-not-sent"); - if (!rtps->codec_known) - OSMO_STRBUF_PRINTF(sb, ":no-codec"); - else if (!rtps->codec_sent_to_mgw) - OSMO_STRBUF_PRINTF(sb, ":codec-not-sent"); + if (!rtps->codecs_known) + OSMO_STRBUF_PRINTF(sb, ":no-codecs"); + else if (!rtps->codecs_sent_to_mgw) + OSMO_STRBUF_PRINTF(sb, ":codecs-not-sent"); if (rtps->use_osmux) { if (rtps->remote_osmux_cid < 0) OSMO_STRBUF_PRINTF(sb, ":no-remote-osmux-cid"); @@ -141,7 +142,7 @@ && osmo_sockaddr_str_is_nonzero(&rtps->remote) && rtps->remote_sent_to_mgw && (!rtps->use_osmux || rtps->remote_osmux_cid_sent_to_mgw) - && rtps->codec_known) + && rtps->codecs_known) rtp_stream_state_chg(rtps, RTP_STREAM_ST_ESTABLISHED); } @@ -171,14 +172,14 @@ osmo_fsm_inst_dispatch(fi->proc.parent, CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE, rtps); check_established(rtps); - if ((!rtps->remote_sent_to_mgw || !rtps->codec_sent_to_mgw) + if ((!rtps->remote_sent_to_mgw || !rtps->codecs_sent_to_mgw) && osmo_sockaddr_str_is_nonzero(&rtps->remote) && (!rtps->use_osmux || rtps->remote_osmux_cid_sent_to_mgw) - && rtps->codec_known) { + && rtps->codecs_known) { LOG_RTPS(rtps, LOGL_DEBUG, "local ip:port set;%s%s%s triggering MDCX to send the new settings\n", - (!rtps->remote_sent_to_mgw)? " remote ip:port not yet sent," : "", - (!rtps->codec_sent_to_mgw)? " codec not yet sent," : "", + (!rtps->remote_sent_to_mgw) ? " remote ip:port not yet sent," : "", + (!rtps->codecs_sent_to_mgw) ? " codecs not yet sent," : "", (rtps->use_osmux && !rtps->remote_osmux_cid_sent_to_mgw) ? "Osmux CID not yet sent,": ""); rtp_stream_do_mdcx(rtps); } @@ -192,7 +193,7 @@ case RTP_STREAM_EV_CRCX_FAIL: case RTP_STREAM_EV_MDCX_FAIL: rtps->remote_sent_to_mgw = false; - rtps->codec_sent_to_mgw = false; + rtps->codecs_sent_to_mgw = false; rtps->remote_osmux_cid_sent_to_mgw = false; rtp_stream_update_id(rtps); rtp_stream_state_chg(rtps, RTP_STREAM_ST_DISCARDING); @@ -310,10 +311,28 @@ if (verb == MGCP_VERB_CRCX) verb_info.conn_mode = rtps->crcx_conn_mode; - if (rtps->codec_known) { - verb_info.codecs[0] = rtps->codec; - verb_info.codecs_len = 1; - rtps->codec_sent_to_mgw = true; + if (rtps->codecs_known) { + /* Send the list of codecs to the MGW. Ideally we would just feed the SDP directly, but for legacy + * reasons we still need to translate to a struct mgcp_conn_peer representation to send it. */ + struct sdp_audio_codec *codec; + int i = 0; + foreach_sdp_audio_codec(codec, &rtps->codecs) { + const struct codec_mapping *m = codec_mapping_by_subtype_name(codec->subtype_name); + if (!m) { + LOG_RTPS(rtps, LOGL_ERROR, "Cannot map codec '%s' to MGCP: codec is unknown\n", + codec->subtype_name); + continue; + } + verb_info.codecs[i] = m->mgcp; + verb_info.ptmap[i] = (struct ptmap){ + .codec = m->mgcp, + .pt = codec->payload_type, + }; + i++; + verb_info.codecs_len = i; + verb_info.ptmap_len = i; + } + rtps->codecs_sent_to_mgw = true; } if (osmo_sockaddr_str_is_nonzero(&rtps->remote)) { int rc = osmo_strlcpy(verb_info.addr, rtps->remote.ip, sizeof(verb_info.addr)); @@ -368,12 +387,12 @@ LOG_RTPS(rtps, LOGL_DEBUG, "Not committing: no remote RTP address known\n"); return -1; } - if (!rtps->codec_known) { - LOG_RTPS(rtps, LOGL_DEBUG, "Not committing: no codec known\n"); + if (!rtps->codecs_known) { + LOG_RTPS(rtps, LOGL_DEBUG, "Not committing: no codecs known\n"); return -1; } - if (rtps->remote_sent_to_mgw && rtps->codec_sent_to_mgw) { - LOG_RTPS(rtps, LOGL_DEBUG, "Not committing: both remote RTP address and codec already set up at MGW\n"); + if (rtps->remote_sent_to_mgw && rtps->codecs_sent_to_mgw) { + LOG_RTPS(rtps, LOGL_DEBUG, "Not committing: both remote RTP address and codecs already set up at MGW\n"); return 0; } if (!rtps->ci) { @@ -383,22 +402,47 @@ LOG_RTPS(rtps, LOGL_DEBUG, "Committing: Tx MDCX to update the MGW: updating%s%s%s\n", rtps->remote_sent_to_mgw ? "" : " remote-RTP-IP-port", - rtps->codec_sent_to_mgw ? "" : " codec", + rtps->codecs_sent_to_mgw ? "" : " codecs", (!rtps->use_osmux || rtps->remote_osmux_cid_sent_to_mgw) ? "" : " remote-Osmux-CID"); return rtp_stream_do_mdcx(rtps); } -void rtp_stream_set_codec(struct rtp_stream *rtps, enum mgcp_codecs codec) +void rtp_stream_set_codecs(struct rtp_stream *rtps, const struct sdp_audio_codecs *codecs) { + if (!codecs || !codecs->count) + return; + if (sdp_audio_codecs_cmp(&rtps->codecs, codecs, false, true) == 0) { + LOG_RTPS(rtps, LOGL_DEBUG, "no change: codecs already set to %s\n", + sdp_audio_codecs_to_str(&rtps->codecs)); + return; + } if (rtps->fi->state == RTP_STREAM_ST_ESTABLISHED) rtp_stream_state_chg(rtps, RTP_STREAM_ST_ESTABLISHING); - LOG_RTPS(rtps, LOGL_DEBUG, "setting codec to %s\n", osmo_mgcpc_codec_name(codec)); - rtps->codec = codec; - rtps->codec_known = true; - rtps->codec_sent_to_mgw = false; + LOG_RTPS(rtps, LOGL_DEBUG, "setting codecs to %s\n", sdp_audio_codecs_to_str(codecs)); + rtps->codecs = *codecs; + rtps->codecs_known = true; + rtps->codecs_sent_to_mgw = false; rtp_stream_update_id(rtps); } +/* Convenience shortcut to call rtp_stream_set_codecs() with a list of only one sdp_audio_codec record. */ +void rtp_stream_set_one_codec(struct rtp_stream *rtps, const struct sdp_audio_codec *codec) +{ + struct sdp_audio_codecs codecs = {}; + sdp_audio_codecs_add_copy(&codecs, codec); + rtp_stream_set_codecs(rtps, &codecs); +} + +/* For legacy, rather use rtp_stream_set_codecs() with a full codecs list. */ +bool rtp_stream_set_codecs_from_mgcp_codec(struct rtp_stream *rtps, enum mgcp_codecs codec) +{ + struct sdp_audio_codecs codecs = {}; + if (!sdp_audio_codecs_add_mgcp_codec(&codecs, codec)) + return false; + rtp_stream_set_codecs(rtps, &codecs); + return true; +} + void rtp_stream_set_remote_addr(struct rtp_stream *rtps, const struct osmo_sockaddr_str *r) { if (osmo_sockaddr_str_cmp(&rtps->remote, r) == 0) { @@ -433,7 +477,7 @@ if (rtps->fi->state != RTP_STREAM_ST_ESTABLISHED) return false; if (!rtps->remote_sent_to_mgw - || !rtps->codec_sent_to_mgw + || !rtps->codecs_sent_to_mgw || (rtps->use_osmux && !rtps->remote_osmux_cid_sent_to_mgw)) return false; return true; diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err index fbe2601..877015a 100644 --- a/tests/msc_vlr/msc_vlr_test_call.err +++ b/tests/msc_vlr/msc_vlr_test_call.err @@ -301,10 +301,10 @@ DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: Starting call assignment DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Allocated DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: is child of msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) - MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x80000001 + MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x80000001 codecs=VND.3GPP.IUFP/16000#96 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to VND.3GPP.IUFP/16000 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96 - MGW acknowledges the CRCX, triggering Assignment MGW --CRCX OK to RTP_TO_RAN--> MSC DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE @@ -314,13 +314,13 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST - Assignment succeeds, triggering CRCX to CN DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649: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-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649: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 - MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000001 + MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000001 codecs=AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 - CN RTP address is available, trigger MNCC_RTP_CREATE MGW --CRCX OK to RTP_TO_CN--> MSC DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE @@ -779,10 +779,10 @@ DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Starting call assignment DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}: Allocated DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}: is child of msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP) - MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x423 + MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x423 codecs=VND.3GPP.IUFP/16000#96 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to VND.3GPP.IUFP/16000 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96 DMNCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) tx MNCC_CALL_CONF_IND MSC --> MNCC: callref 0x423: MNCC_CALL_CONF_IND DREF msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: - rx_from_ms: now used by 1 (cc) @@ -800,13 +800,13 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST - Assignment completes, triggering CRCX to CN DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059: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-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059: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 - MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x423 + MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x423 codecs=AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 - When the CN side RTP address is known, send MNCC_RTP_CREATE MGW --CRCX OK to RTP_TO_CN--> MSC DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE @@ -1249,10 +1249,10 @@ DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Starting call assignment DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}: Allocated DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}: is child of msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP) - MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x423 + MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x423 codecs=VND.3GPP.IUFP/16000#96 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to VND.3GPP.IUFP/16000 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96 DMNCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) tx MNCC_CALL_CONF_IND MSC --> MNCC: callref 0x423: MNCC_CALL_CONF_IND DREF msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: - rx_from_ms: now used by 1 (cc) @@ -1270,13 +1270,13 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST - Assignment completes, triggering CRCX to CN DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059: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-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059: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 - MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x423 + MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x423 codecs=AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 - When the CN side RTP address is known, send MNCC_RTP_CREATE MGW --CRCX OK to RTP_TO_CN--> MSC DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE @@ -1667,10 +1667,10 @@ DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: Starting call assignment DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Allocated DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: is child of msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) - MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x80000002 + MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x80000002 codecs=VND.3GPP.IUFP/16000#96 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to VND.3GPP.IUFP/16000 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96 - MGW acknowledges the CRCX, triggering Assignment MGW --CRCX OK to RTP_TO_RAN--> MSC DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE @@ -1680,13 +1680,13 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST - Assignment succeeds, triggering CRCX to CN DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650: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-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650: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 - MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000002 + MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000002 codecs=AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 - CN RTP address is available, trigger MNCC_RTP_CREATE MGW --CRCX OK to RTP_TO_CN--> MSC DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE @@ -2094,10 +2094,10 @@ DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: Starting call assignment DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Allocated DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: is child of msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) - MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x80000003 + MGW <--CRCX to RTP_TO_RAN-- MSC: callref=0x80000003 codecs=VND.3GPP.IUFP/16000#96 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to VND.3GPP.IUFP/16000 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96 - MGW acknowledges the CRCX, triggering Assignment MGW --CRCX OK to RTP_TO_RAN--> MSC DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE @@ -2107,13 +2107,13 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST - Assignment succeeds, triggering CRCX to CN DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651: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-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651: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 - MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000003 + MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000003 codecs=AMR:octet-align=1#112 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ) -DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codec to AMR/8000/1 +DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112 - CN RTP address is available, trigger MNCC_RTP_CREATE MGW --CRCX OK to RTP_TO_CN--> MSC DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c index b0c60ed..45b97a2 100644 --- a/tests/msc_vlr/msc_vlr_tests.c +++ b/tests/msc_vlr/msc_vlr_tests.c @@ -41,6 +41,7 @@ #include <osmocom/msc/msc_t.h> #include <osmocom/msc/call_leg.h> #include <osmocom/msc/rtp_stream.h> +#include <osmocom/msc/codec_mapping.h> #include "msc_vlr_tests.h" @@ -852,20 +853,23 @@ /* override, requires '-Wl,--wrap=call_leg_ensure_ci' */ int __real_call_leg_ensure_ci(struct call_leg *cl, enum rtp_direction dir, uint32_t call_id, struct gsm_trans *for_trans, - const enum mgcp_codecs *codec_if_known, const struct osmo_sockaddr_str *remote_addr_if_known); + const struct sdp_audio_codecs *codecs_if_known, + const struct osmo_sockaddr_str *remote_addr_if_known); int __wrap_call_leg_ensure_ci(struct call_leg *cl, enum rtp_direction dir, uint32_t call_id, struct gsm_trans *for_trans, - const enum mgcp_codecs *codec_if_known, const struct osmo_sockaddr_str *remote_addr_if_known) + const struct sdp_audio_codecs *codecs_if_known, + const struct osmo_sockaddr_str *remote_addr_if_known) { if (!cl->rtp[dir]) { - log("MGW <--CRCX to %s-- MSC: callref=0x%x", rtp_direction_name(dir), call_id); + log("MGW <--CRCX to %s-- MSC: callref=0x%x codecs=%s", rtp_direction_name(dir), call_id, + codecs_if_known ? sdp_audio_codecs_to_str(codecs_if_known) : "unset"); OSMO_ASSERT(expecting_crcx == dir); expecting_crcx = -1; got_crcx = true; call_leg_ensure_rtp_alloc(cl, dir, call_id, for_trans); - if (codec_if_known) - rtp_stream_set_codec(cl->rtp[dir], *codec_if_known); + if (codecs_if_known) + rtp_stream_set_codecs(cl->rtp[dir], codecs_if_known); if (remote_addr_if_known && osmo_sockaddr_str_is_nonzero(remote_addr_if_known)) rtp_stream_set_remote_addr(cl->rtp[dir], remote_addr_if_known); } -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/30125 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: If9c67b298b30f893ec661f84c9fc622ad01b5ee5 Gerrit-Change-Number: 30125 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
1 0
0 0
[M] Change in osmo-msc[master]: in ran_msg, return gsm0808_speech_codec (inter-MSC)
by neels 24 Mar '23

24 Mar '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/31696 ) ( 3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: in ran_msg, return gsm0808_speech_codec (inter-MSC) ...................................................................... in ran_msg, return gsm0808_speech_codec (inter-MSC) Get rid of enum mgcp_codecs in inter-MSC handover related code. Change-Id: I9c649f98738a55b8637ae600d5cdf81099fd08e5 --- M include/osmocom/msc/msc_ho.h M include/osmocom/msc/ran_msg.h M src/libmsc/msc_ho.c M src/libmsc/msc_t.c M src/libmsc/ran_msg_a.c 5 files changed, 45 insertions(+), 25 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/msc/msc_ho.h b/include/osmocom/msc/msc_ho.h index a3f60c7..ca5618e 100644 --- a/include/osmocom/msc/msc_ho.h +++ b/include/osmocom/msc/msc_ho.h @@ -81,7 +81,7 @@ struct osmo_sockaddr_str ran_remote_rtp; /* The codec from Handover Request Acknowledge. */ bool codec_present; - enum mgcp_codecs codec; + struct gsm0808_speech_codec codec; /* Inter-MSC voice forwarding via MNCC, to the remote MSC. The Prepare Handover Response sent us the * Handover Number the remote MSC assigned. This is a call to that Handover Number, via PBX. diff --git a/include/osmocom/msc/ran_msg.h b/include/osmocom/msc/ran_msg.h index d6b1e75..3e0ac60 100644 --- a/include/osmocom/msc/ran_msg.h +++ b/include/osmocom/msc/ran_msg.h @@ -162,7 +162,8 @@ struct osmo_sockaddr_str remote_rtp; bool codec_present; - enum mgcp_codecs codec; + struct gsm0808_speech_codec codec; + bool codec_with_iuup; }; struct ran_handover_command { diff --git a/src/libmsc/msc_ho.c b/src/libmsc/msc_ho.c index d53bb9e..e11abcf 100644 --- a/src/libmsc/msc_ho.c +++ b/src/libmsc/msc_ho.c @@ -681,7 +681,7 @@ msc_a->ho.new_cell.codec = hra->ran_dec->handover_request_ack.codec; if (hra->ran_dec->handover_request_ack.codec_present) { LOG_HO(msc_a, LOGL_DEBUG, "Request Ack contains codec %s\n", - osmo_mgcpc_codec_name(msc_a->ho.new_cell.codec)); + gsm0808_speech_codec_type_name(msc_a->ho.new_cell.codec.type)); } } @@ -728,13 +728,14 @@ /* Switch over to the new peer */ rtp_stream_set_remote_addr(rtp_to_ran, &msc_a->ho.new_cell.ran_remote_rtp); if (msc_a->ho.new_cell.codec_present) { - struct sdp_audio_codecs codecs = {}; - if (!sdp_audio_codecs_add_mgcp_codec(&codecs, msc_a->ho.new_cell.codec)) { - LOG_HO(msc_a, LOGL_ERROR, - "Cannot resolve codec: %s\n", osmo_mgcpc_codec_name(msc_a->ho.new_cell.codec)); - } else { - rtp_stream_set_codecs(rtp_to_ran, &codecs); - } + const struct codec_mapping *m; + m = codec_mapping_by_gsm0808_speech_codec_type(msc_a->ho.new_cell.codec.type); + /* TODO: use codec_mapping_by_gsm0808_speech_codec() to also match on codec.cfg */ + if (!m) + LOG_HO(msc_a, LOGL_ERROR, "Cannot resolve codec: %s\n", + gsm0808_speech_codec_type_name(msc_a->ho.new_cell.codec.type)); + else + rtp_stream_set_one_codec(rtp_to_ran, &m->sdp); } else { LOG_HO(msc_a, LOGL_ERROR, "No codec is set\n"); } diff --git a/src/libmsc/msc_t.c b/src/libmsc/msc_t.c index 787d736..7f316a7 100644 --- a/src/libmsc/msc_t.c +++ b/src/libmsc/msc_t.c @@ -38,6 +38,7 @@ #include <osmocom/msc/vlr.h> #include <osmocom/msc/msc_i.h> #include <osmocom/msc/gsm_data.h> +#include <osmocom/msc/codec_mapping.h> static struct osmo_fsm msc_t_fsm; @@ -448,11 +449,20 @@ LOG_MSC_T(msc_t, LOGL_DEBUG, "No RTP IP:port in Handover Request Ack\n"); } if (r->codec_present) { - LOG_MSC_T(msc_t, LOGL_DEBUG, "From Handover Request Ack, got %s\n", - osmo_mgcpc_codec_name(r->codec)); - rtp_stream_set_codecs_from_mgcp_codec(rtp_ran, r->codec); - if (rtp_cn) - rtp_stream_set_codecs_from_mgcp_codec(rtp_cn, r->codec); + const struct codec_mapping *m = codec_mapping_by_gsm0808_speech_codec_type(r->codec.type); + /* TODO: use codec_mapping_by_gsm0808_speech_codec() to also match on codec.cfg */ + if (!m) { + LOG_MSC_T(msc_t, LOGL_ERROR, "Cannot resolve codec in Handover Request Ack: %s / %s\n", + gsm0808_speech_codec_type_name(r->codec.type), + m ? sdp_audio_codec_to_str(&m->sdp) : "(unknown)"); + } else { + LOG_MSC_T(msc_t, LOGL_DEBUG, "From Handover Request Ack, got codec %s / %s\n", + gsm0808_speech_codec_type_name(r->codec.type), + sdp_audio_codec_to_str(&m->sdp)); + rtp_stream_set_one_codec(rtp_ran, &m->sdp); + if (rtp_cn) + rtp_stream_set_one_codec(rtp_cn, &m->sdp); + } } else { LOG_MSC_T(msc_t, LOGL_DEBUG, "No codec in Handover Request Ack\n"); } diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c index 56252f1..19402bc 100644 --- a/src/libmsc/ran_msg_a.c +++ b/src/libmsc/ran_msg_a.c @@ -671,13 +671,12 @@ } if (ie_chosen_speech_version) { - struct gsm0808_speech_codec sc; ran_dec_msg.handover_request_ack.chosen_speech_version = ie_chosen_speech_version->val[0]; /* the codec may be extrapolated from this Speech Version or below from Speech Codec */ - gsm0808_speech_codec_from_chan_type(&sc, ran_dec_msg.handover_request_ack.chosen_speech_version); - ran_dec_msg.handover_request_ack.codec_present = true; - ran_dec_msg.handover_request_ack.codec = ran_a_mgcp_codec_from_sc(&sc); + if (gsm0808_speech_codec_from_chan_type(&ran_dec_msg.handover_request_ack.codec, + ran_dec_msg.handover_request_ack.chosen_speech_version) == 0) + ran_dec_msg.handover_request_ack.codec_present = true; } if (ie_aoip_transp_addr) { @@ -692,14 +691,12 @@ } if (ie_speech_codec) { - struct gsm0808_speech_codec sc; - if (gsm0808_dec_speech_codec(&sc, ie_speech_codec->val, ie_speech_codec->len) < 0) + /* the codec may be extrapolated from above Speech Version or from this Speech Codec */ + if (gsm0808_dec_speech_codec(&ran_dec_msg.handover_request_ack.codec, + ie_speech_codec->val, ie_speech_codec->len) < 0) LOG_RAN_A_DEC_MSG(LOGL_ERROR, "unable to decode IE Speech Codec (Chosen)\n"); - else { - /* the codec may be extrapolated from above Speech Version or from this Speech Codec */ + else ran_dec_msg.handover_request_ack.codec_present = true; - ran_dec_msg.handover_request_ack.codec = ran_a_mgcp_codec_from_sc(&sc); - } } return ran_decoded(ran_dec, &ran_dec_msg); -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/31696 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I9c649f98738a55b8637ae600d5cdf81099fd08e5 Gerrit-Change-Number: 31696 Gerrit-PatchSet: 8 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
1 0
0 0
[M] Change in osmo-msc[master]: [codecs filter] use filter result in Assignment
by neels 24 Mar '23

24 Mar '23
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
1 0
0 0
[S] Change in osmo-hnbgw[master]: map_sccp: on timeout during WAIT_CC, send N-DISCONNECT to SCCP-SCOC
by neels 24 Mar '23

24 Mar '23
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32036 to look at the new patch set (#2). Change subject: map_sccp: on timeout during WAIT_CC, send N-DISCONNECT to SCCP-SCOC ...................................................................... map_sccp: on timeout during WAIT_CC, send N-DISCONNECT to SCCP-SCOC When waiting for CC expires, we should tell the SCCP-SCOC that we've stopped waiting: send N-DISCONNECT, instead of nothing. Change-Id: Ie94fcee4e2507a55449050aab96307199aed99a2 --- M src/osmo-hnbgw/context_map_sccp.c 1 file changed, 16 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/36/32036/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32036 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ie94fcee4e2507a55449050aab96307199aed99a2 Gerrit-Change-Number: 32036 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmo-hnbgw[master]: release UE Contexts on SCTP_RESTART
by neels 24 Mar '23

24 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32038 ) Change subject: release UE Contexts on SCTP_RESTART ...................................................................... release UE Contexts on SCTP_RESTART When receiving SCTP_RESTART for a given HNB, directly clear the UE Contexts. (The HNB typically connects via HNBAP shortly after this causing a UE Context clearing too, but UE state should always be cleared on SCTP_RESTART, no matter what.) Change-Id: I583922193ba73e17ab85152005535188c2762b85 --- M src/osmo-hnbgw/hnbgw.c 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/38/32038/1 diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 5b4e9b6..0624803 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -264,6 +264,7 @@ case SCTP_RESTART: LOGHNB(hnb, DMAIN, LOGL_NOTICE, "HNB SCTP conn RESTARTed, marking as HNBAP-unregistered\n"); hnb->hnb_registered = false; + hnb_context_release_ue_state(hnb); /* The tx queue may be quite full after an SCTP RESTART: (SYS#6113) * The link may have been flaky (a possible reason for the peer restarting the conn) and * hence the kernel socket Tx queue may be full (no ACKs coming back) and our own userspace -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32038 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I583922193ba73e17ab85152005535188c2762b85 Gerrit-Change-Number: 32038 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: release UE Contexts on HNB (Re-)Register
by neels 24 Mar '23

24 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32037 ) Change subject: release UE Contexts on HNB (Re-)Register ...................................................................... release UE Contexts on HNB (Re-)Register Whenever a HNB reconnects, we want to discard all previous UE state and any active connections. In one HNB reconnect scenario, we receive SCTP_RESTART. This sets hnb_registered == false, which in turn skipped the UE cleanup step in hnbgw_rx_hnb_register_req(), leaking UE Contexts. Remove all weird conditions like that, and simply clear out all UE state whenever a HNB registers, period. Change-Id: I370966d2d76fd263714e727918fcc1ea2f2315fa --- M src/osmo-hnbgw/hnbgw_hnbap.c 1 file changed, 24 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/37/32037/1 diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c index 19ebd38..a1cbec5 100644 --- a/src/osmo-hnbgw/hnbgw_hnbap.c +++ b/src/osmo-hnbgw/hnbgw_hnbap.c @@ -469,13 +469,11 @@ ctx->identity_info, ctx->id.mcc, ctx->id.mnc, ctx->id.lac, ctx->id.rac, ctx->id.sac, ctx->id.cid, name, ctx->hnb_registered ? " (re-connecting)" : ""); - if (ctx->hnb_registered) { - /* The HNB is already registered, and we are seeing a new HNB Register Request. The HNB has restarted - * without us noticing. Clearly, the HNB does not expect any UE state to be active here, so discard any - * UE contexts and SCCP connections associated with this HNB. */ - LOGHNB(ctx, DHNBAP, LOGL_NOTICE, "HNB reconnecting, discarding all previous UE state\n"); - hnb_context_release_ue_state(ctx); - } + /* The HNB is already registered, and we are seeing a new HNB Register Request. The HNB has restarted + * without us noticing. Clearly, the HNB does not expect any UE state to be active here, so discard any + * UE contexts and SCCP connections associated with this HNB. */ + LOGHNB(ctx, DHNBAP, LOGL_NOTICE, "HNB (re)connecting, discarding all previous UE state\n"); + hnb_context_release_ue_state(ctx); ctx->hnb_registered = true; -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32037 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I370966d2d76fd263714e727918fcc1ea2f2315fa Gerrit-Change-Number: 32037 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: map_sccp: on timeout during WAIT_CC, send N-DISCONNECT to SCCP-SCOC
by neels 24 Mar '23

24 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32036 ) Change subject: map_sccp: on timeout during WAIT_CC, send N-DISCONNECT to SCCP-SCOC ...................................................................... map_sccp: on timeout during WAIT_CC, send N-DISCONNECT to SCCP-SCOC When waiting for CC expires, we should tell the SCCP-SCOC that we've stopped waiting: send N-DISCONNECT, instead of nothing. Change-Id: Ie94fcee4e2507a55449050aab96307199aed99a2 --- M src/osmo-hnbgw/context_map_sccp.c 1 file changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/36/32036/1 diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c index deb6e0f..ad57f6d 100644 --- a/src/osmo-hnbgw/context_map_sccp.c +++ b/src/osmo-hnbgw/context_map_sccp.c @@ -442,11 +442,11 @@ /* Return 1 to terminate FSM instance, 0 to keep running */ switch (fi->state) { case MAP_SCCP_ST_INIT: - case MAP_SCCP_ST_WAIT_CC: /* cannot sent SCCP RLSD, because the other side hasn't responded with the remote reference. */ map_sccp_fsm_state_chg(MAP_SCCP_ST_DISCONNECTED); return 0; + case MAP_SCCP_ST_WAIT_CC: case MAP_SCCP_ST_CONNECTED: case MAP_SCCP_ST_WAIT_RLSD: /* send SCCP RLSD. libosmo-sigtran/sccp_scoc.c will do the SCCP connection cleanup. -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32036 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ie94fcee4e2507a55449050aab96307199aed99a2 Gerrit-Change-Number: 32036 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: log: in new RUA,SCCP FSM IDs, indicate CS/PS
by neels 24 Mar '23

24 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32039 ) Change subject: log: in new RUA,SCCP FSM IDs, indicate CS/PS ...................................................................... log: in new RUA,SCCP FSM IDs, indicate CS/PS During tests without an SGSN, I noticed SCCP connections failing, and I also noticed that I couldn't tell if they were CS or PS related. Add a "CS"/"PS" indicator to FSM instance IDs for RUA and SCCP. Change-Id: I5b8242196af3b08eaf64ca5ac1c257a97a5d02cb --- M src/osmo-hnbgw/context_map_rua.c M src/osmo-hnbgw/context_map_sccp.c 2 files changed, 17 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/39/32039/1 diff --git a/src/osmo-hnbgw/context_map_rua.c b/src/osmo-hnbgw/context_map_rua.c index 980fad2..12a428b 100644 --- a/src/osmo-hnbgw/context_map_rua.c +++ b/src/osmo-hnbgw/context_map_rua.c @@ -72,7 +72,8 @@ { struct osmo_fsm_inst *fi = osmo_fsm_inst_alloc(&map_rua_fsm, map, map, LOGL_DEBUG, NULL); OSMO_ASSERT(fi); - osmo_fsm_inst_update_id_f_sanitize(fi, '-', "%s-RUA-%u", hnb_context_name(map->hnb_ctx), map->rua_ctx_id); + osmo_fsm_inst_update_id_f_sanitize(fi, '-', "%s-%s-RUA-%u", hnb_context_name(map->hnb_ctx), + map->is_ps ? "PS" : "CS", map->rua_ctx_id); OSMO_ASSERT(map->rua_fi == NULL); map->rua_fi = fi; diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c index ad57f6d..4f0b348 100644 --- a/src/osmo-hnbgw/context_map_sccp.c +++ b/src/osmo-hnbgw/context_map_sccp.c @@ -78,7 +78,8 @@ { struct osmo_fsm_inst *fi = osmo_fsm_inst_alloc(&map_sccp_fsm, map, map, LOGL_DEBUG, NULL); OSMO_ASSERT(fi); - osmo_fsm_inst_update_id_f_sanitize(fi, '-', "%s-SCCP-%u", hnb_context_name(map->hnb_ctx), map->scu_conn_id); + osmo_fsm_inst_update_id_f_sanitize(fi, '-', "%s-%s-SCCP-%u", hnb_context_name(map->hnb_ctx), + map->is_ps ? "PS" : "CS", map->scu_conn_id); OSMO_ASSERT(map->sccp_fi == NULL); map->sccp_fi = fi; -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32039 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I5b8242196af3b08eaf64ca5ac1c257a97a5d02cb Gerrit-Change-Number: 32039 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: vty: 'show ue': show which HNB the UE is registered on
by neels 24 Mar '23

24 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32040 ) Change subject: vty: 'show ue': show which HNB the UE is registered on ...................................................................... vty: 'show ue': show which HNB the UE is registered on Change-Id: Ife54a105a5a011678d6a03d0032c7622c3079a28 --- M src/osmo-hnbgw/hnbgw_vty.c 1 file changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/40/32040/1 diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c index 7f79b82..8d2366f 100644 --- a/src/osmo-hnbgw/hnbgw_vty.c +++ b/src/osmo-hnbgw/hnbgw_vty.c @@ -217,7 +217,8 @@ static void vty_dump_ue_info(struct vty *vty, struct ue_context *ue) { - vty_out(vty, "UE IMSI \"%s\" context ID %u%s", ue->imsi, ue->context_id, VTY_NEWLINE); + vty_out(vty, "UE IMSI \"%s\" context ID %u HNB %s%s", ue->imsi, ue->context_id, + hnb_context_name(ue->hnb), VTY_NEWLINE); } DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information about all HNB") -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32040 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ife54a105a5a011678d6a03d0032c7622c3079a28 Gerrit-Change-Number: 32040 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-hnbgw[master]: [RFC] drop list of HNBAP UE Context
by neels 24 Mar '23

24 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32041 ) Change subject: [RFC] drop list of HNBAP UE Context ...................................................................... [RFC] drop list of HNBAP UE Context *Request for comments:* In previous patches, I have fixed some more ue_context leak situations. But since we don't really use ue_context for anything, we could also just drop this completely. On HNBAP UE Register, we collect the ue_contexts in a ue_list. But we never do anything with this list, at all. Furthermore, users are reporting the list of ue_context growing indefinitely. Simply drop the ue_context listing. Simply acknowledge all HNBAP UE Register and DeRegister requests without storing any context IDs. Change-Id: Ida7eadf36abcf465ae40003725c49e8e321a28c9 --- M include/osmocom/hnbgw/hnbgw.h M src/osmo-hnbgw/hnbgw.c M src/osmo-hnbgw/hnbgw_hnbap.c M src/osmo-hnbgw/hnbgw_vty.c 4 files changed, 32 insertions(+), 146 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/41/32041/1 diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index 1bf140a..e4f4f00 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -150,8 +150,6 @@ struct osmo_stream_srv_link *iuh; /* list of struct hnb_context */ struct llist_head hnb_list; - /* list of struct ue_context */ - struct llist_head ue_list; /* next availble UE Context ID */ uint32_t next_ue_ctx_id; struct ctrl_handle *ctrl; @@ -180,13 +178,6 @@ const char *hnb_context_name(struct hnb_context *ctx); unsigned hnb_contexts(const struct hnb_gw *gw); -struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id); -struct ue_context *ue_context_by_imsi(struct hnb_gw *gw, const char *imsi); -struct ue_context *ue_context_by_tmsi(struct hnb_gw *gw, uint32_t tmsi); -struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi, - uint32_t tmsi); -void ue_context_free(struct ue_context *ue); - struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd); void hnb_context_release(struct hnb_context *ctx); void hnb_context_release_ue_state(struct hnb_context *ctx); @@ -205,3 +196,5 @@ } struct msgb *hnbgw_ranap_msg_alloc(const char *name); + +uint32_t get_next_ue_ctx_id(struct hnb_gw *gw); diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 0624803..66df9bf 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -96,7 +96,6 @@ gw->next_ue_ctx_id = 23; INIT_LLIST_HEAD(&gw->hnb_list); - INIT_LLIST_HEAD(&gw->ue_list); gw->mgw_pool = mgcp_client_pool_alloc(gw); gw->config.mgcp_client = talloc_zero(tall_hnb_ctx, struct mgcp_client_conf); @@ -146,89 +145,9 @@ return num_ctx; } -struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id) +uint32_t get_next_ue_ctx_id(struct hnb_gw *gw) { - struct ue_context *ue; - - llist_for_each_entry(ue, &gw->ue_list, list) { - if (ue->context_id == id) - return ue; - } - return NULL; - -} - -struct ue_context *ue_context_by_imsi(struct hnb_gw *gw, const char *imsi) -{ - struct ue_context *ue; - - llist_for_each_entry(ue, &gw->ue_list, list) { - if (!strcmp(ue->imsi, imsi)) - return ue; - } - return NULL; -} - -struct ue_context *ue_context_by_tmsi(struct hnb_gw *gw, uint32_t tmsi) -{ - struct ue_context *ue; - - llist_for_each_entry(ue, &gw->ue_list, list) { - if (ue->tmsi == tmsi) - return ue; - } - return NULL; -} - -void ue_context_free_by_hnb(struct hnb_gw *gw, const struct hnb_context *hnb) -{ - struct ue_context *ue, *tmp; - - llist_for_each_entry_safe(ue, tmp, &gw->ue_list, list) { - if (ue->hnb == hnb) - ue_context_free(ue); - } -} - -static uint32_t get_next_ue_ctx_id(struct hnb_gw *gw) -{ - uint32_t id; - - do { - id = gw->next_ue_ctx_id++; - } while (ue_context_by_id(gw, id)); - - return id; -} - -struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi, - uint32_t tmsi) -{ - struct ue_context *ue; - - ue = talloc_zero(tall_hnb_ctx, struct ue_context); - if (!ue) - return NULL; - - ue->hnb = hnb; - if (imsi) - OSMO_STRLCPY_ARRAY(ue->imsi, imsi); - else - ue->imsi[0] = '\0'; - ue->tmsi = tmsi; - ue->context_id = get_next_ue_ctx_id(hnb->gw); - llist_add_tail(&ue->list, &hnb->gw->ue_list); - - LOGP(DHNBAP, LOGL_INFO, "created UE context: id 0x%x, imsi %s, tmsi 0x%x\n", - ue->context_id, imsi? imsi : "-", tmsi); - - return ue; -} - -void ue_context_free(struct ue_context *ue) -{ - llist_del(&ue->list); - talloc_free(ue); + return gw->next_ue_ctx_id++; } static int hnb_read_cb(struct osmo_stream_srv *conn) @@ -399,7 +318,6 @@ context_map_hnb_released(map); /* hnbgw_context_map will remove itself from lists when it is ready. */ } - ue_context_free_by_hnb(ctx->gw, ctx); } void hnb_context_release(struct hnb_context *ctx) diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c index a1cbec5..b39629e 100644 --- a/src/osmo-hnbgw/hnbgw_hnbap.c +++ b/src/osmo-hnbgw/hnbgw_hnbap.c @@ -125,7 +125,7 @@ } -static int hnbgw_tx_ue_register_acc(struct ue_context *ue) +static int hnbgw_tx_ue_register_acc(struct hnb_context *hnb, const char *imsi, uint32_t context_id) { HNBAP_UERegisterAccept_t accept_out; HNBAP_UERegisterAcceptIEs_t accept; @@ -136,13 +136,13 @@ int rc; encoded_imsi_len = ranap_imsi_encode(encoded_imsi, - sizeof(encoded_imsi), ue->imsi); + sizeof(encoded_imsi), imsi); memset(&accept, 0, sizeof(accept)); accept.uE_Identity.present = HNBAP_UE_Identity_PR_iMSI; OCTET_STRING_fromBuf(&accept.uE_Identity.choice.iMSI, (const char *)encoded_imsi, encoded_imsi_len); - asn1_u24_to_bitstring(&accept.context_ID, &ctx_id, ue->context_id); + asn1_u24_to_bitstring(&accept.context_ID, &ctx_id, context_id); memset(&accept_out, 0, sizeof(accept_out)); rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept); @@ -158,7 +158,7 @@ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_OCTET_STRING, &accept.uE_Identity.choice.iMSI); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBAP_UERegisterAccept, &accept_out); - return hnbgw_hnbap_tx(ue->hnb, msg); + return hnbgw_hnbap_tx(hnb, msg); } static int hnbgw_tx_ue_register_rej_tmsi(struct hnb_context *hnb, HNBAP_UE_Identity_t *ue_id) @@ -283,8 +283,6 @@ struct msgb *msg; uint32_t ctx_id; uint32_t tmsi = 0; - struct ue_context *ue; - struct ue_context *ue_allocated = NULL; int rc; memset(&accept, 0, sizeof(accept)); @@ -330,21 +328,12 @@ tmsi = ntohl(tmsi); LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "HNBAP register with TMSI %x\n", tmsi); - ue = ue_context_by_tmsi(hnb->gw, tmsi); - if (!ue) - ue = ue_allocated = ue_context_alloc(hnb, NULL, tmsi); - - asn1_u24_to_bitstring(&accept.context_ID, &ctx_id, ue->context_id); + asn1_u24_to_bitstring(&accept.context_ID, &ctx_id, get_next_ue_ctx_id(hnb->gw)); memset(&accept_out, 0, sizeof(accept_out)); rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept); - if (rc < 0) { - /* If we allocated the UE context but the UE REGISTER fails, get rid of it again: there will likely - * never be a UE DE-REGISTER for this UE from the HNB, and the ue_context would linger forever. */ - if (ue_allocated) - ue_context_free(ue_allocated); + if (rc < 0) return rc; - } msg = hnbap_generate_successful_outcome(HNBAP_ProcedureCode_id_UERegister, HNBAP_Criticality_reject, @@ -486,8 +475,6 @@ static int hnbgw_rx_ue_register_req(struct hnb_context *ctx, ANY_t *in) { HNBAP_UERegisterRequestIEs_t ies; - struct ue_context *ue; - struct ue_context *ue_allocated = NULL; char imsi[16]; int rc; @@ -527,26 +514,15 @@ LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "UE-REGISTER-REQ ID_type=%d imsi=%s cause=%ld\n", ies.uE_Identity.present, imsi, ies.registration_Cause); - ue = ue_context_by_imsi(ctx->gw, imsi); - if (!ue) - ue = ue_allocated = ue_context_alloc(ctx, imsi, 0); - hnbap_free_ueregisterrequesties(&ies); /* Send UERegisterAccept */ - rc = hnbgw_tx_ue_register_acc(ue); - if (rc < 0) { - /* If we allocated the UE context but the UE REGISTER fails, get rid of it again: there will likely - * never be a UE DE-REGISTER for this UE from the HNB, and the ue_context would linger forever. */ - if (ue_allocated) - ue_context_free(ue_allocated); - } + rc = hnbgw_tx_ue_register_acc(ctx, imsi, get_next_ue_ctx_id(ctx->gw)); return rc; } static int hnbgw_rx_ue_deregister(struct hnb_context *ctx, ANY_t *in) { HNBAP_UEDe_RegisterIEs_t ies; - struct ue_context *ue; int rc; uint32_t ctxid; @@ -558,10 +534,6 @@ LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "UE-DE-REGISTER context=%u cause=%s\n", ctxid, hnbap_cause_str(&ies.cause)); - ue = ue_context_by_id(ctx->gw, ctxid); - if (ue) - ue_context_free(ue); - hnbap_free_uede_registeries(&ies); return 0; } diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c index 8d2366f..9786b9b 100644 --- a/src/osmo-hnbgw/hnbgw_vty.c +++ b/src/osmo-hnbgw/hnbgw_vty.c @@ -215,12 +215,6 @@ vty_dump_hnb_info__map_states(vty, "IuPS", map_count[1], state_count[1]); } -static void vty_dump_ue_info(struct vty *vty, struct ue_context *ue) -{ - vty_out(vty, "UE IMSI \"%s\" context ID %u HNB %s%s", ue->imsi, ue->context_id, - hnb_context_name(ue->hnb), VTY_NEWLINE); -} - DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information about all HNB") { struct hnb_context *hnb; @@ -261,17 +255,6 @@ return CMD_SUCCESS; } -DEFUN(show_ue, show_ue_cmd, "show ue all", SHOW_STR "Display information about a UE") -{ - struct ue_context *ue; - - llist_for_each_entry(ue, &g_hnb_gw->ue_list, list) { - vty_dump_ue_info(vty, ue); - } - - return CMD_SUCCESS; -} - DEFUN(show_talloc, show_talloc_cmd, "show talloc", SHOW_STR "Display talloc info") { talloc_report_full(tall_hnb_ctx, stderr); @@ -509,7 +492,6 @@ install_element_ve(&show_cnlink_cmd); install_element_ve(&show_hnb_cmd); install_element_ve(&show_one_hnb_cmd); - install_element_ve(&show_ue_cmd); install_element_ve(&show_talloc_cmd); install_element(HNBGW_NODE, &cfg_hnbgw_mgcp_cmd); -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32041 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ida7eadf36abcf465ae40003725c49e8e321a28c9 Gerrit-Change-Number: 32041 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • ...
  • 365
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.