mgcp_vty: add user attributes to configuration commands

To make clear which configuration changes (configure terminal)
apply when, add appropriate user attributes to VTY commands.

Change-Id: I2d9487801b3b78f94577264b56d217c926ef76a9
Related: SYS#4937, OS#1601
This commit is contained in:
Philipp Maier 2020-09-22 15:52:50 +02:00
parent 3ba409558e
commit 19c430feba
3 changed files with 248 additions and 180 deletions

View File

@ -6,3 +6,7 @@ enum mgcp_vty_node {
MGCP_NODE = _LAST_OSMOVTY_NODE + 1,
TRUNK_NODE,
};
enum mgw_vty_cmd_attr {
MGW_CMD_ATTR_NEWCONN = 0,
};

View File

@ -42,6 +42,7 @@
#define RTP_KEEPALIVE_STR "Send dummy UDP packet to net RTP destination\n"
#define RTP_TS101318_RFC5993_CONV_STR "Convert GSM-HR from TS101318 to RFC5993 and vice versa\n"
#define X(x) (1 << x)
static struct mgcp_config *g_cfg = NULL;
@ -408,8 +409,9 @@ DEFUN(cfg_mgcp, cfg_mgcp_cmd, "mgcp", "Configure the MGCP")
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_local_ip,
DEFUN_USRATTR(cfg_mgcp_local_ip,
cfg_mgcp_local_ip_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"local ip " VTY_IPV46_CMD,
"Local options for the SDP record\n"
IP_STR
@ -499,8 +501,9 @@ ALIAS_DEPRECATED(cfg_mgcp_rtp_port_range,
RTP_STR "Range of ports to use for the NET side\n"
RANGE_START_STR RANGE_END_STR)
DEFUN(cfg_mgcp_rtp_bind_ip,
DEFUN_USRATTR(cfg_mgcp_rtp_bind_ip,
cfg_mgcp_rtp_bind_ip_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp bind-ip A.B.C.D",
RTP_STR "Bind endpoints facing the Network\n"
"IPv4 Address to bind to\n")
@ -513,8 +516,9 @@ ALIAS_DEPRECATED(cfg_mgcp_rtp_bind_ip,
"rtp net-bind-ip A.B.C.D",
RTP_STR "Bind endpoints facing the Network\n" "Address to bind to\n")
DEFUN(cfg_mgcp_rtp_no_bind_ip,
DEFUN_USRATTR(cfg_mgcp_rtp_no_bind_ip,
cfg_mgcp_rtp_no_bind_ip_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp bind-ip",
NO_STR RTP_STR "Bind endpoints facing the Network\n"
"Address to bind to\n")
@ -529,8 +533,9 @@ ALIAS_DEPRECATED(cfg_mgcp_rtp_no_bind_ip,
NO_STR RTP_STR "Bind endpoints facing the Network\n"
"Address to bind to\n")
DEFUN(cfg_mgcp_rtp_bind_ip_v6,
DEFUN_USRATTR(cfg_mgcp_rtp_bind_ip_v6,
cfg_mgcp_rtp_bind_ip_v6_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp bind-ip-v6 " VTY_IPV6_CMD,
RTP_STR "Bind endpoints facing the Network\n"
"IPv6 Address to bind to\n")
@ -539,19 +544,21 @@ DEFUN(cfg_mgcp_rtp_bind_ip_v6,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_rtp_no_bind_ip_v6,
cfg_mgcp_rtp_no_bind_ip_v6_cmd,
"no rtp bind-ip-v6",
NO_STR RTP_STR "Bind endpoints facing the Network\n"
"Address to bind to\n")
DEFUN_USRATTR(cfg_mgcp_rtp_no_bind_ip_v6,
cfg_mgcp_rtp_no_bind_ip_v6_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp bind-ip-v6",
NO_STR RTP_STR "Bind endpoints facing the Network\n"
"Address to bind to\n")
{
talloc_free(g_cfg->net_ports.bind_addr_v6);
g_cfg->net_ports.bind_addr_v6 = NULL;
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_rtp_net_bind_ip_probing,
DEFUN_USRATTR(cfg_mgcp_rtp_net_bind_ip_probing,
cfg_mgcp_rtp_net_bind_ip_probing_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp ip-probing",
RTP_STR "automatic rtp bind ip selection\n")
{
@ -559,8 +566,9 @@ DEFUN(cfg_mgcp_rtp_net_bind_ip_probing,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_rtp_no_net_bind_ip_probing,
DEFUN_USRATTR(cfg_mgcp_rtp_no_net_bind_ip_probing,
cfg_mgcp_rtp_no_net_bind_ip_probing_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp ip-probing",
NO_STR RTP_STR "no automatic rtp bind ip selection\n")
{
@ -568,8 +576,9 @@ DEFUN(cfg_mgcp_rtp_no_net_bind_ip_probing,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_rtp_ip_dscp,
DEFUN_USRATTR(cfg_mgcp_rtp_ip_dscp,
cfg_mgcp_rtp_ip_dscp_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp ip-dscp <0-255>",
RTP_STR
"Apply IP_TOS to the audio stream (including Osmux)\n" "The DSCP value\n")
@ -584,8 +593,9 @@ ALIAS_DEPRECATED(cfg_mgcp_rtp_ip_dscp, cfg_mgcp_rtp_ip_tos_cmd,
RTP_STR
"Apply IP_TOS to the audio stream\n" "The DSCP value\n")
#define FORCE_PTIME_STR "Force a fixed ptime for packets sent"
DEFUN(cfg_mgcp_rtp_force_ptime,
DEFUN_USRATTR(cfg_mgcp_rtp_force_ptime,
cfg_mgcp_rtp_force_ptime_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp force-ptime (10|20|40)",
RTP_STR FORCE_PTIME_STR
"The required ptime (packet duration) in ms\n" "10 ms\n20 ms\n40 ms\n")
@ -594,16 +604,18 @@ DEFUN(cfg_mgcp_rtp_force_ptime,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_rtp_force_ptime,
DEFUN_USRATTR(cfg_mgcp_no_rtp_force_ptime,
cfg_mgcp_no_rtp_force_ptime_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp force-ptime", NO_STR RTP_STR FORCE_PTIME_STR)
{
g_cfg->force_ptime = 0;
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_sdp_fmtp_extra,
DEFUN_USRATTR(cfg_mgcp_sdp_fmtp_extra,
cfg_mgcp_sdp_fmtp_extra_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"sdp audio fmtp-extra .NAME",
"Add extra fmtp for the SDP file\n" "Audio\n" "Fmtp-extra\n"
"Extra Information\n")
@ -619,8 +631,9 @@ DEFUN(cfg_mgcp_sdp_fmtp_extra,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_allow_transcoding,
DEFUN_USRATTR(cfg_mgcp_allow_transcoding,
cfg_mgcp_allow_transcoding_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"allow-transcoding", "Allow transcoding\n")
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
@ -629,8 +642,9 @@ DEFUN(cfg_mgcp_allow_transcoding,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_allow_transcoding,
DEFUN_USRATTR(cfg_mgcp_no_allow_transcoding,
cfg_mgcp_no_allow_transcoding_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no allow-transcoding", NO_STR "Allow transcoding\n")
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
@ -666,8 +680,9 @@ ALIAS_DEPRECATED(cfg_mgcp_sdp_payload_name, cfg_mgcp_sdp_payload_name_cmd_old,
"sdp audio payload name NAME",
SDP_STR AUDIO_STR AUDIO_STR "Name\n" "Payload name\n")
DEFUN(cfg_mgcp_sdp_payload_send_ptime,
DEFUN_USRATTR(cfg_mgcp_sdp_payload_send_ptime,
cfg_mgcp_sdp_payload_send_ptime_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"sdp audio-payload send-ptime",
SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n")
{
@ -677,8 +692,9 @@ DEFUN(cfg_mgcp_sdp_payload_send_ptime,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_sdp_payload_send_ptime,
DEFUN_USRATTR(cfg_mgcp_no_sdp_payload_send_ptime,
cfg_mgcp_no_sdp_payload_send_ptime_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no sdp audio-payload send-ptime",
NO_STR SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n")
{
@ -688,8 +704,9 @@ DEFUN(cfg_mgcp_no_sdp_payload_send_ptime,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_sdp_payload_send_name,
DEFUN_USRATTR(cfg_mgcp_sdp_payload_send_name,
cfg_mgcp_sdp_payload_send_name_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"sdp audio-payload send-name",
SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n")
{
@ -699,8 +716,9 @@ DEFUN(cfg_mgcp_sdp_payload_send_name,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_sdp_payload_send_name,
DEFUN_USRATTR(cfg_mgcp_no_sdp_payload_send_name,
cfg_mgcp_no_sdp_payload_send_name_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no sdp audio-payload send-name",
NO_STR SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n")
{
@ -718,8 +736,9 @@ DEFUN_DEPRECATED(cfg_mgcp_loop,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_force_realloc,
DEFUN_USRATTR(cfg_mgcp_force_realloc,
cfg_mgcp_force_realloc_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"force-realloc (0|1)",
"Force endpoint reallocation when the endpoint is still seized\n"
"Don't force reallocation\n" "force reallocation\n")
@ -730,11 +749,12 @@ DEFUN(cfg_mgcp_force_realloc,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_rtp_accept_all,
DEFUN_ATTR(cfg_mgcp_rtp_accept_all,
cfg_mgcp_rtp_accept_all_cmd,
"rtp-accept-all (0|1)",
"Accept all RTP packets, even when the originating IP/Port does not match\n"
"enable filter\n" "disable filter\n")
"enable filter\n" "disable filter\n",
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
OSMO_ASSERT(trunk);
@ -753,15 +773,21 @@ DEFUN(cfg_mgcp_number_endp,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_omit_rtcp, cfg_mgcp_omit_rtcp_cmd, "rtcp-omit", RTCP_OMIT_STR)
DEFUN_ATTR(cfg_mgcp_omit_rtcp,
cfg_mgcp_omit_rtcp_cmd,
"rtcp-omit", RTCP_OMIT_STR,
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
trunk->omit_rtcp = 1;
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_omit_rtcp,
cfg_mgcp_no_omit_rtcp_cmd, "no rtcp-omit", NO_STR RTCP_OMIT_STR)
DEFUN_ATTR(cfg_mgcp_no_omit_rtcp,
cfg_mgcp_no_omit_rtcp_cmd,
"no rtcp-omit",
NO_STR RTCP_OMIT_STR,
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
OSMO_ASSERT(trunk);
@ -769,8 +795,9 @@ DEFUN(cfg_mgcp_no_omit_rtcp,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_patch_rtp_ssrc,
DEFUN_USRATTR(cfg_mgcp_patch_rtp_ssrc,
cfg_mgcp_patch_rtp_ssrc_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp-patch ssrc", RTP_PATCH_STR "Force a fixed SSRC\n")
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
@ -779,8 +806,9 @@ DEFUN(cfg_mgcp_patch_rtp_ssrc,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_patch_rtp_ssrc,
DEFUN_USRATTR(cfg_mgcp_no_patch_rtp_ssrc,
cfg_mgcp_no_patch_rtp_ssrc_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp-patch ssrc", NO_STR RTP_PATCH_STR "Force a fixed SSRC\n")
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
@ -789,8 +817,9 @@ DEFUN(cfg_mgcp_no_patch_rtp_ssrc,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_patch_rtp_ts,
DEFUN_USRATTR(cfg_mgcp_patch_rtp_ts,
cfg_mgcp_patch_rtp_ts_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp-patch timestamp", RTP_PATCH_STR "Adjust RTP timestamp\n")
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
@ -799,8 +828,9 @@ DEFUN(cfg_mgcp_patch_rtp_ts,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_patch_rtp_ts,
DEFUN_USRATTR(cfg_mgcp_no_patch_rtp_ts,
cfg_mgcp_no_patch_rtp_ts_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp-patch timestamp", NO_STR RTP_PATCH_STR "Adjust RTP timestamp\n")
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
@ -809,8 +839,9 @@ DEFUN(cfg_mgcp_no_patch_rtp_ts,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_patch_rtp_rfc5993hr,
DEFUN_USRATTR(cfg_mgcp_patch_rtp_rfc5993hr,
cfg_mgcp_patch_rtp_rfc5993hr_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp-patch rfc5993hr", RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
@ -819,8 +850,9 @@ DEFUN(cfg_mgcp_patch_rtp_rfc5993hr,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_patch_rtp_rfc5993hr,
DEFUN_USRATTR(cfg_mgcp_no_patch_rtp_rfc5993hr,
cfg_mgcp_no_patch_rtp_rfc5993hr_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp-patch rfc5993hr", NO_STR RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
@ -829,8 +861,10 @@ DEFUN(cfg_mgcp_no_patch_rtp_rfc5993hr,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_patch_rtp,
cfg_mgcp_no_patch_rtp_cmd, "no rtp-patch", NO_STR RTP_PATCH_STR)
DEFUN_USRATTR(cfg_mgcp_no_patch_rtp,
cfg_mgcp_no_patch_rtp_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp-patch", NO_STR RTP_PATCH_STR)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
OSMO_ASSERT(trunk);
@ -840,10 +874,11 @@ DEFUN(cfg_mgcp_no_patch_rtp,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_rtp_keepalive,
DEFUN_ATTR(cfg_mgcp_rtp_keepalive,
cfg_mgcp_rtp_keepalive_cmd,
"rtp keep-alive <1-120>",
RTP_STR RTP_KEEPALIVE_STR "Keep alive interval in secs\n")
RTP_STR RTP_KEEPALIVE_STR "Keep alive interval in secs\n",
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
OSMO_ASSERT(trunk);
@ -851,10 +886,11 @@ DEFUN(cfg_mgcp_rtp_keepalive,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_rtp_keepalive_once,
DEFUN_ATTR(cfg_mgcp_rtp_keepalive_once,
cfg_mgcp_rtp_keepalive_once_cmd,
"rtp keep-alive once",
RTP_STR RTP_KEEPALIVE_STR "Send dummy packet only once after CRCX/MDCX\n")
RTP_STR RTP_KEEPALIVE_STR "Send dummy packet only once after CRCX/MDCX\n",
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
OSMO_ASSERT(trunk);
@ -862,9 +898,10 @@ DEFUN(cfg_mgcp_rtp_keepalive_once,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_no_rtp_keepalive,
DEFUN_ATTR(cfg_mgcp_no_rtp_keepalive,
cfg_mgcp_no_rtp_keepalive_cmd,
"no rtp keep-alive", NO_STR RTP_STR RTP_KEEPALIVE_STR)
"no rtp keep-alive", NO_STR RTP_STR RTP_KEEPALIVE_STR,
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
OSMO_ASSERT(trunk);
@ -969,8 +1006,9 @@ static int config_write_trunk(struct vty *vty)
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_sdp_fmtp_extra,
DEFUN_USRATTR(cfg_trunk_sdp_fmtp_extra,
cfg_trunk_sdp_fmtp_extra_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"sdp audio fmtp-extra .NAME",
"Add extra fmtp for the SDP file\n" "Audio\n" "Fmtp-extra\n"
"Extra Information\n")
@ -1017,8 +1055,9 @@ DEFUN_DEPRECATED(cfg_trunk_loop,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_sdp_payload_send_ptime,
DEFUN_USRATTR(cfg_trunk_sdp_payload_send_ptime,
cfg_trunk_sdp_payload_send_ptime_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"sdp audio-payload send-ptime",
SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n")
{
@ -1027,8 +1066,9 @@ DEFUN(cfg_trunk_sdp_payload_send_ptime,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_sdp_payload_send_ptime,
DEFUN_USRATTR(cfg_trunk_no_sdp_payload_send_ptime,
cfg_trunk_no_sdp_payload_send_ptime_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no sdp audio-payload send-ptime",
NO_STR SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n")
{
@ -1037,8 +1077,9 @@ DEFUN(cfg_trunk_no_sdp_payload_send_ptime,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_sdp_payload_send_name,
DEFUN_USRATTR(cfg_trunk_sdp_payload_send_name,
cfg_trunk_sdp_payload_send_name_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"sdp audio-payload send-name",
SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n")
{
@ -1047,8 +1088,9 @@ DEFUN(cfg_trunk_sdp_payload_send_name,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_sdp_payload_send_name,
DEFUN_USRATTR(cfg_trunk_no_sdp_payload_send_name,
cfg_trunk_no_sdp_payload_send_name_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no sdp audio-payload send-name",
NO_STR SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n")
{
@ -1057,23 +1099,29 @@ DEFUN(cfg_trunk_no_sdp_payload_send_name,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_omit_rtcp, cfg_trunk_omit_rtcp_cmd, "rtcp-omit", RTCP_OMIT_STR)
DEFUN_ATTR(cfg_trunk_omit_rtcp,
cfg_trunk_omit_rtcp_cmd,
"rtcp-omit", RTCP_OMIT_STR,
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *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", NO_STR RTCP_OMIT_STR)
DEFUN_ATTR(cfg_trunk_no_omit_rtcp,
cfg_trunk_no_omit_rtcp_cmd,
"no rtcp-omit", NO_STR RTCP_OMIT_STR,
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = vty->index;
trunk->omit_rtcp = 0;
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_patch_rtp_ssrc,
DEFUN_USRATTR(cfg_trunk_patch_rtp_ssrc,
cfg_trunk_patch_rtp_ssrc_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp-patch ssrc", RTP_PATCH_STR "Force a fixed SSRC\n")
{
struct mgcp_trunk *trunk = vty->index;
@ -1081,8 +1129,9 @@ DEFUN(cfg_trunk_patch_rtp_ssrc,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_patch_rtp_ssrc,
DEFUN_USRATTR(cfg_trunk_no_patch_rtp_ssrc,
cfg_trunk_no_patch_rtp_ssrc_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp-patch ssrc", NO_STR RTP_PATCH_STR "Force a fixed SSRC\n")
{
struct mgcp_trunk *trunk = vty->index;
@ -1090,8 +1139,9 @@ DEFUN(cfg_trunk_no_patch_rtp_ssrc,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_patch_rtp_ts,
DEFUN_USRATTR(cfg_trunk_patch_rtp_ts,
cfg_trunk_patch_rtp_ts_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp-patch timestamp", RTP_PATCH_STR "Adjust RTP timestamp\n")
{
struct mgcp_trunk *trunk = vty->index;
@ -1099,8 +1149,9 @@ DEFUN(cfg_trunk_patch_rtp_ts,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_patch_rtp_ts,
DEFUN_USRATTR(cfg_trunk_no_patch_rtp_ts,
cfg_trunk_no_patch_rtp_ts_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp-patch timestamp", NO_STR RTP_PATCH_STR "Adjust RTP timestamp\n")
{
struct mgcp_trunk *trunk = vty->index;
@ -1108,8 +1159,9 @@ DEFUN(cfg_trunk_no_patch_rtp_ts,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_patch_rtp_rfc5993hr,
DEFUN_USRATTR(cfg_trunk_patch_rtp_rfc5993hr,
cfg_trunk_patch_rtp_rfc5993hr_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"rtp-patch rfc5993hr", RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR)
{
struct mgcp_trunk *trunk = vty->index;
@ -1117,8 +1169,9 @@ DEFUN(cfg_trunk_patch_rtp_rfc5993hr,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_patch_rtp_rfc5993hr,
DEFUN_USRATTR(cfg_trunk_no_patch_rtp_rfc5993hr,
cfg_trunk_no_patch_rtp_rfc5993hr_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp-patch rfc5993hr", NO_STR RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR)
{
struct mgcp_trunk *trunk = vty->index;
@ -1126,8 +1179,10 @@ DEFUN(cfg_trunk_no_patch_rtp_rfc5993hr,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_patch_rtp,
cfg_trunk_no_patch_rtp_cmd, "no rtp-patch", NO_STR RTP_PATCH_STR)
DEFUN_USRATTR(cfg_trunk_no_patch_rtp,
cfg_trunk_no_patch_rtp_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no rtp-patch", NO_STR RTP_PATCH_STR)
{
struct mgcp_trunk *trunk = vty->index;
trunk->force_constant_ssrc = 0;
@ -1136,37 +1191,41 @@ DEFUN(cfg_trunk_no_patch_rtp,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_rtp_keepalive,
DEFUN_ATTR(cfg_trunk_rtp_keepalive,
cfg_trunk_rtp_keepalive_cmd,
"rtp keep-alive <1-120>",
RTP_STR RTP_KEEPALIVE_STR "Keep-alive interval in secs\n")
RTP_STR RTP_KEEPALIVE_STR "Keep-alive interval in secs\n",
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = vty->index;
mgcp_trunk_set_keepalive(trunk, atoi(argv[0]));
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_rtp_keepalive_once,
DEFUN_ATTR(cfg_trunk_rtp_keepalive_once,
cfg_trunk_rtp_keepalive_once_cmd,
"rtp keep-alive once",
RTP_STR RTP_KEEPALIVE_STR "Send dummy packet only once after CRCX/MDCX\n")
RTP_STR RTP_KEEPALIVE_STR "Send dummy packet only once after CRCX/MDCX\n",
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = vty->index;
mgcp_trunk_set_keepalive(trunk, MGCP_KEEPALIVE_ONCE);
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_rtp_keepalive,
DEFUN_ATTR(cfg_trunk_no_rtp_keepalive,
cfg_trunk_no_rtp_keepalive_cmd,
"no rtp keep-alive", NO_STR RTP_STR RTP_KEEPALIVE_STR)
"no rtp keep-alive", NO_STR RTP_STR RTP_KEEPALIVE_STR,
CMD_ATTR_IMMEDIATE)
{
struct mgcp_trunk *trunk = vty->index;
mgcp_trunk_set_keepalive(trunk, 0);
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_allow_transcoding,
DEFUN_USRATTR(cfg_trunk_allow_transcoding,
cfg_trunk_allow_transcoding_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"allow-transcoding", "Allow transcoding\n")
{
struct mgcp_trunk *trunk = vty->index;
@ -1174,8 +1233,9 @@ DEFUN(cfg_trunk_allow_transcoding,
return CMD_SUCCESS;
}
DEFUN(cfg_trunk_no_allow_transcoding,
DEFUN_USRATTR(cfg_trunk_no_allow_transcoding,
cfg_trunk_no_allow_transcoding_cmd,
X(MGW_CMD_ATTR_NEWCONN),
"no allow-transcoding", NO_STR "Allow transcoding\n")
{
struct mgcp_trunk *trunk = vty->index;

View File

@ -306,6 +306,10 @@ int main(int argc, char **argv)
return -1;
vty_info.copyright = osmomgw_copyright;
vty_info.usr_attr_desc[MGW_CMD_ATTR_NEWCONN] = \
"This command applies when a new connection is created";
vty_info.usr_attr_letters[MGW_CMD_ATTR_NEWCONN] = 'n';
vty_init(&vty_info);
logging_vty_add_cmds();
osmo_talloc_vty_add_cmds();