aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-04-24 16:03:55 -0400
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-04-24 16:10:54 -0400
commitcb43a9ac4489040185addd528a3143655ea349be (patch)
tree3673372a1e798fbe18c9c6e9f126a9ab189c95d5 /openbsc/src/libmgcp
parentc57b5507b21d12f656ec1667a8a875485344fe8d (diff)
mgcp: Allow to disable transcoding for trunks
We might have compiled transcoding into the MGW but we don't want to enable it for a given user. Add a new switch that should allow that. I had manually tested the allow-transcoding/no allow VTY interface for the primary interface and a new trunk using show running-config.
Diffstat (limited to 'openbsc/src/libmgcp')
-rw-r--r--openbsc/src/libmgcp/mgcp_transcode.c7
-rw-r--r--openbsc/src/libmgcp/mgcp_vty.c47
2 files changed, 54 insertions, 0 deletions
diff --git a/openbsc/src/libmgcp/mgcp_transcode.c b/openbsc/src/libmgcp/mgcp_transcode.c
index 04fb2dca..daf2510d 100644
--- a/openbsc/src/libmgcp/mgcp_transcode.c
+++ b/openbsc/src/libmgcp/mgcp_transcode.c
@@ -153,6 +153,13 @@ int mgcp_transcoding_setup(struct mgcp_endpoint *endp,
if (!src_end)
return 0;
+ if (endp->tcfg->no_audio_transcoding) {
+ LOGP(DMGCP, LOGL_NOTICE,
+ "Transcoding disabled on endpoint 0x%x\n",
+ ENDPOINT_NUMBER(endp));
+ return 0;
+ }
+
src_fmt = get_audio_format(src_codec);
dst_fmt = get_audio_format(dst_codec);
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 3d99c83b..dd21a153 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -120,6 +120,8 @@ static int config_write_mgcp(struct vty *vty)
g_cfg->trunk.audio_send_name ? "" : "no ", VTY_NEWLINE);
vty_out(vty, " loop %u%s", !!g_cfg->trunk.audio_loop, VTY_NEWLINE);
vty_out(vty, " number endpoints %u%s", g_cfg->trunk.number_endpoints - 1, VTY_NEWLINE);
+ vty_out(vty, " %sallow-transcoding%s",
+ 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)
@@ -426,6 +428,24 @@ DEFUN(cfg_mgcp_sdp_fmtp_extra,
return CMD_SUCCESS;
}
+DEFUN(cfg_mgcp_allow_transcoding,
+ cfg_mgcp_allow_transcoding_cmd,
+ "allow-transcoding",
+ "Allow transcoding\n")
+{
+ g_cfg->trunk.no_audio_transcoding = 0;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_mgcp_no_allow_transcoding,
+ cfg_mgcp_no_allow_transcoding_cmd,
+ "no allow-transcoding",
+ NO_STR "Allow transcoding\n")
+{
+ g_cfg->trunk.no_audio_transcoding = 1;
+ return CMD_SUCCESS;
+}
+
#define SDP_STR "SDP File related options\n"
#define AUDIO_STR "Audio payload options\n"
DEFUN(cfg_mgcp_sdp_payload_number,
@@ -740,6 +760,8 @@ static int config_write_trunk(struct vty *vty)
if (trunk->audio_fmtp_extra)
vty_out(vty, " sdp audio fmtp-extra %s%s",
trunk->audio_fmtp_extra, VTY_NEWLINE);
+ vty_out(vty, " %sallow-transcoding%s",
+ trunk->no_audio_transcoding ? "no " : "", VTY_NEWLINE);
}
return CMD_SUCCESS;
@@ -967,6 +989,26 @@ DEFUN(cfg_trunk_no_rtp_keepalive,
return CMD_SUCCESS;
}
+DEFUN(cfg_trunk_allow_transcoding,
+ cfg_trunk_allow_transcoding_cmd,
+ "allow-transcoding",
+ "Allow transcoding\n")
+{
+ struct mgcp_trunk_config *trunk = vty->index;
+ trunk->no_audio_transcoding = 0;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_trunk_no_allow_transcoding,
+ cfg_trunk_no_allow_transcoding_cmd,
+ "no allow-transcoding",
+ NO_STR "Allow transcoding\n")
+{
+ struct mgcp_trunk_config *trunk = vty->index;
+ trunk->no_audio_transcoding = 1;
+ return CMD_SUCCESS;
+}
+
DEFUN(loop_endp,
loop_endp_cmd,
"loop-endpoint <0-64> NAME (0|1)",
@@ -1262,6 +1304,9 @@ int mgcp_vty_init(void)
install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_factor_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_size_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_port_cmd);
+ install_element(MGCP_NODE, &cfg_mgcp_allow_transcoding_cmd);
+ install_element(MGCP_NODE, &cfg_mgcp_no_allow_transcoding_cmd);
+
install_element(MGCP_NODE, &cfg_mgcp_trunk_cmd);
install_node(&trunk_node, config_write_trunk);
@@ -1286,6 +1331,8 @@ int mgcp_vty_init(void)
install_element(TRUNK_NODE, &cfg_trunk_no_sdp_payload_send_ptime_cmd);
install_element(TRUNK_NODE, &cfg_trunk_sdp_payload_send_name_cmd);
install_element(TRUNK_NODE, &cfg_trunk_no_sdp_payload_send_name_cmd);
+ install_element(TRUNK_NODE, &cfg_trunk_allow_transcoding_cmd);
+ install_element(TRUNK_NODE, &cfg_trunk_no_allow_transcoding_cmd);
return 0;
}