[PATCH 3/3] mgcp: Remove the old MGCP based transcoding interface

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/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther holger at freyther.de
Mon Mar 14 17:41:39 UTC 2016


From: Holger Hans Peter Freyther <holger at moiji-mobile.com>

Back in the day we worked around a field proven jitter buffer by
transcoding AMR to AMR with the MTN4200 and by this fixing RTP
timing as this device had:

 a.) A working and stable time (generating RTP every N ms)
 b.) A working jitter buffer

The code has probably rotted, it never retried MGCP commands sent
to the transcoder and it is not deployed either. Simplify the code
by removing it. If we ever need it back we can use the new transcoding
API to keep the state there. I think this code will not be missed
but the PerformanceTechnology Hard- and Firmware was rather nice.
---
 openbsc/include/openbsc/mgcp.h            |   7 --
 openbsc/include/openbsc/mgcp_internal.h   |  16 ----
 openbsc/src/libmgcp/mgcp_network.c        | 105 ----------------------
 openbsc/src/libmgcp/mgcp_protocol.c       | 141 ------------------------------
 openbsc/src/libmgcp/mgcp_vty.c            |  77 +++++-----------
 openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c |   9 --
 6 files changed, 21 insertions(+), 334 deletions(-)

diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index a216547..dfa41a3 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -183,16 +183,10 @@ struct mgcp_config {
 
 	struct in_addr bts_in;
 
-	/* transcoder handling */
-	char *transcoder_ip;
-	struct in_addr transcoder_in;
-	int transcoder_remote_base;
-
 	struct osmo_wqueue gw_fd;
 
 	struct mgcp_port_range bts_ports;
 	struct mgcp_port_range net_ports;
-	struct mgcp_port_range transcoder_ports;
 	int endp_dscp;
 
 	int bts_force_ptime;
@@ -244,7 +238,6 @@ int mgcp_vty_init(void);
 int mgcp_endpoints_allocate(struct mgcp_trunk_config *cfg);
 void mgcp_release_endp(struct mgcp_endpoint *endp);
 void mgcp_initialize_endp(struct mgcp_endpoint *endp);
-int mgcp_reset_transcoder(struct mgcp_config *cfg);
 void mgcp_format_stats(struct mgcp_endpoint *endp, char *stats, size_t size);
 int mgcp_parse_stats(struct msgb *msg, uint32_t *ps, uint32_t *os, uint32_t *pr, uint32_t *_or, int *loss, uint32_t *jitter);
 
diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index 8fb8a45..dd195e0 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -145,7 +145,6 @@ struct mgcp_lco {
 
 enum mgcp_type {
 	MGCP_RTP_DEFAULT	= 0,
-	MGCP_RTP_TRANSCODED,
 	MGCP_OSMUX_BSC,
 	MGCP_OSMUX_BSC_NAT,
 };
@@ -179,13 +178,6 @@ struct mgcp_endpoint {
 	struct mgcp_rtp_end bts_end;
 	struct mgcp_rtp_end net_end;
 
-	/*
-	 * For transcoding we will send from the local_port
-	 * of trans_bts and it will arrive at trans_net from
-	 * where we will forward it to the network.
-	 */
-	struct mgcp_rtp_end trans_bts;
-	struct mgcp_rtp_end trans_net;
 	enum mgcp_type type;
 
 	/* sequence bits */
@@ -268,16 +260,8 @@ struct mgcp_parse_data {
 int mgcp_send_dummy(struct mgcp_endpoint *endp);
 int mgcp_bind_bts_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
 int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
-int mgcp_bind_trans_bts_rtp_port(struct mgcp_endpoint *enp, int rtp_port);
-int mgcp_bind_trans_net_rtp_port(struct mgcp_endpoint *enp, int rtp_port);
 int mgcp_free_rtp_port(struct mgcp_rtp_end *end);
 
-/* For transcoding we need to manage an in and an output that are connected */
-static inline int endp_back_channel(int endpoint)
-{
-	return endpoint + 60;
-}
-
 struct mgcp_trunk_config *mgcp_trunk_alloc(struct mgcp_config *cfg, int index);
 struct mgcp_trunk_config *mgcp_trunk_num(struct mgcp_config *cfg, int index);
 
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index ed90d34..1eb87bb 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -553,33 +553,6 @@ static int forward_data(int fd, struct mgcp_rtp_tap *tap, const char *buf, int l
 		      (struct sockaddr *)&tap->forward, sizeof(tap->forward));
 }
 
-static int mgcp_send_transcoder(struct mgcp_rtp_end *end,
-				struct mgcp_config *cfg, int is_rtp,
-				const char *buf, int len)
-{
-	int rc;
-	int port;
-	struct sockaddr_in addr;
-
-	port = is_rtp ? end->rtp_port : end->rtcp_port;
-
-	addr.sin_family = AF_INET;
-	addr.sin_addr = cfg->transcoder_in;
-	addr.sin_port = port;
-
-	rc = sendto(is_rtp ?
-		end->rtp.fd :
-		end->rtcp.fd, buf, len, 0,
-		(struct sockaddr *) &addr, sizeof(addr));
-
-	if (rc != len)
-		LOGP(DMGCP, LOGL_ERROR,
-			"Failed to send data to the transcoder: %s\n",
-			strerror(errno));
-
-	return rc;
-}
-
 int mgcp_send(struct mgcp_endpoint *endp, int dest, int is_rtp,
 	      struct sockaddr_in *addr, char *buf, int rc)
 {
@@ -688,7 +661,6 @@ static int rtp_data_net(struct osmo_fd *fd, unsigned int what)
 
 	switch(endp->type) {
 	case MGCP_RTP_DEFAULT:
-	case MGCP_RTP_TRANSCODED:
 		if (endp->net_end.rtp_port != addr.sin_port &&
 		    endp->net_end.rtcp_port != addr.sin_port) {
 			LOGP(DMGCP, LOGL_ERROR,
@@ -719,9 +691,6 @@ static int rtp_data_net(struct osmo_fd *fd, unsigned int what)
 	case MGCP_RTP_DEFAULT:
 		return mgcp_send(endp, MGCP_DEST_BTS, proto == MGCP_PROTO_RTP,
 				 &addr, buf, rc);
-	case MGCP_RTP_TRANSCODED:
-		return mgcp_send_transcoder(&endp->trans_net, endp->cfg,
-					    proto == MGCP_PROTO_RTP, buf, rc);
 	case MGCP_OSMUX_BSC_NAT:
 		return osmux_xfrm_to_osmux(MGCP_DEST_BTS, buf, rc, endp);
 	case MGCP_OSMUX_BSC:	/* Should not happen */
@@ -811,9 +780,6 @@ static int rtp_data_bts(struct osmo_fd *fd, unsigned int what)
 	case MGCP_RTP_DEFAULT:
 		return mgcp_send(endp, MGCP_DEST_NET, proto == MGCP_PROTO_RTP,
 				 &addr, buf, rc);
-	case MGCP_RTP_TRANSCODED:
-		return mgcp_send_transcoder(&endp->trans_bts, endp->cfg,
-					    proto == MGCP_PROTO_RTP, buf, rc);
 	case MGCP_OSMUX_BSC:
 		/* OSMUX translation: BTS -> BSC */
 		return osmux_xfrm_to_osmux(MGCP_DEST_NET, buf, rc, endp);
@@ -826,63 +792,6 @@ static int rtp_data_bts(struct osmo_fd *fd, unsigned int what)
 	return 0;
 }
 
-static int rtp_data_transcoder(struct mgcp_rtp_end *end, struct mgcp_endpoint *_endp,
-			      int dest, struct osmo_fd *fd)
-{
-	char buf[RTP_BUF_SIZE];
-	struct sockaddr_in addr;
-	struct mgcp_config *cfg;
-	int rc, proto;
-
-	cfg = _endp->cfg;
-	rc = receive_from(_endp, fd->fd, &addr, buf, sizeof(buf));
-	if (rc <= 0)
-		return -1;
-
-	proto = fd == &end->rtp ? MGCP_PROTO_RTP : MGCP_PROTO_RTCP;
-
-	if (memcmp(&addr.sin_addr, &cfg->transcoder_in, sizeof(addr.sin_addr)) != 0) {
-		LOGP(DMGCP, LOGL_ERROR,
-			"Data not coming from transcoder dest: %d %s on 0x%x\n",
-			dest, inet_ntoa(addr.sin_addr), ENDPOINT_NUMBER(_endp));
-		return -1;
-	}
-
-	if (end->rtp_port != addr.sin_port &&
-	    end->rtcp_port != addr.sin_port) {
-		LOGP(DMGCP, LOGL_ERROR,
-			"Data from wrong transcoder dest %d source port %d on 0x%x\n",
-			dest, ntohs(addr.sin_port), ENDPOINT_NUMBER(_endp));
-		return -1;
-	}
-
-	/* throw away the dummy message */
-	if (rc == 1 && buf[0] == MGCP_DUMMY_LOAD) {
-		LOGP(DMGCP, LOGL_NOTICE, "Filtered dummy from transcoder dest %d on 0x%x\n",
-			dest, ENDPOINT_NUMBER(_endp));
-		return 0;
-	}
-
-	end->packets += 1;
-	return mgcp_send(_endp, dest, proto == MGCP_PROTO_RTP, &addr, buf, rc);
-}
-
-static int rtp_data_trans_net(struct osmo_fd *fd, unsigned int what)
-{
-	struct mgcp_endpoint *endp;
-	endp = (struct mgcp_endpoint *) fd->data;
-
-	return rtp_data_transcoder(&endp->trans_net, endp, MGCP_DEST_NET, fd);
-}
-
-static int rtp_data_trans_bts(struct osmo_fd *fd, unsigned int what)
-{
-	struct mgcp_endpoint *endp;
-	endp = (struct mgcp_endpoint *) fd->data;
-
-	return rtp_data_transcoder(&endp->trans_bts, endp, MGCP_DEST_BTS, fd);
-}
-
 int mgcp_create_bind(const char *source_addr, struct osmo_fd *fd, int port)
 {
 	struct sockaddr_in addr;
@@ -998,20 +907,6 @@ int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port)
 			mgcp_net_src_addr(endp), rtp_port);
 }
 
-int mgcp_bind_trans_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port)
-{
-	return int_bind("trans-net", &endp->trans_net,
-			rtp_data_trans_net, endp,
-			endp->cfg->source_addr, rtp_port);
-}
-
-int mgcp_bind_trans_bts_rtp_port(struct mgcp_endpoint *endp, int rtp_port)
-{
-	return int_bind("trans-bts", &endp->trans_bts,
-			rtp_data_trans_bts, endp,
-			endp->cfg->source_addr, rtp_port);
-}
-
 int mgcp_free_rtp_port(struct mgcp_rtp_end *end)
 {
 	if (end->rtp.fd != -1) {
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 18a25bc..c136e31 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -59,9 +59,6 @@ static struct msgb *handle_modify_con(struct mgcp_parse_data *data);
 static struct msgb *handle_rsip(struct mgcp_parse_data *data);
 static struct msgb *handle_noti_req(struct mgcp_parse_data *data);
 
-static void create_transcoder(struct mgcp_endpoint *endp);
-static void delete_transcoder(struct mgcp_endpoint *endp);
-
 static int setup_rtp_processing(struct mgcp_endpoint *endp);
 
 static int mgcp_analyze_header(struct mgcp_parse_data *parse, char *data);
@@ -604,28 +601,6 @@ static int allocate_ports(struct mgcp_endpoint *endp)
 		return -1;
 	}
 
-	if (endp->cfg->transcoder_ip && endp->tcfg->trunk_type == MGCP_TRUNK_VIRTUAL) {
-		if (allocate_port(endp, &endp->trans_net,
-				  &endp->cfg->transcoder_ports,
-				  mgcp_bind_trans_net_rtp_port) != 0) {
-			mgcp_rtp_end_reset(&endp->net_end);
-			mgcp_rtp_end_reset(&endp->bts_end);
-			return -1;
-		}
-
-		if (allocate_port(endp, &endp->trans_bts,
-				  &endp->cfg->transcoder_ports,
-				  mgcp_bind_trans_bts_rtp_port) != 0) {
-			mgcp_rtp_end_reset(&endp->net_end);
-			mgcp_rtp_end_reset(&endp->bts_end);
-			mgcp_rtp_end_reset(&endp->trans_net);
-			return -1;
-		}
-
-		/* remember that we have set up transcoding */
-		endp->type = MGCP_RTP_TRANSCODED;
-	}
-
 	return 0;
 }
 
@@ -868,7 +843,6 @@ mgcp_header_done:
 			break;
 		case MGCP_POLICY_DEFER:
 			/* stop processing */
-			create_transcoder(endp);
 			return NULL;
 			break;
 		case MGCP_POLICY_CONT:
@@ -887,7 +861,6 @@ mgcp_header_done:
 		send_dummy(endp);
 	}
 
-	create_transcoder(endp);
 	return create_response_with_sdp(endp, "CRCX", p->trans);
 error2:
 	mgcp_release_endp(endp);
@@ -1070,7 +1043,6 @@ static struct msgb *handle_delete_con(struct mgcp_parse_data *p)
 			break;
 		case MGCP_POLICY_DEFER:
 			/* stop processing */
-			delete_transcoder(endp);
 			return NULL;
 			break;
 		case MGCP_POLICY_CONT:
@@ -1086,7 +1058,6 @@ static struct msgb *handle_delete_con(struct mgcp_parse_data *p)
 	/* save the statistics of the current call */
 	mgcp_format_stats(endp, stats, sizeof(stats));
 
-	delete_transcoder(endp);
 	mgcp_release_endp(endp);
 	if (p->cfg->change_cb)
 		p->cfg->change_cb(endp->tcfg, ENDPOINT_NUMBER(endp), MGCP_ENDP_DLCX);
@@ -1205,8 +1176,6 @@ struct mgcp_config *mgcp_config_alloc(void)
 	cfg->source_addr = talloc_strdup(cfg, "0.0.0.0");
 	cfg->osmux_addr = talloc_strdup(cfg, "0.0.0.0");
 
-	cfg->transcoder_remote_base = 4000;
-
 	cfg->bts_ports.base_port = RTP_PORT_DEFAULT;
 	cfg->net_ports.base_port = RTP_PORT_NET_DEFAULT;
 
@@ -1328,8 +1297,6 @@ int mgcp_endpoints_allocate(struct mgcp_trunk_config *tcfg)
 		tcfg->endpoints[i].tcfg = tcfg;
 		mgcp_rtp_end_init(&tcfg->endpoints[i].net_end);
 		mgcp_rtp_end_init(&tcfg->endpoints[i].bts_end);
-		mgcp_rtp_end_init(&tcfg->endpoints[i].trans_net);
-		mgcp_rtp_end_init(&tcfg->endpoints[i].trans_bts);
 	}
 
 	return 0;
@@ -1351,8 +1318,6 @@ void mgcp_release_endp(struct mgcp_endpoint *endp)
 
 	mgcp_rtp_end_reset(&endp->bts_end);
 	mgcp_rtp_end_reset(&endp->net_end);
-	mgcp_rtp_end_reset(&endp->trans_net);
-	mgcp_rtp_end_reset(&endp->trans_bts);
 	endp->type = MGCP_RTP_DEFAULT;
 
 	memset(&endp->net_state, 0, sizeof(endp->net_state));
@@ -1374,65 +1339,6 @@ void mgcp_initialize_endp(struct mgcp_endpoint *endp)
 	return mgcp_release_endp(endp);
 }
 
-static int send_trans(struct mgcp_config *cfg, const char *buf, int len)
-{
-	struct sockaddr_in addr;
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sin_family = AF_INET;
-	addr.sin_addr = cfg->transcoder_in;
-	addr.sin_port = htons(2427);
-	return sendto(cfg->gw_fd.bfd.fd, buf, len, 0,
-		      (struct sockaddr *) &addr, sizeof(addr));
-}
-
-static void send_msg(struct mgcp_endpoint *endp, int endpoint, int port,
-		     const char *msg, const char *mode)
-{
-	char buf[2096];
-	int len;
-	int nchars;
-
-	/* hardcoded to AMR right now, we do not know the real type at this point */
-	len = snprintf(buf, sizeof(buf),
-			"%s 42 %x at mgw MGCP 1.0\r\n"
-			"C: 4256\r\n"
-			"M: %s\r\n"
-			"\r\n",
-			msg, endpoint, mode);
-
-	if (len < 0)
-		return;
-
-	nchars = write_response_sdp(endp, buf + len, sizeof(buf) + len - 1, NULL);
-	if (nchars < 0)
-		return;
-
-	len += nchars;
-
-	buf[sizeof(buf) - 1] = '\0';
-
-	send_trans(endp->cfg, buf, len);
-}
-
-static void send_dlcx(struct mgcp_endpoint *endp, int endpoint)
-{
-	char buf[2096];
-	int len;
-
-	len = snprintf(buf, sizeof(buf),
-			"DLCX 43 %x at mgw MGCP 1.0\r\n"
-			"C: 4256\r\n"
-			, endpoint);
-
-	if (len < 0)
-		return;
-
-	buf[sizeof(buf) - 1] = '\0';
-
-	send_trans(endp->cfg, buf, len);
-}
-
 static int send_agent(struct mgcp_config *cfg, const char *buf, int len)
 {
 	return write(cfg->gw_fd.bfd.fd, buf, len);
@@ -1486,53 +1392,6 @@ static int setup_rtp_processing(struct mgcp_endpoint *endp)
 	return rc;
 }
 
-static void create_transcoder(struct mgcp_endpoint *endp)
-{
-	int port;
-	int in_endp = ENDPOINT_NUMBER(endp);
-	int out_endp = endp_back_channel(in_endp);
-
-	if (endp->type != MGCP_RTP_TRANSCODED)
-		return;
-
-	send_msg(endp, in_endp, endp->trans_bts.local_port, "CRCX", "sendrecv");
-	send_msg(endp, in_endp, endp->trans_bts.local_port, "MDCX", "sendrecv");
-	send_msg(endp, out_endp, endp->trans_net.local_port, "CRCX", "sendrecv");
-	send_msg(endp, out_endp, endp->trans_net.local_port, "MDCX", "sendrecv");
-
-	port = rtp_calculate_port(in_endp, endp->cfg->transcoder_remote_base);
-	endp->trans_bts.rtp_port = htons(port);
-	endp->trans_bts.rtcp_port = htons(port + 1);
-
-	port = rtp_calculate_port(out_endp, endp->cfg->transcoder_remote_base);
-	endp->trans_net.rtp_port = htons(port);
-	endp->trans_net.rtcp_port = htons(port + 1);
-}
-
-static void delete_transcoder(struct mgcp_endpoint *endp)
-{
-	int in_endp = ENDPOINT_NUMBER(endp);
-	int out_endp = endp_back_channel(in_endp);
-
-	if (endp->type != MGCP_RTP_TRANSCODED)
-		return;
-
-	send_dlcx(endp, in_endp);
-	send_dlcx(endp, out_endp);
-}
-
-int mgcp_reset_transcoder(struct mgcp_config *cfg)
-{
-	if (!cfg->transcoder_ip)
-		return 0;
-
-	static const char mgcp_reset[] = {
-	    "RSIP 1 13 at mgw MGCP 1.0\r\n"
-	};
-
-	return send_trans(cfg, mgcp_reset, sizeof mgcp_reset -1);
-}
-
 void mgcp_format_stats(struct mgcp_endpoint *endp, char *msg, size_t size)
 {
 	uint32_t expected, jitter;
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 13f66c5..5300ffc 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -128,17 +128,8 @@ static int config_write_mgcp(struct vty *vty)
 		g_cfg->trunk.no_audio_transcoding ? "no " : "", VTY_NEWLINE);
 	if (g_cfg->call_agent_addr)
 		vty_out(vty, "  call-agent ip %s%s", g_cfg->call_agent_addr, VTY_NEWLINE);
-	if (g_cfg->transcoder_ip)
-		vty_out(vty, "  transcoder-mgw %s%s", g_cfg->transcoder_ip, VTY_NEWLINE);
-
-	if (g_cfg->transcoder_ports.mode == PORT_ALLOC_STATIC)
-		vty_out(vty, "  rtp transcoder-base %u%s", g_cfg->transcoder_ports.base_port, VTY_NEWLINE);
-	else
-		vty_out(vty, "  rtp transcoder-range %u %u%s",
-			g_cfg->transcoder_ports.range_start, g_cfg->transcoder_ports.range_end, VTY_NEWLINE);
 	if (g_cfg->bts_force_ptime > 0)
 		vty_out(vty, "  rtp force-ptime %d%s", g_cfg->bts_force_ptime, VTY_NEWLINE);
-	vty_out(vty, "  transcoder-remote-base %u%s", g_cfg->transcoder_remote_base, VTY_NEWLINE);
 
 	switch (g_cfg->osmux) {
 	case OSMUX_USAGE_ON:
@@ -209,13 +200,12 @@ static void dump_trunk(struct vty *vty, struct mgcp_trunk_config *cfg, int verbo
 		struct mgcp_endpoint *endp = &cfg->endpoints[i];
 		vty_out(vty,
 			" Endpoint 0x%.2x: CI: %d net: %u/%u bts: %u/%u on %s "
-			"traffic received bts: %u  remote: %u transcoder: %u/%u%s",
+			"traffic received bts: %u  remote: %u%s",
 			i, endp->ci,
 			ntohs(endp->net_end.rtp_port), ntohs(endp->net_end.rtcp_port),
 			ntohs(endp->bts_end.rtp_port), ntohs(endp->bts_end.rtcp_port),
 			inet_ntoa(endp->bts_end.addr),
 			endp->bts_end.packets, endp->net_end.packets,
-			endp->trans_net.packets, endp->trans_bts.packets,
 			VTY_NEWLINE);
 
 		if (verbose && endp->allocated) {
@@ -378,24 +368,26 @@ ALIAS_DEPRECATED(cfg_mgcp_rtp_bts_base_port, cfg_mgcp_rtp_base_port_cmd,
       "rtp base <0-65534>",
       RTP_STR BTS_START_STR UDP_PORT_STR)
 
-DEFUN(cfg_mgcp_rtp_transcoder_range,
+DEFUN_DEPRECATED(cfg_mgcp_rtp_transcoder_range,
       cfg_mgcp_rtp_transcoder_range_cmd,
       "rtp transcoder-range <0-65534> <0-65534>",
       RTP_STR "Range of ports to use for the Transcoder\n"
       RANGE_START_STR RANGE_END_STR)
 {
-	parse_range(&g_cfg->transcoder_ports, argv);
-	return CMD_SUCCESS;
+	vty_out(vty,
+		"%% MGCP RTP transcoding has been removed.%s", VTY_NEWLINE);
+	return CMD_WARNING;
 }
 
-DEFUN(cfg_mgcp_rtp_transcoder_base,
+DEFUN_DEPRECATED(cfg_mgcp_rtp_transcoder_base,
       cfg_mgcp_rtp_transcoder_base_cmd,
       "rtp transcoder-base <0-65534>",
       RTP_STR "First UDP port allocated for the Transcoder side\n"
       UDP_PORT_STR)
 {
-	parse_base(&g_cfg->transcoder_ports, argv);
-	return CMD_SUCCESS;
+	vty_out(vty,
+		"%% MGCP RTP transcoding has been removed.%s", VTY_NEWLINE);
+	return CMD_WARNING;
 }
 
 DEFUN(cfg_mgcp_rtp_bts_bind_ip,
@@ -724,39 +716,35 @@ ALIAS_DEPRECATED(cfg_mgcp_agent_addr, cfg_mgcp_agent_addr_cmd_old,
       "IPv4 Address of the callagent\n")
       
 
-DEFUN(cfg_mgcp_transcoder,
+DEFUN_DEPRECATED(cfg_mgcp_transcoder,
       cfg_mgcp_transcoder_cmd,
       "transcoder-mgw A.B.C.D",
       "Use a MGW to detranscoder RTP\n"
       "The IP address of the MGW")
 {
-	bsc_replace_string(g_cfg, &g_cfg->transcoder_ip, argv[0]);
-	inet_aton(g_cfg->transcoder_ip, &g_cfg->transcoder_in);
-
-	return CMD_SUCCESS;
+	vty_out(vty,
+		"%% MGCP RTP transcoding has been removed.%s", VTY_NEWLINE);
+	return CMD_WARNING;
 }
 
-DEFUN(cfg_mgcp_no_transcoder,
+DEFUN_DEPRECATED(cfg_mgcp_no_transcoder,
       cfg_mgcp_no_transcoder_cmd,
       "no transcoder-mgw",
       NO_STR "Disable the transcoding\n")
 {
-	if (g_cfg->transcoder_ip) {
-		LOGP(DMGCP, LOGL_NOTICE, "Disabling transcoding on future calls.\n");
-		talloc_free(g_cfg->transcoder_ip);
-		g_cfg->transcoder_ip = NULL;
-	}
-
-	return CMD_SUCCESS;
+	vty_out(vty,
+		"%% MGCP RTP transcoding has been removed.%s", VTY_NEWLINE);
+	return CMD_WARNING;
 }
 
-DEFUN(cfg_mgcp_transcoder_remote_base,
+DEFUN_DEPRECATED(cfg_mgcp_transcoder_remote_base,
       cfg_mgcp_transcoder_remote_base_cmd,
       "transcoder-remote-base <0-65534>",
       "Set the base port for the transcoder\n" "The RTP base port on the transcoder")
 {
-	g_cfg->transcoder_remote_base = atoi(argv[0]);
-	return CMD_SUCCESS;
+	vty_out(vty,
+		"%% MGCP RTP transcoding has been removed.%s", VTY_NEWLINE);
+	return CMD_WARNING;
 }
 
 DEFUN(cfg_mgcp_trunk, cfg_mgcp_trunk_cmd,
@@ -1466,29 +1454,6 @@ static int allocate_trunk(struct mgcp_trunk_config *trunk)
 			}
 			endp->net_end.local_alloc = PORT_ALLOC_STATIC;
 		}
-
-		if (trunk->trunk_type == MGCP_TRUNK_VIRTUAL &&
-		    cfg->transcoder_ip && cfg->transcoder_ports.mode == PORT_ALLOC_STATIC) {
-			int rtp_port;
-
-			/* network side */
-			rtp_port = rtp_calculate_port(ENDPOINT_NUMBER(endp),
-						      cfg->transcoder_ports.base_port);
-			if (mgcp_bind_trans_net_rtp_port(endp, rtp_port) != 0) {
-				LOGP(DMGCP, LOGL_FATAL, "Failed to bind: %d\n", rtp_port);
-				return -1;
-			}
-			endp->trans_net.local_alloc = PORT_ALLOC_STATIC;
-
-			/* bts side */
-			rtp_port = rtp_calculate_port(endp_back_channel(ENDPOINT_NUMBER(endp)),
-						      cfg->transcoder_ports.base_port);
-			if (mgcp_bind_trans_bts_rtp_port(endp, rtp_port) != 0) {
-				LOGP(DMGCP, LOGL_FATAL, "Failed to bind: %d\n", rtp_port);
-				return -1;
-			}
-			endp->trans_bts.local_alloc = PORT_ALLOC_STATIC;
-		}
 	}
 
 	return 0;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index 9fd9967..67149b8 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -1116,15 +1116,6 @@ int bsc_mgcp_nat_init(struct bsc_nat *nat)
 		return -1;
 	}
 
-	if (mgcp_reset_transcoder(cfg) < 0) {
-		LOGP(DMGCP, LOGL_ERROR, "Failed to send packet to the transcoder.\n");
-		talloc_free(nat->bsc_endpoints);
-		nat->bsc_endpoints = NULL;
-		close(cfg->gw_fd.bfd.fd);
-		cfg->gw_fd.bfd.fd = -1;
-		return -1;
-	}
-
 	return 0;
 }
 
-- 
2.6.3




More information about the OpenBSC mailing list