aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-11-22 13:26:03 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2017-12-01 13:36:30 +0100
commitfa85d18807452045a36fc3a80b7f35d5ba8422b8 (patch)
tree69f5473ba55460b5aed81521d8bd5bcee4fa887a /src
parent2c3bf454491762767a12ce39c7263df326363674 (diff)
mgcp: use mgw assigned connection identifiers
osmo-mgw assigns connection identifiers which are returned with the response to the CRCX. store the assigned connection identifiers and use them to identify the connections. Depends: osmo-mgw Iab6a6038e7610c62f34e642cd49c93d11151252c Closes: OS#2648 Change-Id: Ib379a6f40875bb8f2cf29038a5b5b7a40a21adab
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/osmo_bsc_mgcp.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/osmo-bsc/osmo_bsc_mgcp.c b/src/osmo-bsc/osmo_bsc_mgcp.c
index 0f35a46ac..a7d1f9455 100644
--- a/src/osmo-bsc/osmo_bsc_mgcp.c
+++ b/src/osmo-bsc/osmo_bsc_mgcp.c
@@ -31,9 +31,6 @@
#include <osmocom/core/byteswap.h>
#include <arpa/inet.h>
-#define CONN_ID_BTS 1
-#define CONN_ID_NET 2
-
#define MGCP_MGW_TIMEOUT 4 /* in seconds */
#define MGCP_MGW_TIMEOUT_TIMER_NR 1
#define MGCP_BSS_TIMEOUT 4 /* in seconds */
@@ -201,10 +198,8 @@ static void fsm_crcx_bts_cb(struct osmo_fsm_inst *fi, uint32_t event, void *data
/* Generate MGCP message string */
mgcp_msg = (struct mgcp_msg) {
.verb = MGCP_VERB_CRCX,
- .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_ID |
- MGCP_MSG_PRESENCE_CONN_MODE),
+ .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_MODE),
.call_id = conn->conn_id,
- .conn_id = CONN_ID_BTS,
.conn_mode = MGCP_CONN_LOOPBACK
};
if (snprintf(mgcp_msg.endpoint, MGCP_ENDPOINT_MAXLEN, MGCP_ENDPOINT_FORMAT, rtp_endpoint) >=
@@ -250,6 +245,10 @@ static void crcx_for_bts_resp_cb(struct mgcp_response *r, void *priv)
return;
}
+ /* memorize connection identifier */
+ osmo_strlcpy(mgcp_ctx->conn_id_bts, r->head.conn_id, sizeof(mgcp_ctx->conn_id_bts));
+ LOGPFSML(mgcp_ctx->fsm, LOGL_DEBUG, "CRCX/BTS: MGW responded with CI: %s\n", mgcp_ctx->conn_id_bts);
+
rc = mgcp_response_parse_params(r);
if (rc) {
LOGPFSML(mgcp_ctx->fsm, LOGL_ERROR, "CRCX/BTS: Cannot parse response\n");
@@ -364,7 +363,7 @@ static void fsm_mdcx_bts_cb(struct osmo_fsm_inst *fi, uint32_t event, void *data
.presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_ID |
MGCP_MSG_PRESENCE_CONN_MODE | MGCP_MSG_PRESENCE_AUDIO_IP | MGCP_MSG_PRESENCE_AUDIO_PORT),
.call_id = conn->conn_id,
- .conn_id = CONN_ID_BTS,
+ .conn_id = mgcp_ctx->conn_id_bts,
.conn_mode = MGCP_CONN_RECV_SEND,
.audio_ip = inet_ntoa(addr),
.audio_port = lchan->abis_ip.bound_port
@@ -484,10 +483,9 @@ static void fsm_crcx_net_cb(struct osmo_fsm_inst *fi, uint32_t event, void *data
/* Generate MGCP message string */
mgcp_msg = (struct mgcp_msg) {
.verb = MGCP_VERB_CRCX,
- .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_ID |
- MGCP_MSG_PRESENCE_CONN_MODE | MGCP_MSG_PRESENCE_AUDIO_IP | MGCP_MSG_PRESENCE_AUDIO_PORT),
+ .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_MODE |
+ MGCP_MSG_PRESENCE_AUDIO_IP | MGCP_MSG_PRESENCE_AUDIO_PORT),
.call_id = conn->conn_id,
- .conn_id = CONN_ID_NET,
.conn_mode = MGCP_CONN_RECV_SEND,
.audio_ip = addr,
.audio_port = port
@@ -539,6 +537,10 @@ static void crcx_for_net_resp_cb(struct mgcp_response *r, void *priv)
return;
}
+ /* memorize connection identifier */
+ osmo_strlcpy(mgcp_ctx->conn_id_net, r->head.conn_id, sizeof(mgcp_ctx->conn_id_net));
+ LOGPFSML(mgcp_ctx->fsm, LOGL_DEBUG, "CRCX/NET: MGW responded with CI: %s\n", mgcp_ctx->conn_id_net);
+
rc = mgcp_response_parse_params(r);
if (rc) {
LOGPFSML(mgcp_ctx->fsm, LOGL_ERROR, "CRCX/NET: Cannot parse CRCX response\n");
@@ -683,7 +685,8 @@ static void handle_handover(struct mgcp_ctx *mgcp_ctx)
.verb = MGCP_VERB_MDCX,
.presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_ID |
MGCP_MSG_PRESENCE_CONN_MODE | MGCP_MSG_PRESENCE_AUDIO_IP |
- MGCP_MSG_PRESENCE_AUDIO_PORT),.call_id = conn->conn_id,.conn_id = CONN_ID_BTS,
+ MGCP_MSG_PRESENCE_AUDIO_PORT),.call_id = conn->conn_id,
+ .conn_id = mgcp_ctx->conn_id_bts,
.conn_mode = MGCP_CONN_RECV_SEND,
.audio_ip = inet_ntoa(addr),
.audio_port = ho_lchan->abis_ip.bound_port};