diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2017-06-08 15:36:14 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-06-18 17:50:09 +0200 |
commit | 9b5dee4e33fc432898ecfe490e28e0748dea83c9 (patch) | |
tree | 098cd84bbf8f852771da551a32acdd35cb142095 /openbsc/src/libmsc | |
parent | 21521acd3f9147db01fde7729181c26769efdc77 (diff) |
mgcp: make sure all endpoints are closed on startup
If the MSC is crashing and restarting, it may leave some endpoints
open. The endpoints can not be re-used until they are deleted
(DLCX). This patch sends a DLCX to all possible endpoints (usually
this is in a countable range) in order to clear possible open
endpoints from a previous run
Diffstat (limited to 'openbsc/src/libmsc')
-rw-r--r-- | openbsc/src/libmsc/msc_ifaces.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/msc_ifaces.c b/openbsc/src/libmsc/msc_ifaces.c index 9533ddecd..43959c13f 100644 --- a/openbsc/src/libmsc/msc_ifaces.c +++ b/openbsc/src/libmsc/msc_ifaces.c @@ -345,3 +345,21 @@ void msc_call_release(struct gsm_trans *trans) /* Release endpoint id */ mgcpgw_client_release_endpoint(conn->iu.mgcp_rtp_endpoint, mgcp); } + +void msc_call_release_all(struct mgcpgw_client *mgcp) +{ + struct msgb *msg; + unsigned int i; + + uint16_t first_endpoint = mgcp->actual.first_endpoint; + uint16_t last_endpoint = mgcp->actual.last_endpoint; + + for (i = first_endpoint; i < last_endpoint; i++) { + msg = mgcp_msg_dlcx(mgcp, i); + if (mgcpgw_client_tx(mgcp, msg, NULL, NULL)) + LOGP(DMGCP, LOGL_ERROR, + "Failed to send DLCX message for endpoint %u\n", i); + + mgcpgw_client_release_endpoint(i, mgcp); + } +} |