diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-12-11 18:59:27 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-12-11 19:52:30 +0100 |
commit | 85cb2538f4cb4c6759824dae546564562ff3888e (patch) | |
tree | 516c398bd422758921cba66f847183f753df2640 /src/libmsc/a_iface_bssap.c | |
parent | 36dedeeb12f733c4f569e3d05ba25537dee66d99 (diff) |
Revert "move ASS-COMPL MGCP handling out of a_iface_bssap.c"
Two reasons:
- the caller of msc_mgcp_ass_complete() from Iu, iucs_rx_rab_assign(), failed
to be adjusted, breaking IuCS, as an --enable-iu --enable-werror build shows.
Unfortunately our gerrit verification doesn't --enable-werror for osmo-msc.
- the condition of requiring ST_MDCX_RAN is faulty, breaking GSM CS.
This reverts commit 212c0c9bdaf1166e3bcbab85f3ab31dc17162f5b.
Change-Id: I8348675c2f7c8856ea1682d05ee54160d4cfeb96
Diffstat (limited to 'src/libmsc/a_iface_bssap.c')
-rw-r--r-- | src/libmsc/a_iface_bssap.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c index 4e8b1468d..d84a2346b 100644 --- a/src/libmsc/a_iface_bssap.c +++ b/src/libmsc/a_iface_bssap.c @@ -34,6 +34,7 @@ #include <osmocom/core/byteswap.h> #include <osmocom/msc/a_reset.h> #include <osmocom/msc/transaction.h> +#include <osmocom/msc/msc_mgcp.h> #include <errno.h> @@ -497,12 +498,51 @@ static int bssmap_rx_sapi_n_rej(struct ran_conn *conn, struct msgb *msg, return 0; } +/* Use the speech codec info we go with the assignment complete to dtermine + * which codec we will signal to the MGW */ +static enum mgcp_codecs mgcp_codec_from_sc(struct gsm0808_speech_codec *sc) +{ + switch (sc->type) { + case GSM0808_SCT_FR1: + return CODEC_GSM_8000_1; + break; + case GSM0808_SCT_FR2: + return CODEC_GSMEFR_8000_1; + break; + case GSM0808_SCT_FR3: + return CODEC_AMR_8000_1; + break; + case GSM0808_SCT_FR4: + return CODEC_AMRWB_16000_1; + break; + case GSM0808_SCT_FR5: + return CODEC_AMRWB_16000_1; + break; + case GSM0808_SCT_HR1: + return CODEC_GSMHR_8000_1; + break; + case GSM0808_SCT_HR3: + return CODEC_AMR_8000_1; + break; + case GSM0808_SCT_HR4: + return CODEC_AMRWB_16000_1; + break; + case GSM0808_SCT_HR6: + return CODEC_AMRWB_16000_1; + break; + default: + return CODEC_PCMU_8000_1; + break; + } +} + /* Endpoint to handle assignment complete */ static int bssmap_rx_ass_compl(struct ran_conn *conn, struct msgb *msg, struct tlv_parsed *tp) { struct sockaddr_storage rtp_addr; struct gsm0808_speech_codec sc; + struct sockaddr_in *rtp_addr_in; int rc; LOGPCONN(conn, LOGL_INFO, "Rx BSSMAP ASSIGNMENT COMPLETE message\n"); @@ -527,8 +567,18 @@ static int bssmap_rx_ass_compl(struct ran_conn *conn, struct msgb *msg, LOGPCONN(conn, LOGL_ERROR, "Unable to decode speech codec (choosen).\n"); return -EINVAL; } + conn->rtp.codec_ran = mgcp_codec_from_sc(&sc); + + /* use address / port supplied with the AoIP + * transport address element */ + if (rtp_addr.ss_family == AF_INET) { + rtp_addr_in = (struct sockaddr_in *)&rtp_addr; + msc_mgcp_ass_complete(conn, osmo_ntohs(rtp_addr_in->sin_port), inet_ntoa(rtp_addr_in->sin_addr)); + } else { + LOGPCONN(conn, LOGL_ERROR, "Unsopported addressing scheme. (supports only IPV4)\n"); + return -EINVAL; + } - ran_conn_assign_compl(conn, &sc, &rtp_addr); return 0; } |