Change in osmo-bsc[master]: gscon: pick suitable payload type / encoding name for MGCP

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jun 25 19:54:28 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9738 )

Change subject: gscon: pick suitable payload type / encoding name for MGCP
......................................................................

gscon: pick suitable payload type / encoding name for MGCP

The GSCON FSM does not care about the codec information when performing
interactions with the MGW. Before upgrading the client the codec
information was hardcoded to AMR inside the client. Now the client
offers APIs to set the codec information. Since this feature is new,
osmo-bsc does not set any codec information yet, which causes many of
the TTCN3 tests to fail. So lets add some logic to pick suitable codec
info.

- Hardcode ptime to 20 (is the same for all possible codecs)
- Select a codec according to the flags in userplane

Change-Id: Ibddc3492572b39f166e3a1b8b8120813ce2dadc2
Related: OS#2728
---
M src/osmo-bsc/bsc_subscr_conn_fsm.c
1 file changed, 34 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 4f09ae6..0f3d9d2 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -120,6 +120,32 @@
 	{0, NULL}
 };
 
+/* Depending on the channel mode and rate, set the codec type that is signalled
+ * towards the MGW. */
+static void mgcp_pick_codec(struct gsm_subscriber_connection *conn,
+			    struct mgcp_conn_peer *conn_peer)
+{
+	switch (conn->user_plane.chan_mode) {
+	case GSM48_CMODE_SPEECH_V1:
+		if (conn->user_plane.full_rate)
+			conn_peer->codecs[0] = CODEC_GSM_8000_1;
+		else
+			conn_peer->codecs[0] = CODEC_GSMHR_8000_1;
+		conn_peer->codecs_len = 1;
+		break;
+	case GSM48_CMODE_SPEECH_EFR:
+		conn_peer->codecs[0] = CODEC_GSMEFR_8000_1;
+		conn_peer->codecs_len = 1;
+		break;
+	case GSM48_CMODE_SPEECH_AMR:
+		conn_peer->codecs[0] = CODEC_AMR_8000_1;
+		conn_peer->codecs_len = 1;
+		break;
+	default:
+		conn_peer->codecs_len = 0;
+	}
+}
+
 /* Send data SCCP message through SCCP connection. All sigtran messages
  * that are send from this FSM must use this function. Never use
  * osmo_bsc_sigtran_send() directly since this would defeat the checks
@@ -414,7 +440,9 @@
 			/* A voice channel is requested, so we run down the
 			 * mgcp-ass-mgcp state-chain (see FIXME above) */
 			memset(&conn_peer, 0, sizeof(conn_peer));
+			mgcp_pick_codec(conn, &conn_peer);
 			conn_peer.call_id = conn->sccp.conn_id;
+			conn_peer.ptime = 20;
 			osmo_strlcpy(conn_peer.endpoint, get_mgw_ep_name(conn), sizeof(conn_peer.endpoint));
 
 			/* (Pre)Change state and create the connection */
@@ -572,9 +600,11 @@
 
 			/* Prepare parameters with the information we got during the assignment */
 			memset(&conn_peer, 0, sizeof(conn_peer));
+			mgcp_pick_codec(conn, &conn_peer);
 			addr.s_addr = osmo_ntohl(lchan->abis_ip.bound_ip);
 			osmo_strlcpy(conn_peer.addr, inet_ntoa(addr), sizeof(conn_peer.addr));
 			conn_peer.port = lchan->abis_ip.bound_port;
+			conn_peer.ptime = 20;
 
 			/* (Pre)Change state and modify the connection */
 			osmo_fsm_inst_state_chg(fi, ST_WAIT_MDCX_BTS, MGCP_MGW_TIMEOUT, MGCP_MGW_TIMEOUT_TIMER_NR);
@@ -637,10 +667,12 @@
 		/* Prepare parameters with the connection information we got
 		 * with the assignment command */
 		memset(&conn_peer, 0, sizeof(conn_peer));
+		mgcp_pick_codec(conn, &conn_peer);
 		conn_peer.call_id = conn->sccp.conn_id;
 		sin = (struct sockaddr_in *)&conn->user_plane.aoip_rtp_addr_remote;
 		conn_peer.port = osmo_ntohs(sin->sin_port);
 		osmo_strlcpy(conn_peer.addr, inet_ntoa(sin->sin_addr), sizeof(conn_peer.addr));
+		conn_peer.ptime = 20;
 
 		/* Make sure we use the same endpoint where we created the
 		 * BTS connection. */
@@ -760,9 +792,11 @@
 		/* Prepare parameters with the information we got during the
 		 * handover procedure (via IPACC) */
 		memset(&conn_peer, 0, sizeof(conn_peer));
+		mgcp_pick_codec(conn, &conn_peer);
 		addr.s_addr = osmo_ntohl(lchan->abis_ip.bound_ip);
 		osmo_strlcpy(conn_peer.addr, inet_ntoa(addr), sizeof(conn_peer.addr));
 		conn_peer.port = lchan->abis_ip.bound_port;
+		conn_peer.ptime = 20;
 
 		/* (Pre)Change state and modify the connection */
 		osmo_fsm_inst_state_chg(fi, ST_WAIT_MDCX_BTS_HO, MGCP_MGW_TIMEOUT, MGCP_MGW_HO_TIMEOUT_TIMER_NR);

-- 
To view, visit https://gerrit.osmocom.org/9738
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibddc3492572b39f166e3a1b8b8120813ce2dadc2
Gerrit-Change-Number: 9738
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180625/a310e40e/attachment.htm>


More information about the gerrit-log mailing list