pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39754?usp=email )
Change subject: mgw: CRCX: Handle codec information before initializing osmux ......................................................................
mgw: CRCX: Handle codec information before initializing osmux
Same order as done during MDCX. This way we can also eg. check configured codec is AMR before successfully entering configuring osmux.
Change-Id: If291db0c048196e6e0eee2c38e648e5a25438078 --- M src/libosmo-mgcp/mgcp_protocol.c 1 file changed, 10 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/54/39754/1
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c index 237f2bf..ef82796 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -768,6 +768,15 @@ conn_rtp = mgcp_conn_get_conn_rtp(conn); OSMO_ASSERT(conn_rtp);
+ /* Handle codec information and decide for a suitable codec */ + rc = handle_codec_info(conn_rtp, rq); + mgcp_codecset_summary(&conn_rtp->end.cset, mgcp_conn_dump(conn)); + if (rc) { + error_code = rc; + rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_CODEC_NEGOTIATION)); + goto error2; + } + /* If X-Osmux (remote CID) was received, alloc next avail CID as local CID */ if (hpars->remote_osmux_cid != MGCP_PARSE_HDR_PARS_OSMUX_CID_UNSET) { /* Make sure osmux is setup: */ @@ -785,14 +794,6 @@ } /* else: -1 (wildcard) */ }
- /* Handle codec information and decide for a suitable codec */ - rc = handle_codec_info(conn_rtp, rq); - mgcp_codecset_summary(&conn_rtp->end.cset, mgcp_conn_dump(conn)); - if (rc) { - error_code = rc; - rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_CODEC_NEGOTIATION)); - goto error2; - } /* Upgrade the conn type RTP_DEFAULT->RTP_IUUP if needed based on requested codec: */ if (conn_rtp->type == MGCP_RTP_DEFAULT && strcmp(conn_rtp->end.cset.codec->subtype_name, "VND.3GPP.IUFP") == 0) { @@ -1017,6 +1018,7 @@ error_code = rc; goto error3; } + /* Upgrade the conn type RTP_DEFAULT->RTP_IUUP if needed based on requested codec: */ if (conn_rtp->type == MGCP_RTP_DEFAULT && strcmp(conn_rtp->end.cset.codec->subtype_name, "VND.3GPP.IUFP") == 0)