[Asterisk-code-review] res_rtp_asterisk: Add 'rtp show settings' cli command (asterisk[master])

Rodrigo Ramirez Norambuena asteriskteam at digium.com
Tue Mar 3 11:46:41 CST 2020


Rodrigo Ramirez Norambuena has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13853 )


Change subject: res_rtp_asterisk: Add 'rtp show settings' cli command
......................................................................

res_rtp_asterisk: Add 'rtp show settings' cli command

This change introduce a CLI command for the RTP to display the general
configuration.

In the first step add the follow fields of the configurations:
  - rtpstart
  - rtpend
  - dtmftimeout
  - rtpchecksum
  - strictrtp
  - learning_min_sequential
  - icesupport

Change-Id: Ibe5450898e2c3e1ed68c10993aa1ac6bf09b821f
---
M res/res_rtp_asterisk.c
1 file changed, 34 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/53/13853/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 969fc2d..5d39487 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -8652,6 +8652,39 @@
 	return CLI_SHOWUSAGE;   /* default, failure */
 }
 
+
+static char *handle_cli_rtp_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "rtp show settings";
+		e->usage =
+			"Usage: rtp show settings\n"
+			"       Display settings configuration of the RTP\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
+
+	ast_cli(a->fd, "\n\nGeneral Settings:\n");
+	ast_cli(a->fd, "----------------\n");
+	ast_cli(a->fd, "  Port start:      %d\n", rtpstart);
+	ast_cli(a->fd, "  Port end:        %d\n", rtpend);
+	ast_cli(a->fd, "  RTP Check sums:  %s\n", AST_CLI_YESNO(nochecksums == 0));
+	ast_cli(a->fd, "  DTFM Timeout:    %d\n", dtmftimeout);
+	ast_cli(a->fd, "  Strict RTP:      %s\n", AST_CLI_YESNO(strictrtp));
+	if (strictrtp)
+		ast_cli(a->fd, "  Probation :      %d\n", learning_min_sequential);
+
+	ast_cli(a->fd, "  ICE support:     %s\n", AST_CLI_YESNO(icesupport));
+
+	return CLI_SUCCESS;
+}
+
+
 static char *handle_cli_rtcp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
@@ -8714,6 +8747,7 @@
 
 static struct ast_cli_entry cli_rtp[] = {
 	AST_CLI_DEFINE(handle_cli_rtp_set_debug,  "Enable/Disable RTP debugging"),
+	AST_CLI_DEFINE(handle_cli_rtp_settings,   "Display RTP settings"),
 	AST_CLI_DEFINE(handle_cli_rtcp_set_debug, "Enable/Disable RTCP debugging"),
 	AST_CLI_DEFINE(handle_cli_rtcp_set_stats, "Enable/Disable RTCP stats"),
 };

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13853
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ibe5450898e2c3e1ed68c10993aa1ac6bf09b821f
Gerrit-Change-Number: 13853
Gerrit-PatchSet: 1
Gerrit-Owner: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200303/5df1efa3/attachment-0001.html>


More information about the asterisk-code-review mailing list