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/gerrit-log@lists.osmocom.org/.
dexter gerrit-no-reply at lists.osmocom.orgdexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/20250 ) Change subject: mgcp_vty: add user attributes to configuration commands ...................................................................... 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 --- M include/osmocom/mgcp/vty.h M src/libosmo-mgcp/mgcp_vty.c M src/osmo-mgw/mgw_main.c 3 files changed, 295 insertions(+), 211 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/50/20250/1 diff --git a/include/osmocom/mgcp/vty.h b/include/osmocom/mgcp/vty.h index bf6b7a8..2fe4953 100644 --- a/include/osmocom/mgcp/vty.h +++ b/include/osmocom/mgcp/vty.h @@ -6,3 +6,9 @@ MGCP_NODE = _LAST_OSMOVTY_NODE + 1, TRUNK_NODE, }; + +enum mgw_vty_cmd_attr { + MGW_VTY_ATTR_RESTART_FULL = 0, + MGW_VTY_ATTR_IMMEDIATE, + MGW_VTY_ATTR_NEW_CONN, +}; diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c index 1df69c6..293856e 100644 --- a/src/libosmo-mgcp/mgcp_vty.c +++ b/src/libosmo-mgcp/mgcp_vty.c @@ -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,34 +409,37 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_local_ip, - cfg_mgcp_local_ip_cmd, - "local ip " VTY_IPV46_CMD, - "Local options for the SDP record\n" - IP_STR - "IPv4 Address to use in SDP record\n" - "IPv6 Address to use in SDP record\n") +DEFUN_USRATTR(cfg_mgcp_local_ip, + cfg_mgcp_local_ip_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "local ip " VTY_IPV46_CMD, + "Local options for the SDP record\n" + IP_STR + "IPv4 Address to use in SDP record\n" + "IPv6 Address to use in SDP record\n") { osmo_talloc_replace_string(g_cfg, &g_cfg->local_ip, argv[0]); return CMD_SUCCESS; } #define BIND_STR "Listen/Bind related socket option\n" -DEFUN(cfg_mgcp_bind_ip, - cfg_mgcp_bind_ip_cmd, - "bind ip " VTY_IPV46_CMD, - BIND_STR IP_STR - "IPv4 Address to bind to\n" - "IPv6 Address to bind to\n") +DEFUN_USRATTR(cfg_mgcp_bind_ip, + cfg_mgcp_bind_ip_cmd, + X(MGW_VTY_ATTR_RESTART_FULL), + "bind ip " VTY_IPV46_CMD, + BIND_STR IP_STR + "IPv4 Address to bind to\n" + "IPv6 Address to bind to\n") { osmo_talloc_replace_string(g_cfg, &g_cfg->source_addr, argv[0]); return CMD_SUCCESS; } -DEFUN(cfg_mgcp_bind_port, - cfg_mgcp_bind_port_cmd, - "bind port <0-65534>", - BIND_STR "Port information\n" "UDP port to listen for MGCP messages\n") +DEFUN_USRATTR(cfg_mgcp_bind_port, + cfg_mgcp_bind_port_cmd, + X(MGW_VTY_ATTR_RESTART_FULL), + "bind port <0-65534>", + BIND_STR "Port information\n" "UDP port to listen for MGCP messages\n") { unsigned int port = atoi(argv[0]); g_cfg->source_port = port; @@ -457,11 +461,12 @@ #define RANGE_START_STR "Start of the range of ports\n" #define RANGE_END_STR "End of the range of ports\n" -DEFUN(cfg_mgcp_rtp_port_range, - cfg_mgcp_rtp_port_range_cmd, - "rtp port-range <1024-65534> <1025-65535>", - RTP_STR "Range of ports to use for the NET side\n" - RANGE_START_STR RANGE_END_STR) +DEFUN_USRATTR(cfg_mgcp_rtp_port_range, + cfg_mgcp_rtp_port_range_cmd, + X(MGW_VTY_ATTR_RESTART_FULL), + "rtp port-range <1024-65534> <1025-65535>", + RTP_STR "Range of ports to use for the NET side\n" + RANGE_START_STR RANGE_END_STR) { int start; int end; @@ -499,11 +504,12 @@ RTP_STR "Range of ports to use for the NET side\n" RANGE_START_STR RANGE_END_STR) -DEFUN(cfg_mgcp_rtp_bind_ip, - cfg_mgcp_rtp_bind_ip_cmd, - "rtp bind-ip A.B.C.D", - RTP_STR "Bind endpoints facing the Network\n" - "IPv4 Address to bind to\n") +DEFUN_USRATTR(cfg_mgcp_rtp_bind_ip, + cfg_mgcp_rtp_bind_ip_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "rtp bind-ip A.B.C.D", + RTP_STR "Bind endpoints facing the Network\n" + "IPv4 Address to bind to\n") { osmo_talloc_replace_string(g_cfg, &g_cfg->net_ports.bind_addr_v4, argv[0]); return CMD_SUCCESS; @@ -513,11 +519,12 @@ "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, - cfg_mgcp_rtp_no_bind_ip_cmd, - "no rtp bind-ip", - NO_STR RTP_STR "Bind endpoints facing the Network\n" - "Address to bind to\n") +DEFUN_USRATTR(cfg_mgcp_rtp_no_bind_ip, + cfg_mgcp_rtp_no_bind_ip_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no rtp bind-ip", + NO_STR RTP_STR "Bind endpoints facing the Network\n" + "Address to bind to\n") { talloc_free(g_cfg->net_ports.bind_addr_v4); g_cfg->net_ports.bind_addr_v4 = NULL; @@ -529,50 +536,55 @@ NO_STR RTP_STR "Bind endpoints facing the Network\n" "Address to bind to\n") -DEFUN(cfg_mgcp_rtp_bind_ip_v6, - cfg_mgcp_rtp_bind_ip_v6_cmd, - "rtp bind-ip-v6 " VTY_IPV6_CMD, - RTP_STR "Bind endpoints facing the Network\n" - "IPv6 Address to bind to\n") +DEFUN_USRATTR(cfg_mgcp_rtp_bind_ip_v6, + cfg_mgcp_rtp_bind_ip_v6_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "rtp bind-ip-v6 " VTY_IPV6_CMD, + RTP_STR "Bind endpoints facing the Network\n" + "IPv6 Address to bind to\n") { osmo_talloc_replace_string(g_cfg, &g_cfg->net_ports.bind_addr_v6, argv[0]); 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_VTY_ATTR_NEW_CONN), + "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, - cfg_mgcp_rtp_net_bind_ip_probing_cmd, - "rtp ip-probing", - RTP_STR "automatic rtp bind ip selection\n") +DEFUN_USRATTR(cfg_mgcp_rtp_net_bind_ip_probing, + cfg_mgcp_rtp_net_bind_ip_probing_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "rtp ip-probing", + RTP_STR "automatic rtp bind ip selection\n") { g_cfg->net_ports.bind_addr_probe = true; return CMD_SUCCESS; } -DEFUN(cfg_mgcp_rtp_no_net_bind_ip_probing, - cfg_mgcp_rtp_no_net_bind_ip_probing_cmd, - "no rtp ip-probing", - NO_STR RTP_STR "no automatic rtp bind ip selection\n") +DEFUN_USRATTR(cfg_mgcp_rtp_no_net_bind_ip_probing, + cfg_mgcp_rtp_no_net_bind_ip_probing_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no rtp ip-probing", + NO_STR RTP_STR "no automatic rtp bind ip selection\n") { g_cfg->net_ports.bind_addr_probe = false; return CMD_SUCCESS; } -DEFUN(cfg_mgcp_rtp_ip_dscp, - cfg_mgcp_rtp_ip_dscp_cmd, - "rtp ip-dscp <0-255>", - RTP_STR - "Apply IP_TOS to the audio stream (including Osmux)\n" "The DSCP value\n") +DEFUN_USRATTR(cfg_mgcp_rtp_ip_dscp, + cfg_mgcp_rtp_ip_dscp_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "rtp ip-dscp <0-255>", + RTP_STR + "Apply IP_TOS to the audio stream (including Osmux)\n" "The DSCP value\n") { int dscp = atoi(argv[0]); g_cfg->endp_dscp = dscp; @@ -584,29 +596,32 @@ 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, - cfg_mgcp_rtp_force_ptime_cmd, - "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") +DEFUN_USRATTR(cfg_mgcp_rtp_force_ptime, + cfg_mgcp_rtp_force_ptime_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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") { g_cfg->force_ptime = atoi(argv[0]); return CMD_SUCCESS; } -DEFUN(cfg_mgcp_no_rtp_force_ptime, - cfg_mgcp_no_rtp_force_ptime_cmd, - "no rtp force-ptime", NO_STR RTP_STR FORCE_PTIME_STR) +DEFUN_USRATTR(cfg_mgcp_no_rtp_force_ptime, + cfg_mgcp_no_rtp_force_ptime_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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, - cfg_mgcp_sdp_fmtp_extra_cmd, - "sdp audio fmtp-extra .NAME", - "Add extra fmtp for the SDP file\n" "Audio\n" "Fmtp-extra\n" - "Extra Information\n") +DEFUN_USRATTR(cfg_mgcp_sdp_fmtp_extra, + cfg_mgcp_sdp_fmtp_extra_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "sdp audio fmtp-extra .NAME", + "Add extra fmtp for the SDP file\n" "Audio\n" "Fmtp-extra\n" + "Extra Information\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -619,9 +634,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_allow_transcoding, - cfg_mgcp_allow_transcoding_cmd, - "allow-transcoding", "Allow transcoding\n") +DEFUN_USRATTR(cfg_mgcp_allow_transcoding, + cfg_mgcp_allow_transcoding_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "allow-transcoding", "Allow transcoding\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -629,9 +645,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_no_allow_transcoding, - cfg_mgcp_no_allow_transcoding_cmd, - "no allow-transcoding", NO_STR "Allow transcoding\n") +DEFUN_USRATTR(cfg_mgcp_no_allow_transcoding, + cfg_mgcp_no_allow_transcoding_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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); OSMO_ASSERT(trunk); @@ -666,10 +683,11 @@ "sdp audio payload name NAME", SDP_STR AUDIO_STR AUDIO_STR "Name\n" "Payload name\n") -DEFUN(cfg_mgcp_sdp_payload_send_ptime, - cfg_mgcp_sdp_payload_send_ptime_cmd, - "sdp audio-payload send-ptime", - SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n") +DEFUN_USRATTR(cfg_mgcp_sdp_payload_send_ptime, + cfg_mgcp_sdp_payload_send_ptime_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "sdp audio-payload send-ptime", + SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -677,10 +695,11 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_no_sdp_payload_send_ptime, - cfg_mgcp_no_sdp_payload_send_ptime_cmd, - "no sdp audio-payload send-ptime", - NO_STR SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n") +DEFUN_USRATTR(cfg_mgcp_no_sdp_payload_send_ptime, + cfg_mgcp_no_sdp_payload_send_ptime_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no sdp audio-payload send-ptime", + NO_STR SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -688,10 +707,11 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_sdp_payload_send_name, - cfg_mgcp_sdp_payload_send_name_cmd, - "sdp audio-payload send-name", - SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n") +DEFUN_USRATTR(cfg_mgcp_sdp_payload_send_name, + cfg_mgcp_sdp_payload_send_name_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "sdp audio-payload send-name", + SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -699,10 +719,11 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_no_sdp_payload_send_name, - cfg_mgcp_no_sdp_payload_send_name_cmd, - "no sdp audio-payload send-name", - NO_STR SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n") +DEFUN_USRATTR(cfg_mgcp_no_sdp_payload_send_name, + cfg_mgcp_no_sdp_payload_send_name_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no sdp audio-payload send-name", + NO_STR SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -718,11 +739,12 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_force_realloc, - cfg_mgcp_force_realloc_cmd, - "force-realloc (0|1)", - "Force endpoint reallocation when the endpoint is still seized\n" - "Don't force reallocation\n" "force reallocation\n") +DEFUN_USRATTR(cfg_mgcp_force_realloc, + cfg_mgcp_force_realloc_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "force-realloc (0|1)", + "Force endpoint reallocation when the endpoint is still seized\n" + "Don't force reallocation\n" "force reallocation\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -730,11 +752,12 @@ return CMD_SUCCESS; } -DEFUN(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") +DEFUN_USRATTR(cfg_mgcp_rtp_accept_all, + cfg_mgcp_rtp_accept_all_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "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") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -742,10 +765,11 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_number_endp, - cfg_mgcp_number_endp_cmd, - "number endpoints <1-65534>", - "Number options\n" "Endpoints available\n" "Number endpoints\n") +DEFUN_USRATTR(cfg_mgcp_number_endp, + cfg_mgcp_number_endp_cmd, + X(MGW_VTY_ATTR_RESTART_FULL), + "number endpoints <1-65534>", + "Number options\n" "Endpoints available\n" "Number endpoints\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -753,15 +777,21 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_omit_rtcp, cfg_mgcp_omit_rtcp_cmd, "rtcp-omit", RTCP_OMIT_STR) +DEFUN_USRATTR(cfg_mgcp_omit_rtcp, + cfg_mgcp_omit_rtcp_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "rtcp-omit", RTCP_OMIT_STR) { 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_USRATTR(cfg_mgcp_no_omit_rtcp, + cfg_mgcp_no_omit_rtcp_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "no rtcp-omit", + NO_STR RTCP_OMIT_STR) { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -769,9 +799,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_patch_rtp_ssrc, - cfg_mgcp_patch_rtp_ssrc_cmd, - "rtp-patch ssrc", RTP_PATCH_STR "Force a fixed SSRC\n") +DEFUN_USRATTR(cfg_mgcp_patch_rtp_ssrc, + cfg_mgcp_patch_rtp_ssrc_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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); OSMO_ASSERT(trunk); @@ -779,9 +810,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_no_patch_rtp_ssrc, - cfg_mgcp_no_patch_rtp_ssrc_cmd, - "no rtp-patch ssrc", NO_STR RTP_PATCH_STR "Force a fixed SSRC\n") +DEFUN_USRATTR(cfg_mgcp_no_patch_rtp_ssrc, + cfg_mgcp_no_patch_rtp_ssrc_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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); OSMO_ASSERT(trunk); @@ -789,9 +821,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_patch_rtp_ts, - cfg_mgcp_patch_rtp_ts_cmd, - "rtp-patch timestamp", RTP_PATCH_STR "Adjust RTP timestamp\n") +DEFUN_USRATTR(cfg_mgcp_patch_rtp_ts, + cfg_mgcp_patch_rtp_ts_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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); OSMO_ASSERT(trunk); @@ -799,9 +832,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_no_patch_rtp_ts, - cfg_mgcp_no_patch_rtp_ts_cmd, - "no rtp-patch timestamp", NO_STR RTP_PATCH_STR "Adjust RTP timestamp\n") +DEFUN_USRATTR(cfg_mgcp_no_patch_rtp_ts, + cfg_mgcp_no_patch_rtp_ts_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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); OSMO_ASSERT(trunk); @@ -809,9 +843,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_patch_rtp_rfc5993hr, - cfg_mgcp_patch_rtp_rfc5993hr_cmd, - "rtp-patch rfc5993hr", RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR) +DEFUN_USRATTR(cfg_mgcp_patch_rtp_rfc5993hr, + cfg_mgcp_patch_rtp_rfc5993hr_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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); OSMO_ASSERT(trunk); @@ -819,9 +854,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_no_patch_rtp_rfc5993hr, - cfg_mgcp_no_patch_rtp_rfc5993hr_cmd, - "no rtp-patch rfc5993hr", NO_STR RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR) +DEFUN_USRATTR(cfg_mgcp_no_patch_rtp_rfc5993hr, + cfg_mgcp_no_patch_rtp_rfc5993hr_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "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); OSMO_ASSERT(trunk); @@ -829,8 +865,10 @@ 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_VTY_ATTR_NEW_CONN), + "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 +878,11 @@ return CMD_SUCCESS; } -DEFUN(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") +DEFUN_USRATTR(cfg_mgcp_rtp_keepalive, + cfg_mgcp_rtp_keepalive_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "rtp keep-alive <1-120>", + RTP_STR RTP_KEEPALIVE_STR "Keep alive interval in secs\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -851,10 +890,11 @@ return CMD_SUCCESS; } -DEFUN(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") +DEFUN_USRATTR(cfg_mgcp_rtp_keepalive_once, + cfg_mgcp_rtp_keepalive_once_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "rtp keep-alive once", + RTP_STR RTP_KEEPALIVE_STR "Send dummy packet only once after CRCX/MDCX\n") { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -862,9 +902,10 @@ return CMD_SUCCESS; } -DEFUN(cfg_mgcp_no_rtp_keepalive, - cfg_mgcp_no_rtp_keepalive_cmd, - "no rtp keep-alive", NO_STR RTP_STR RTP_KEEPALIVE_STR) +DEFUN_USRATTR(cfg_mgcp_no_rtp_keepalive, + cfg_mgcp_no_rtp_keepalive_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "no rtp keep-alive", NO_STR RTP_STR RTP_KEEPALIVE_STR) { struct mgcp_trunk *trunk = mgcp_trunk_by_num(g_cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); OSMO_ASSERT(trunk); @@ -873,12 +914,13 @@ } #define CALL_AGENT_STR "Call agent information\n" -DEFUN(cfg_mgcp_agent_addr, - cfg_mgcp_agent_addr_cmd, - "call-agent ip " VTY_IPV46_CMD, - CALL_AGENT_STR IP_STR - "IPv4 Address of the call agent\n" - "IPv6 Address of the call agent\n") +DEFUN_USRATTR(cfg_mgcp_agent_addr, + cfg_mgcp_agent_addr_cmd, + X(MGW_VTY_ATTR_RESTART_FULL), + "call-agent ip " VTY_IPV46_CMD, + CALL_AGENT_STR IP_STR + "IPv4 Address of the call agent\n" + "IPv6 Address of the call agent\n") { osmo_talloc_replace_string(g_cfg, &g_cfg->call_agent_addr, argv[0]); return CMD_SUCCESS; @@ -889,8 +931,10 @@ CALL_AGENT_STR CALL_AGENT_STR IP_STR "IPv4 Address of the callagent\n") -DEFUN(cfg_mgcp_trunk, cfg_mgcp_trunk_cmd, - "trunk <0-64>", "Configure a SS7 trunk\n" "Trunk Nr\n") +DEFUN_USRATTR(cfg_mgcp_trunk, + cfg_mgcp_trunk_cmd, + X(MGW_VTY_ATTR_RESTART_FULL), + "trunk <0-64>", "Configure a SS7 trunk\n" "Trunk Nr\n") { struct mgcp_trunk *trunk; int index = atoi(argv[0]); @@ -969,11 +1013,12 @@ return CMD_SUCCESS; } -DEFUN(cfg_trunk_sdp_fmtp_extra, - cfg_trunk_sdp_fmtp_extra_cmd, - "sdp audio fmtp-extra .NAME", - "Add extra fmtp for the SDP file\n" "Audio\n" "Fmtp-extra\n" - "Extra Information\n") +DEFUN_USRATTR(cfg_trunk_sdp_fmtp_extra, + cfg_trunk_sdp_fmtp_extra_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "sdp audio fmtp-extra .NAME", + "Add extra fmtp for the SDP file\n" "Audio\n" "Fmtp-extra\n" + "Extra Information\n") { struct mgcp_trunk *trunk = vty->index; char *txt = argv_concat(argv, argc, 0); @@ -1017,117 +1062,134 @@ return CMD_SUCCESS; } -DEFUN(cfg_trunk_sdp_payload_send_ptime, - cfg_trunk_sdp_payload_send_ptime_cmd, - "sdp audio-payload send-ptime", - SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n") +DEFUN_USRATTR(cfg_trunk_sdp_payload_send_ptime, + cfg_trunk_sdp_payload_send_ptime_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "sdp audio-payload send-ptime", + SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n") { struct mgcp_trunk *trunk = vty->index; trunk->audio_send_ptime = 1; return CMD_SUCCESS; } -DEFUN(cfg_trunk_no_sdp_payload_send_ptime, - cfg_trunk_no_sdp_payload_send_ptime_cmd, - "no sdp audio-payload send-ptime", - NO_STR SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n") +DEFUN_USRATTR(cfg_trunk_no_sdp_payload_send_ptime, + cfg_trunk_no_sdp_payload_send_ptime_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no sdp audio-payload send-ptime", + NO_STR SDP_STR AUDIO_STR "Send SDP ptime (packet duration) attribute\n") { struct mgcp_trunk *trunk = vty->index; trunk->audio_send_ptime = 0; return CMD_SUCCESS; } -DEFUN(cfg_trunk_sdp_payload_send_name, - cfg_trunk_sdp_payload_send_name_cmd, - "sdp audio-payload send-name", - SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n") +DEFUN_USRATTR(cfg_trunk_sdp_payload_send_name, + cfg_trunk_sdp_payload_send_name_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "sdp audio-payload send-name", + SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n") { struct mgcp_trunk *trunk = vty->index; trunk->audio_send_name = 1; return CMD_SUCCESS; } -DEFUN(cfg_trunk_no_sdp_payload_send_name, - cfg_trunk_no_sdp_payload_send_name_cmd, - "no sdp audio-payload send-name", - NO_STR SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n") +DEFUN_USRATTR(cfg_trunk_no_sdp_payload_send_name, + cfg_trunk_no_sdp_payload_send_name_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no sdp audio-payload send-name", + NO_STR SDP_STR AUDIO_STR "Send SDP rtpmap with the audio name\n") { struct mgcp_trunk *trunk = vty->index; trunk->audio_send_name = 0; return CMD_SUCCESS; } -DEFUN(cfg_trunk_omit_rtcp, cfg_trunk_omit_rtcp_cmd, "rtcp-omit", RTCP_OMIT_STR) +DEFUN_USRATTR(cfg_trunk_omit_rtcp, + cfg_trunk_omit_rtcp_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "rtcp-omit", RTCP_OMIT_STR) { 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_USRATTR(cfg_trunk_no_omit_rtcp, + cfg_trunk_no_omit_rtcp_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "no rtcp-omit", NO_STR RTCP_OMIT_STR) { struct mgcp_trunk *trunk = vty->index; trunk->omit_rtcp = 0; return CMD_SUCCESS; } -DEFUN(cfg_trunk_patch_rtp_ssrc, - cfg_trunk_patch_rtp_ssrc_cmd, - "rtp-patch ssrc", RTP_PATCH_STR "Force a fixed SSRC\n") +DEFUN_USRATTR(cfg_trunk_patch_rtp_ssrc, + cfg_trunk_patch_rtp_ssrc_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "rtp-patch ssrc", RTP_PATCH_STR "Force a fixed SSRC\n") { struct mgcp_trunk *trunk = vty->index; trunk->force_constant_ssrc = 1; return CMD_SUCCESS; } -DEFUN(cfg_trunk_no_patch_rtp_ssrc, - cfg_trunk_no_patch_rtp_ssrc_cmd, - "no rtp-patch ssrc", NO_STR RTP_PATCH_STR "Force a fixed SSRC\n") +DEFUN_USRATTR(cfg_trunk_no_patch_rtp_ssrc, + cfg_trunk_no_patch_rtp_ssrc_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no rtp-patch ssrc", NO_STR RTP_PATCH_STR "Force a fixed SSRC\n") { struct mgcp_trunk *trunk = vty->index; trunk->force_constant_ssrc = 0; return CMD_SUCCESS; } -DEFUN(cfg_trunk_patch_rtp_ts, - cfg_trunk_patch_rtp_ts_cmd, - "rtp-patch timestamp", RTP_PATCH_STR "Adjust RTP timestamp\n") +DEFUN_USRATTR(cfg_trunk_patch_rtp_ts, + cfg_trunk_patch_rtp_ts_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "rtp-patch timestamp", RTP_PATCH_STR "Adjust RTP timestamp\n") { struct mgcp_trunk *trunk = vty->index; trunk->force_aligned_timing = 1; return CMD_SUCCESS; } -DEFUN(cfg_trunk_no_patch_rtp_ts, - cfg_trunk_no_patch_rtp_ts_cmd, - "no rtp-patch timestamp", NO_STR RTP_PATCH_STR "Adjust RTP timestamp\n") +DEFUN_USRATTR(cfg_trunk_no_patch_rtp_ts, + cfg_trunk_no_patch_rtp_ts_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no rtp-patch timestamp", NO_STR RTP_PATCH_STR "Adjust RTP timestamp\n") { struct mgcp_trunk *trunk = vty->index; trunk->force_aligned_timing = 0; return CMD_SUCCESS; } -DEFUN(cfg_trunk_patch_rtp_rfc5993hr, - cfg_trunk_patch_rtp_rfc5993hr_cmd, - "rtp-patch rfc5993hr", RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR) +DEFUN_USRATTR(cfg_trunk_patch_rtp_rfc5993hr, + cfg_trunk_patch_rtp_rfc5993hr_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "rtp-patch rfc5993hr", RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR) { struct mgcp_trunk *trunk = vty->index; trunk->rfc5993_hr_convert = true; return CMD_SUCCESS; } -DEFUN(cfg_trunk_no_patch_rtp_rfc5993hr, - cfg_trunk_no_patch_rtp_rfc5993hr_cmd, - "no rtp-patch rfc5993hr", NO_STR RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR) +DEFUN_USRATTR(cfg_trunk_no_patch_rtp_rfc5993hr, + cfg_trunk_no_patch_rtp_rfc5993hr_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no rtp-patch rfc5993hr", NO_STR RTP_PATCH_STR RTP_TS101318_RFC5993_CONV_STR) { struct mgcp_trunk *trunk = vty->index; trunk->rfc5993_hr_convert = false; 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_VTY_ATTR_NEW_CONN), + "no rtp-patch", NO_STR RTP_PATCH_STR) { struct mgcp_trunk *trunk = vty->index; trunk->force_constant_ssrc = 0; @@ -1136,47 +1198,52 @@ return CMD_SUCCESS; } -DEFUN(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") +DEFUN_USRATTR(cfg_trunk_rtp_keepalive, + cfg_trunk_rtp_keepalive_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "rtp keep-alive <1-120>", + RTP_STR RTP_KEEPALIVE_STR "Keep-alive interval in secs\n") { struct mgcp_trunk *trunk = vty->index; mgcp_trunk_set_keepalive(trunk, atoi(argv[0])); return CMD_SUCCESS; } -DEFUN(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") +DEFUN_USRATTR(cfg_trunk_rtp_keepalive_once, + cfg_trunk_rtp_keepalive_once_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "rtp keep-alive once", + RTP_STR RTP_KEEPALIVE_STR "Send dummy packet only once after CRCX/MDCX\n") { struct mgcp_trunk *trunk = vty->index; mgcp_trunk_set_keepalive(trunk, MGCP_KEEPALIVE_ONCE); return CMD_SUCCESS; } -DEFUN(cfg_trunk_no_rtp_keepalive, - cfg_trunk_no_rtp_keepalive_cmd, - "no rtp keep-alive", NO_STR RTP_STR RTP_KEEPALIVE_STR) +DEFUN_USRATTR(cfg_trunk_no_rtp_keepalive, + cfg_trunk_no_rtp_keepalive_cmd, + X(MGW_VTY_ATTR_IMMEDIATE), + "no rtp keep-alive", NO_STR RTP_STR RTP_KEEPALIVE_STR) { struct mgcp_trunk *trunk = vty->index; mgcp_trunk_set_keepalive(trunk, 0); return CMD_SUCCESS; } -DEFUN(cfg_trunk_allow_transcoding, - cfg_trunk_allow_transcoding_cmd, - "allow-transcoding", "Allow transcoding\n") +DEFUN_USRATTR(cfg_trunk_allow_transcoding, + cfg_trunk_allow_transcoding_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "allow-transcoding", "Allow transcoding\n") { struct mgcp_trunk *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") +DEFUN_USRATTR(cfg_trunk_no_allow_transcoding, + cfg_trunk_no_allow_transcoding_cmd, + X(MGW_VTY_ATTR_NEW_CONN), + "no allow-transcoding", NO_STR "Allow transcoding\n") { struct mgcp_trunk *trunk = vty->index; trunk->no_audio_transcoding = 1; @@ -1185,10 +1252,11 @@ #define LINE_STR "Configure trunk for given Line\nE1/T1 Line Number\n" -DEFUN(cfg_trunk_line, - cfg_trunk_line_cmd, - "line <0-255>", - LINE_STR) +DEFUN_USRATTR(cfg_trunk_line, + cfg_trunk_line_cmd, + X(MGW_VTY_ATTR_RESTART_FULL), + "line <0-255>", + LINE_STR) { struct mgcp_trunk *trunk = vty->index; int line_nr = atoi(argv[0]); diff --git a/src/osmo-mgw/mgw_main.c b/src/osmo-mgw/mgw_main.c index 37357a0..c913373 100644 --- a/src/osmo-mgw/mgw_main.c +++ b/src/osmo-mgw/mgw_main.c @@ -306,6 +306,16 @@ return -1; vty_info.copyright = osmomgw_copyright; + vty_info.usr_attr_desc[MGW_VTY_ATTR_RESTART_FULL] = \ + "This command applies on full program restart"; + vty_info.usr_attr_desc[MGW_VTY_ATTR_IMMEDIATE] = \ + "This command applies immediately"; + vty_info.usr_attr_desc[MGW_VTY_ATTR_NEW_CONN] = \ + "This command applies when a new connection is created"; + vty_info.usr_attr_letters[MGW_VTY_ATTR_RESTART_FULL] = 'F'; + vty_info.usr_attr_letters[MGW_VTY_ATTR_IMMEDIATE] = 'I'; + vty_info.usr_attr_letters[MGW_VTY_ATTR_NEW_CONN] = 'N'; + vty_init(&vty_info); logging_vty_add_cmds(); osmo_talloc_vty_add_cmds(); -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/20250 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I2d9487801b3b78f94577264b56d217c926ef76a9 Gerrit-Change-Number: 20250 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200922/5cafedf4/attachment.htm>