aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libmsc/gsm_04_08_cc.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index 6f511dcc3..39cac0262 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)
@@ -2177,8 +2190,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 */
@@ -2201,6 +2214,32 @@ static int tch_rtp_connect(struct gsm_network *net, const struct gsm_mncc_rtp *r
cl = trans->msc_a->cc.call_leg;
rtps = cl ? cl->rtp[RTP_TO_CN] : NULL;
+
+ if (!rtps) {
+ LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "RTP connect for trans without ongoing call\n");
+ mncc_recv_rtp_err(net, trans, rtp->callref, MNCC_RTP_CONNECT);
+ return -EINVAL;
+ }
+
+ rx_mncc_sdp(trans, rtp->msg_type, rtp->sdp, NULL);
+ 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 (rtps && !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;