Change in osmo-bsc[master]: gscon: use BSS-common payload types on BSS side

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
Thu Jul 26 15:11:35 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/10173


Change subject: gscon: use BSS-common payload types on BSS side
......................................................................

gscon: use BSS-common payload types on BSS side

In cases where a codec has no fixed (IANA) payload type number, a
dynamically coosen payload type number is used. For the route between
BSC and MSC IANA as designated certain payload type numbers. However,
beond those payload type numbers may not necessarly apply. The RTP
communication between BTS and BSC still might run on a completely
different payload type number.

libosmo-netif contains a header file which payload type numbers shall be
used. Lets use those in order to signal the same payload type numbers as
we actually use in the RTP packets to the MGW.

Change-Id: I3373876bf5430130c6509be08b5f08e724c57c7a
Depends: osmo-mgw If176a3719dd9e888da16196d5fc0bdb53cc2a5f2
Related: OS#2728
Related: OS#3384
---
M include/osmocom/bsc/bsc_subscr_conn_fsm.h
M src/osmo-bsc/bsc_subscr_conn_fsm.c
M src/osmo-bsc/osmo_bsc_lcls.c
3 files changed, 37 insertions(+), 8 deletions(-)



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

diff --git a/include/osmocom/bsc/bsc_subscr_conn_fsm.h b/include/osmocom/bsc/bsc_subscr_conn_fsm.h
index 9e56f6b..e458d7a 100644
--- a/include/osmocom/bsc/bsc_subscr_conn_fsm.h
+++ b/include/osmocom/bsc/bsc_subscr_conn_fsm.h
@@ -71,4 +71,4 @@
 /* Allocate a subscriber connection and its associated FSM */
 struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net);
 
-void bsc_subscr_pick_codec(struct mgcp_conn_peer *conn_peer, struct gsm_subscriber_connection *conn);
+void bsc_subscr_pick_codec(struct mgcp_conn_peer *conn_peer, struct gsm_subscriber_connection *conn, bool bss_side);
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 66cdbba..b239fd0 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -36,6 +36,7 @@
 #include <osmocom/bsc/penalty_timers.h>
 #include <osmocom/mgcp_client/mgcp_client_fsm.h>
 #include <osmocom/core/byteswap.h>
+#include <osmocom/netif/rtp.h>
 
 #define S(x)	(1 << (x))
 
@@ -122,8 +123,10 @@
 
 /* Depending on the channel mode and rate, set the codec type that is signalled
  * towards the MGW. */
-void bsc_subscr_pick_codec(struct mgcp_conn_peer *conn_peer, struct gsm_subscriber_connection *conn)
+void bsc_subscr_pick_codec(struct mgcp_conn_peer *conn_peer, struct gsm_subscriber_connection *conn, bool bss_side)
 {
+	/* Set up codec configuration */
+	conn_peer->codecs_len = 0;
 	switch (conn->user_plane.chan_mode) {
 	case GSM48_CMODE_SPEECH_V1:
 		if (conn->user_plane.full_rate)
@@ -143,6 +146,32 @@
 	default:
 		conn_peer->codecs_len = 0;
 	}
+
+	/* Setup custom payload types (only for BSS side) */
+	conn_peer->ptmap_len = 0;
+	if (bss_side) {
+		switch (conn->user_plane.chan_mode) {
+		case GSM48_CMODE_SPEECH_V1:
+			if (!conn->user_plane.full_rate) {
+				conn_peer->ptmap[0].codec = CODEC_GSMHR_8000_1;
+				conn_peer->ptmap[0].pt = RTP_PT_GSM_HALF;
+			}
+			conn_peer->ptmap_len = 1;
+			break;
+		case GSM48_CMODE_SPEECH_EFR:
+			conn_peer->ptmap[0].codec = CODEC_GSMEFR_8000_1;
+			conn_peer->ptmap[0].pt = RTP_PT_GSM_EFR;
+			conn_peer->ptmap_len = 1;
+			break;
+		case GSM48_CMODE_SPEECH_AMR:
+			conn_peer->ptmap[0].codec = CODEC_AMR_8000_1;
+			conn_peer->ptmap[0].pt = RTP_PT_AMR;
+			conn_peer->ptmap_len = 1;
+			break;
+		default:
+			conn_peer->ptmap_len = 0;
+		}
+	}
 }
 
 /* Send data SCCP message through SCCP connection. All sigtran messages
@@ -439,7 +468,7 @@
 			/* 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));
-			bsc_subscr_pick_codec(&conn_peer, conn);
+			bsc_subscr_pick_codec(&conn_peer, conn, true);
 			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));
@@ -599,7 +628,7 @@
 
 			/* Prepare parameters with the information we got during the assignment */
 			memset(&conn_peer, 0, sizeof(conn_peer));
-			bsc_subscr_pick_codec(&conn_peer, conn);
+			bsc_subscr_pick_codec(&conn_peer, conn, true);
 			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;
@@ -666,7 +695,7 @@
 		/* Prepare parameters with the connection information we got
 		 * with the assignment command */
 		memset(&conn_peer, 0, sizeof(conn_peer));
-		bsc_subscr_pick_codec(&conn_peer, conn);
+		bsc_subscr_pick_codec(&conn_peer, conn, false);
 		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);
@@ -791,7 +820,7 @@
 		/* Prepare parameters with the information we got during the
 		 * handover procedure (via IPACC) */
 		memset(&conn_peer, 0, sizeof(conn_peer));
-		bsc_subscr_pick_codec(&conn_peer, conn);
+		bsc_subscr_pick_codec(&conn_peer, conn, true);
 		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;
diff --git a/src/osmo-bsc/osmo_bsc_lcls.c b/src/osmo-bsc/osmo_bsc_lcls.c
index b197e66..8d990a9 100644
--- a/src/osmo-bsc/osmo_bsc_lcls.c
+++ b/src/osmo-bsc/osmo_bsc_lcls.c
@@ -244,7 +244,7 @@
 	memset(&peer, 0, sizeof(peer));
 	peer.port = htons(sin->sin_port);
 	osmo_strlcpy(peer.addr, inet_ntoa(sin->sin_addr), sizeof(peer.addr));
-	bsc_subscr_pick_codec(&peer, conn);
+	bsc_subscr_pick_codec(&peer, conn, false);
 	mgcp_conn_modify(conn->user_plane.fi_msc, 0, &peer);
 }
 
@@ -564,7 +564,7 @@
 	memset(&peer, 0, sizeof(peer));
 	peer.port = htons(sin->sin_port);
 	osmo_strlcpy(peer.addr, inet_ntoa(sin->sin_addr), sizeof(peer.addr));
-	bsc_subscr_pick_codec(&peer, conn);
+	bsc_subscr_pick_codec(&peer, conn, false);
 	mgcp_conn_modify(conn->user_plane.fi_msc, 0, &peer);
 
 }

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3373876bf5430130c6509be08b5f08e724c57c7a
Gerrit-Change-Number: 10173
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180726/23b48836/attachment.htm>


More information about the gerrit-log mailing list