[PATCH] osmo-bsc[master]: mgcp: use mgw assigned connection identifiers

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Wed Nov 22 12:28:50 UTC 2017


Review at  https://gerrit.osmocom.org/4964

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

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/64/4964/1

diff --git a/include/osmocom/bsc/osmo_bsc_mgcp.h b/include/osmocom/bsc/osmo_bsc_mgcp.h
index dd26d40..e3b77bf 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_MAXLEN];
+	char conn_id_net[MGCP_CONN_ID_MAXLEN];
+
 	/* 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 f0c31df..9025f34 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 */
+	strncpy(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 */
+	strncpy(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: newchange
Gerrit-Change-Id: Ib379a6f40875bb8f2cf29038a5b5b7a40a21adab
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list