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.
This commit is contained in:
parent
c57b5507b2
commit
cb43a9ac44
|
@ -140,6 +140,8 @@ struct mgcp_trunk_config {
|
||||||
int audio_send_name;
|
int audio_send_name;
|
||||||
int audio_loop;
|
int audio_loop;
|
||||||
|
|
||||||
|
int no_audio_transcoding;
|
||||||
|
|
||||||
int omit_rtcp;
|
int omit_rtcp;
|
||||||
int keepalive_interval;
|
int keepalive_interval;
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,13 @@ int mgcp_transcoding_setup(struct mgcp_endpoint *endp,
|
||||||
if (!src_end)
|
if (!src_end)
|
||||||
return 0;
|
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);
|
src_fmt = get_audio_format(src_codec);
|
||||||
dst_fmt = get_audio_format(dst_codec);
|
dst_fmt = get_audio_format(dst_codec);
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,8 @@ static int config_write_mgcp(struct vty *vty)
|
||||||
g_cfg->trunk.audio_send_name ? "" : "no ", VTY_NEWLINE);
|
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, " 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, " 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)
|
if (g_cfg->call_agent_addr)
|
||||||
vty_out(vty, " call-agent ip %s%s", g_cfg->call_agent_addr, VTY_NEWLINE);
|
vty_out(vty, " call-agent ip %s%s", g_cfg->call_agent_addr, VTY_NEWLINE);
|
||||||
if (g_cfg->transcoder_ip)
|
if (g_cfg->transcoder_ip)
|
||||||
|
@ -426,6 +428,24 @@ DEFUN(cfg_mgcp_sdp_fmtp_extra,
|
||||||
return CMD_SUCCESS;
|
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 SDP_STR "SDP File related options\n"
|
||||||
#define AUDIO_STR "Audio payload options\n"
|
#define AUDIO_STR "Audio payload options\n"
|
||||||
DEFUN(cfg_mgcp_sdp_payload_number,
|
DEFUN(cfg_mgcp_sdp_payload_number,
|
||||||
|
@ -740,6 +760,8 @@ static int config_write_trunk(struct vty *vty)
|
||||||
if (trunk->audio_fmtp_extra)
|
if (trunk->audio_fmtp_extra)
|
||||||
vty_out(vty, " sdp audio fmtp-extra %s%s",
|
vty_out(vty, " sdp audio fmtp-extra %s%s",
|
||||||
trunk->audio_fmtp_extra, VTY_NEWLINE);
|
trunk->audio_fmtp_extra, VTY_NEWLINE);
|
||||||
|
vty_out(vty, " %sallow-transcoding%s",
|
||||||
|
trunk->no_audio_transcoding ? "no " : "", VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
@ -967,6 +989,26 @@ DEFUN(cfg_trunk_no_rtp_keepalive,
|
||||||
return CMD_SUCCESS;
|
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,
|
DEFUN(loop_endp,
|
||||||
loop_endp_cmd,
|
loop_endp_cmd,
|
||||||
"loop-endpoint <0-64> NAME (0|1)",
|
"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_factor_cmd);
|
||||||
install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_size_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_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_element(MGCP_NODE, &cfg_mgcp_trunk_cmd);
|
||||||
install_node(&trunk_node, config_write_trunk);
|
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_no_sdp_payload_send_ptime_cmd);
|
||||||
install_element(TRUNK_NODE, &cfg_trunk_sdp_payload_send_name_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_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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue