aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Whyte <keith@rhizomatica.org>2022-10-15 01:32:02 +0100
committerKeith Whyte <keith@rhizomatica.org>2023-11-23 22:05:41 +0000
commit0d640d926687e55e1099e4cb7745c2717e19317e (patch)
tree74dfa9a72444a53b1593566603c046f32155b422
parentc2f913392f51355b5ae44bb941c6b2c13742f224 (diff)
send lcls conn-ctrl according to SDP media addresses
Detect if a SIP UE (probably a pbx) is re-INVITING itself out of the audio loop by checking the media endpoint ip/port. If thr PBX is going out of the Loop, send LCLS CONNECT, otherwise, RELEASE Change-Id: I83e1ff7c1523b6c6e53ee37a1b3967cd0dc194e1
-rw-r--r--src/libmsc/gsm_04_08_cc.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index c1777739b..a4c2ba258 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -186,6 +186,19 @@ static void count_statistics(struct gsm_trans *trans, int new_state)
}
}
+void update_lcls(struct gsm_trans *trans) {
+ struct ran_msg msg;
+
+ if (!trans->cc.lcls)
+ return;
+ msg = (struct ran_msg){
+ .msg_type = RAN_MSG_LCLS_CONNECT_CTRL,
+ .lcls_config_ctrl.config = trans->cc.lcls->config,
+ .lcls_config_ctrl.control = trans->cc.lcls->control,
+ };
+ msc_a_ran_down(trans->msc_a, MSC_ROLE_I, &msg);
+}
+
static void new_cc_state(struct gsm_trans *trans, int state)
{
if (state > 31 || state < 0)
@@ -2113,8 +2126,8 @@ int gsm48_tch_rtp_create(struct gsm_trans *trans)
static int tch_rtp_connect(struct gsm_network *net, const struct gsm_mncc_rtp *rtp)
{
- struct gsm_trans *trans;
- struct call_leg *cl;
+ struct gsm_trans *trans, *trans_other;
+ struct call_leg *cl, *ol;
struct rtp_stream *rtps;
/* Find callref */
@@ -2145,6 +2158,22 @@ static int tch_rtp_connect(struct gsm_network *net, const struct gsm_mncc_rtp *r
rx_mncc_sdp(trans, rtp->msg_type, rtp->sdp);
rtp_stream_set_remote_addr_and_codecs(rtps, &trans->cc.remote);
+ trans_other = trans_find_by_same_gcr(net, trans);
+ if (trans_other && rtp->sdp[0]) {
+ ol = trans_other->msc_a->cc.call_leg;
+ if (!strcmp(ol->rtp[RTP_TO_CN]->local.ip, trans->cc.remote.rtp.ip) &&
+ ol->rtp[RTP_TO_CN]->local.port == trans->cc.remote.rtp.port)
+ {
+ LOG_TRANS_CAT(trans, DMNCC, LOGL_DEBUG, "MNCC Wants out of the Loop.\n");
+ trans->cc.lcls->control = GSM0808_LCLS_CSC_CONNECT;
+ update_lcls(trans);
+ } else {
+ LOG_TRANS_CAT(trans, DMNCC, LOGL_DEBUG, "MNCC Wants into the Loop.\n");
+ trans->cc.lcls->control = GSM0808_LCLS_CSC_RELEASE_LCLS;
+ update_lcls(trans);
+ }
+ }
+
if (!osmo_sockaddr_str_is_nonzero(&rtps->remote)) {
/* Didn't get an IP address from SDP. Try legacy MNCC IP address */
struct osmo_sockaddr_str rtp_addr;