Harald Welte has submitted this change and it was merged. Change subject: mgcp: use mgw assigned connection identifiers ......................................................................
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 --- M include/osmocom/bsc/osmo_bsc_mgcp.h M src/osmo-bsc/osmo_bsc_mgcp.c 2 files changed, 20 insertions(+), 11 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/osmo_bsc_mgcp.h b/include/osmocom/bsc/osmo_bsc_mgcp.h index dd26d40..df18524 100644 --- a/include/osmocom/bsc/osmo_bsc_mgcp.h +++ b/include/osmocom/bsc/osmo_bsc_mgcp.h @@ -20,6 +20,8 @@ #pragma once +#include <osmocom/mgcp_client/mgcp_common.h> + /* MGCP state handler context (fsm etc..) */ struct mgcp_ctx { /* FSM instance, which handles the connection switching procedure */ @@ -28,6 +30,10 @@ /* RTP endpoint number */ uint16_t rtp_endpoint; + /* RTP connection identifiers */ + char conn_id_bts[MGCP_CONN_ID_LENGTH]; + char conn_id_net[MGCP_CONN_ID_LENGTH]; + /* Copy of the pointer and the data with context information * needed to process the AoIP and MGCP requests (system data) */ struct mgcp_client *mgcp; diff --git a/src/osmo-bsc/osmo_bsc_mgcp.c b/src/osmo-bsc/osmo_bsc_mgcp.c index 0f35a46..a7d1f94 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 @@ /* 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) >= @@ -249,6 +244,10 @@ handle_error(mgcp_ctx, MGCP_ERR_MGW_FAIL); 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) { @@ -364,7 +363,7 @@ .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 @@ /* 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 @@ -538,6 +536,10 @@ handle_error(mgcp_ctx, MGCP_ERR_MGW_FAIL); 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) { @@ -683,7 +685,8 @@ .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}; -- To view, visit https://gerrit.osmocom.org/4964 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib379a6f40875bb8f2cf29038a5b5b7a40a21adab Gerrit-PatchSet: 5 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: dexter <pma...@sysmocom.de> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder