mgcp: Make it possible to drop RTCP packets coming from the BTS/Net

The ip.access nanoBTS appears to send quite broken NTP timestamps in
the RTCP messages might confuse equipment that uses the sender report
of the BTS. Make it easy to experiment by adding an option to drop RTCP.
This commit is contained in:
Holger Hans Peter Freyther 2012-05-11 13:00:45 +02:00
parent c50e04a409
commit a8090d54d6
4 changed files with 56 additions and 2 deletions

View File

@ -114,6 +114,8 @@ struct mgcp_trunk_config {
int audio_payload;
int audio_loop;
int omit_rtcp;
/* spec handling */
int force_realloc;

View File

@ -212,7 +212,7 @@ static int send_to(struct mgcp_endpoint *endp, int dest, int is_rtp,
&endp->taps[MGCP_TAP_NET_OUT], buf, rc);
return udp_send(endp->net_end.rtp.fd, &endp->net_end.addr,
endp->net_end.rtp_port, buf, rc);
} else {
} else if (!tcfg->omit_rtcp) {
return udp_send(endp->net_end.rtcp.fd, &endp->net_end.addr,
endp->net_end.rtcp_port, buf, rc);
}
@ -225,7 +225,7 @@ static int send_to(struct mgcp_endpoint *endp, int dest, int is_rtp,
&endp->taps[MGCP_TAP_BTS_OUT], buf, rc);
return udp_send(endp->bts_end.rtp.fd, &endp->bts_end.addr,
endp->bts_end.rtp_port, buf, rc);
} else {
} else if (!tcfg->omit_rtcp) {
return udp_send(endp->bts_end.rtcp.fd, &endp->bts_end.addr,
endp->bts_end.rtcp_port, buf, rc);
}

View File

@ -850,6 +850,7 @@ struct mgcp_config *mgcp_config_alloc(void)
cfg->trunk.trunk_type = MGCP_TRUNK_VIRTUAL;
cfg->trunk.audio_name = talloc_strdup(cfg, "AMR/8000");
cfg->trunk.audio_payload = 126;
cfg->trunk.omit_rtcp = 0;
INIT_LLIST_HEAD(&cfg->trunks);
@ -872,6 +873,7 @@ struct mgcp_trunk_config *mgcp_trunk_alloc(struct mgcp_config *cfg, int nr)
trunk->audio_name = talloc_strdup(cfg, "AMR/8000");
trunk->audio_payload = 126;
trunk->number_endpoints = 33;
trunk->omit_rtcp = 0;
llist_add_tail(&trunk->entry, &cfg->trunks);
return trunk;
}

View File

@ -82,6 +82,10 @@ static int config_write_mgcp(struct vty *vty)
g_cfg->net_ports.range_start, g_cfg->net_ports.range_end, VTY_NEWLINE);
vty_out(vty, " rtp ip-dscp %d%s", g_cfg->endp_dscp, VTY_NEWLINE);
if (g_cfg->trunk.omit_rtcp)
vty_out(vty, " rtcp-omit%s", VTY_NEWLINE);
else
vty_out(vty, " no rtcp-omit%s", VTY_NEWLINE);
if (g_cfg->trunk.audio_payload != -1)
vty_out(vty, " sdp audio-payload number %d%s",
g_cfg->trunk.audio_payload, VTY_NEWLINE);
@ -368,6 +372,24 @@ DEFUN(cfg_mgcp_number_endp,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_omit_rtcp,
cfg_mgcp_omit_rtcp_cmd,
"rtcp-omit",
"Drop RTCP packets in both directions")
{
g_cfg->trunk.omit_rtcp = 1;
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_omit_rtcp,
cfg_mgcp_no_omit_rtcp_cmd,
"no rtcp-omit",
NO_STR "Drop RTCP packets in both directions")
{
g_cfg->trunk.omit_rtcp = 0;
return CMD_SUCCESS;
}
#define CALL_AGENT_STR "Callagent information\n"
DEFUN(cfg_mgcp_agent_addr,
cfg_mgcp_agent_addr_cmd,
@ -454,6 +476,10 @@ static int config_write_trunk(struct vty *vty)
trunk->audio_name, VTY_NEWLINE);
vty_out(vty, " loop %d%s",
trunk->audio_loop, VTY_NEWLINE);
if (trunk->omit_rtcp)
vty_out(vty, " rtcp-omit%s", VTY_NEWLINE);
else
vty_out(vty, " no rtcp-omit%s", VTY_NEWLINE);
}
return CMD_SUCCESS;
@ -503,6 +529,26 @@ DEFUN(cfg_trunk_loop,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_omit_rtcp,
cfg_trunk_omit_rtcp_cmd,
"rtcp-omit",
"Drop RTCP packets in both directions")
{
struct mgcp_trunk_config *trunk = vty->index;
trunk->omit_rtcp = 1;
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_omit_rtcp,
cfg_trunk_no_omit_rtcp_cmd,
"no rtcp-omit",
"Drop RTCP packets in both directions")
{
struct mgcp_trunk_config *trunk = vty->index;
trunk->omit_rtcp = 0;
return CMD_SUCCESS;
}
DEFUN(loop_endp,
loop_endp_cmd,
"loop-endpoint <0-64> NAME (0|1)",
@ -731,6 +777,8 @@ int mgcp_vty_init(void)
install_element(MGCP_NODE, &cfg_mgcp_sdp_payload_name_cmd_old);
install_element(MGCP_NODE, &cfg_mgcp_loop_cmd);
install_element(MGCP_NODE, &cfg_mgcp_number_endp_cmd);
install_element(MGCP_NODE, &cfg_mgcp_omit_rtcp_cmd);
install_element(MGCP_NODE, &cfg_mgcp_no_omit_rtcp_cmd);
install_element(MGCP_NODE, &cfg_mgcp_trunk_cmd);
install_node(&trunk_node, config_write_trunk);
@ -742,6 +790,8 @@ int mgcp_vty_init(void)
install_element(TRUNK_NODE, &cfg_trunk_payload_number_cmd_old);
install_element(TRUNK_NODE, &cfg_trunk_payload_name_cmd_old);
install_element(TRUNK_NODE, &cfg_trunk_loop_cmd);
install_element(TRUNK_NODE, &cfg_trunk_omit_rtcp_cmd);
install_element(TRUNK_NODE, &cfg_trunk_no_omit_rtcp_cmd);
return 0;
}