aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-06-12 11:39:41 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-07-25 15:14:13 +0200
commitd4d44cacbc5bbdb569913ab0a2ab747ceb4774d7 (patch)
tree7540cc3a026069ac854101d5f4a49ab5895532c0 /src/libmsc
parent554488dee8682ef7325777aee9244a345eb92336 (diff)
mgcp: Make sure endpoint is free on CRCX
The MSC is aware of the assigned endpoints at all times, so it will not assign an occupied endpoint to someone else. However, if it has just restarted, there maybe lingering open endpoints. This patch introduces a fairly simple soultion. Before a new endpoint is seized (CRCX), a DLCX is send in advance. If the endpoint was still occupied with a dead connection, it will be freed. If it was free anyway, the DLCX will just have no effect. Change-Id: I7990e9e7c4c8101b8772ab5505a7cc11f8f7cd23
Diffstat (limited to 'src/libmsc')
-rw-r--r--src/libmsc/msc_ifaces.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libmsc/msc_ifaces.c b/src/libmsc/msc_ifaces.c
index 20bf9921a..f12402604 100644
--- a/src/libmsc/msc_ifaces.c
+++ b/src/libmsc/msc_ifaces.c
@@ -193,6 +193,7 @@ static int conn_iu_rab_act_cs(struct gsm_trans *trans)
struct gsm_subscriber_connection *conn = trans->conn;
struct mgcpgw_client *mgcp = conn->network->mgcpgw.client;
struct msgb *msg;
+ struct msgb *msg_dlcx;
/* HACK. where to scope the RAB Id? At the conn / subscriber /
* ue_conn_ctx? */
@@ -205,6 +206,16 @@ static int conn_iu_rab_act_cs(struct gsm_trans *trans)
* and config. */
conn->iu.mgcp_rtp_port_ue = 4000 + 2 * conn->iu.mgcp_rtp_endpoint;
+ /* Since we know now the endpoint number, we enforce a DLCX on tha
+ * endpoint in order to ensure that this endpoint is not occupied
+ * with some old connection that was not properly cleared during
+ * some crash or restart event */
+ msg_dlcx = mgcp_msg_dlcx(mgcp, conn->iu.mgcp_rtp_endpoint);
+ if (mgcpgw_client_tx(mgcp, msg_dlcx, NULL, NULL))
+ LOGP(DMGCP, LOGL_ERROR,
+ "Failed to send DLCX message for %s\n",
+ vlr_subscr_name(trans->vsub));
+
/* Establish the RTP stream first as looping back to the originator.
* The MDCX will patch through to the counterpart. TODO: play a ring
* tone instead. */