diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2019-04-27 19:09:14 +0200 |
---|---|---|
committer | neels <nhofmeyr@sysmocom.de> | 2019-08-28 21:22:45 +0000 |
commit | 5e19b9a0bf5846af427df76ce737e2949333a594 (patch) | |
tree | 6c5c17066ec75364b88e59d271941f428494a90d /src/libmsc | |
parent | 4aeb4ec18269089ef3915e0f25f5aade81fe4038 (diff) |
mncc: send payload type matching chosen codec
Change-Id: Id32f32d77d24b753adb96b5393c0363439e312c2
Diffstat (limited to 'src/libmsc')
-rw-r--r-- | src/libmsc/gsm_04_08_cc.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c index 34d95f6d5..f974e901e 100644 --- a/src/libmsc/gsm_04_08_cc.c +++ b/src/libmsc/gsm_04_08_cc.c @@ -30,6 +30,8 @@ #include <regex.h> #include <sys/types.h> +#include <osmocom/mgcp_client/mgcp_client_endpoint_fsm.h> + #include <osmocom/msc/db.h> #include <osmocom/msc/debug.h> #include <osmocom/msc/gsm_data.h> @@ -1667,18 +1669,28 @@ int gsm48_tch_rtp_create(struct gsm_trans *trans) struct gsm_network *net = msc_a_net(msc_a); struct call_leg *cl = msc_a->cc.call_leg; struct osmo_sockaddr_str *rtp_cn_local; - /* FIXME: This has to be set to some meaningful value, - * before the MSC-Split, this value was pulled from - * lchan->abis_ip.rtp_payload */ - uint32_t payload_type = 0; - int msg_type; - - /* FIXME This has to be set to some meaningful value. - * Possible options are: - * GSM_TCHF_FRAME, GSM_TCHF_FRAME_EFR, - * GSM_TCHH_FRAME, GSM_TCH_FRAME_AMR - * (0 if unknown) */ - msg_type = GSM_TCHF_FRAME; + 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; + + 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->codec_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 */ + payload_msg_type = mgcp_codec_to_mncc_payload_msg_type(rtp_cn->codec); + + /* Payload Type number */ + mgcp_info = osmo_mgcpc_ep_ci_get_rtp_info(rtp_cn->ci); + payload_type = map_codec_to_pt(mgcp_info->ptmap, mgcp_info->ptmap_len, rtp_cn->codec); rtp_cn_local = call_leg_local_ip(cl, RTP_TO_CN); if (!rtp_cn_local) { @@ -1686,7 +1698,7 @@ int gsm48_tch_rtp_create(struct gsm_trans *trans) return -EINVAL; } - return mncc_recv_rtp(net, trans, trans->callref, MNCC_RTP_CREATE, rtp_cn_local, payload_type, msg_type); + return mncc_recv_rtp(net, trans, trans->callref, MNCC_RTP_CREATE, rtp_cn_local, payload_type, payload_msg_type); } static int tch_rtp_connect(struct gsm_network *net, const struct gsm_mncc_rtp *rtp) |