<p>George Joseph would like Joshua Colp, Kevin Harwell, Friendly Automation and Benjamin Keith Ford to <strong>review</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15716">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Revert "res_rtp_asterisk: Add a DEVMODE RTP drop packets CLI command"<br><br>This reverts commit d607afd8d326719d90906922115ce40ecdb6c4a5.<br><br>Reason for revert: possible failed sip dtmf info test<br><br>Change-Id: I30cb1c4d49d29f5660336bfb93b708385430c9f3<br>---<br>M res/res_rtp_asterisk.c<br>1 file changed, 0 insertions(+), 250 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/16/15716/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c</span><br><span>index ac01d39..b0a3f2a 100644</span><br><span>--- a/res/res_rtp_asterisk.c</span><br><span>+++ b/res/res_rtp_asterisk.c</span><br><span>@@ -63,7 +63,6 @@</span><br><span> #include <ifaddrs.h></span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/conversions.h"</span><br><span> #include "asterisk/options.h"</span><br><span> #include "asterisk/logger_category.h"</span><br><span> #include "asterisk/stun.h"</span><br><span>@@ -7530,113 +7529,6 @@</span><br><span> return AST_LIST_FIRST(&frames);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-struct rtp_drop_packets_data {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Whether or not to randomize the number of packets to drop. */</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int use_random_num;</span><br><span style="color: hsl(0, 100%, 40%);">- /* Whether or not to randomize the time interval between packets drops. */</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int use_random_interval;</span><br><span style="color: hsl(0, 100%, 40%);">- /* The total number of packets to drop. If 'use_random_num' is true then this</span><br><span style="color: hsl(0, 100%, 40%);">- * value becomes the upper bound for a number of random packets to drop. */</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int num_to_drop;</span><br><span style="color: hsl(0, 100%, 40%);">- /* The current number of packets that have been dropped during an interval. */</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int num_dropped;</span><br><span style="color: hsl(0, 100%, 40%);">- /* The optional interval to use between packet drops. If 'use_random_interval'</span><br><span style="color: hsl(0, 100%, 40%);">- * is true then this values becomes the upper bound for a random interval used. */</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval interval;</span><br><span style="color: hsl(0, 100%, 40%);">- /* The next time a packet drop should be triggered. */</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval next;</span><br><span style="color: hsl(0, 100%, 40%);">- /* An optional IP address from which to drop packets from. */</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_sockaddr addr;</span><br><span style="color: hsl(0, 100%, 40%);">- /* The optional port from which to drop packets from. */</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int port;</span><br><span style="color: hsl(0, 100%, 40%);">-} drop_packets_data;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static void drop_packets_data_update(struct timeval tv)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- * num_dropped keeps up with the number of packets that have been dropped for a</span><br><span style="color: hsl(0, 100%, 40%);">- * given interval. Once the specified number of packets have been dropped and</span><br><span style="color: hsl(0, 100%, 40%);">- * the next time interval is ready to trigger then set this number to zero (drop</span><br><span style="color: hsl(0, 100%, 40%);">- * the next 'n' packets up to 'num_to_drop'), or if 'use_random_num' is set to</span><br><span style="color: hsl(0, 100%, 40%);">- * true then set to a random number between zero and 'num_to_drop'.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.num_dropped = drop_packets_data.use_random_num ?</span><br><span style="color: hsl(0, 100%, 40%);">- ast_random() % drop_packets_data.num_to_drop : 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- * A specified number of packets can be dropped at a given interval (e.g every</span><br><span style="color: hsl(0, 100%, 40%);">- * 30 seconds). If 'use_random_interval' is false simply add the interval to</span><br><span style="color: hsl(0, 100%, 40%);">- * the given time to get the next trigger point. If set to true, then get a</span><br><span style="color: hsl(0, 100%, 40%);">- * random time between the given time and up to the specified interval.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (drop_packets_data.use_random_interval) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Calculate as a percentage of the specified drop packets interval */</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval interval = ast_time_create_by_unit(ast_time_tv_to_usec(</span><br><span style="color: hsl(0, 100%, 40%);">- &drop_packets_data.interval) * ((double)(ast_random() % 100 + 1) / 100),</span><br><span style="color: hsl(0, 100%, 40%);">- TIME_UNIT_MICROSECOND);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.next = ast_tvadd(tv, interval);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.next = ast_tvadd(tv, drop_packets_data.interval);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int should_drop_packets(struct ast_sockaddr *addr)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval tv;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!drop_packets_data.num_to_drop) {</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- * If an address has been specified then filter on it, and also the port if</span><br><span style="color: hsl(0, 100%, 40%);">- * it too was included.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_sockaddr_isnull(&drop_packets_data.addr) &&</span><br><span style="color: hsl(0, 100%, 40%);">- (drop_packets_data.port ?</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sockaddr_cmp(&drop_packets_data.addr, addr) :</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sockaddr_cmp_addr(&drop_packets_data.addr, addr)) != 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Address and/or port does not match */</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* Keep dropping packets until we've reached the total to drop */</span><br><span style="color: hsl(0, 100%, 40%);">- if (drop_packets_data.num_dropped < drop_packets_data.num_to_drop) {</span><br><span style="color: hsl(0, 100%, 40%);">- ++drop_packets_data.num_dropped;</span><br><span style="color: hsl(0, 100%, 40%);">- return 1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- * Once the set number of packets has been dropped check to see if it's</span><br><span style="color: hsl(0, 100%, 40%);">- * time to drop more.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_tvzero(drop_packets_data.interval)) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* If no interval then drop specified number of packets and be done */</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.num_to_drop = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- tv = ast_tvnow();</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_tvcmp(tv, drop_packets_data.next) == -1) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Still waiting for the next time interval to elapse */</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- * The next time interval has elapsed so update the tracking structure</span><br><span style="color: hsl(0, 100%, 40%);">- * in order to start dropping more packets, and figure out when the next</span><br><span style="color: hsl(0, 100%, 40%);">- * time interval is.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data_update(tv);</span><br><span style="color: hsl(0, 100%, 40%);">- return 1;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*! \pre instance is locked */</span><br><span> static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtcp)</span><br><span> {</span><br><span>@@ -7931,14 +7823,6 @@</span><br><span> seqno &= 0xffff;</span><br><span> timestamp = ntohl(rtpheader[1]);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span style="color: hsl(0, 100%, 40%);">- if (should_drop_packets(&addr)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(0, "(%p) RTP: drop received packet from %s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6d)\n",</span><br><span style="color: hsl(0, 100%, 40%);">- instance, ast_sockaddr_stringify(&addr), payloadtype, seqno, timestamp, res - hdrlen);</span><br><span style="color: hsl(0, 100%, 40%);">- return &ast_null_frame;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (rtp_debug_test_addr(&addr)) {</span><br><span> ast_verbose("Got RTP packet from %s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6d)\n",</span><br><span> ast_sockaddr_stringify(&addr),</span><br><span>@@ -9204,145 +9088,11 @@</span><br><span> return CLI_SUCCESS;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static unsigned int use_random(struct ast_cli_args *a, int pos, unsigned int index)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- return pos >= index && !ast_strlen_zero(a->argv[index - 1]) &&</span><br><span style="color: hsl(0, 100%, 40%);">- !strcasecmp(a->argv[index - 1], "random");</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static char *handle_cli_rtp_drop_incoming_packets(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- static const char * const completions_2[] = { "stop", "<N>", NULL };</span><br><span style="color: hsl(0, 100%, 40%);">- static const char * const completions_3[] = { "random", "incoming packets", NULL };</span><br><span style="color: hsl(0, 100%, 40%);">- static const char * const completions_5[] = { "on", "every", NULL };</span><br><span style="color: hsl(0, 100%, 40%);">- static const char * const completions_units[] = { "random", "usec", "msec", "sec", "min", NULL };</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int use_random_num = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int use_random_interval = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int num_to_drop = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int interval = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *interval_s = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *unit_s = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_sockaddr addr;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *addr_s = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (cmd) {</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_INIT:</span><br><span style="color: hsl(0, 100%, 40%);">- e->command = "rtp drop";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: rtp drop [stop|[<N> [random] incoming packets[ every <N> [random] {usec|msec|sec|min}][ on <ip[:port]>]]\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Drop RTP incoming packets.\n";</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_GENERATE:</span><br><span style="color: hsl(0, 100%, 40%);">- use_random_num = use_random(a, a->pos, 4);</span><br><span style="color: hsl(0, 100%, 40%);">- use_random_interval = use_random(a, a->pos, 8 + use_random_num) ||</span><br><span style="color: hsl(0, 100%, 40%);">- use_random(a, a->pos, 10 + use_random_num);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (a->pos - use_random_num - use_random_interval) {</span><br><span style="color: hsl(0, 100%, 40%);">- case 2:</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_cli_complete(a->word, completions_2, a->n);</span><br><span style="color: hsl(0, 100%, 40%);">- case 3:</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_cli_complete(a->word, completions_3 + use_random_num, a->n);</span><br><span style="color: hsl(0, 100%, 40%);">- case 5:</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_cli_complete(a->word, completions_5, a->n);</span><br><span style="color: hsl(0, 100%, 40%);">- case 7:</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(a->argv[a->pos - 2], "on")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli_completion_add(ast_strdup("every"));</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- /* Fall through */</span><br><span style="color: hsl(0, 100%, 40%);">- case 9:</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(a->argv[a->pos - 2 - use_random_interval], "every")) {</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_cli_complete(a->word, completions_units + use_random_interval, a->n);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 8:</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(a->argv[a->pos - 3 - use_random_interval], "every")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli_completion_add(ast_strdup("on"));</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc < 3) {</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- use_random_num = use_random(a, a->argc, 4);</span><br><span style="color: hsl(0, 100%, 40%);">- use_random_interval = use_random(a, a->argc, 8 + use_random_num) ||</span><br><span style="color: hsl(0, 100%, 40%);">- use_random(a, a->argc, 10 + use_random_num);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(a->argv[2], "stop")) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* rtp drop stop */</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (a->argc < 5) {</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (ast_str_to_uint(a->argv[2], &num_to_drop)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "%s is not a valid number of packets to drop\n", a->argv[2]);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (a->argc - use_random_num == 5) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* rtp drop <N> [random] incoming packets */</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (a->argc - use_random_num >= 7 && !strcasecmp(a->argv[5 + use_random_num], "on")) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* rtp drop <N> [random] incoming packets on <ip[:port]> */</span><br><span style="color: hsl(0, 100%, 40%);">- addr_s = a->argv[6 + use_random_num];</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc - use_random_num - use_random_interval == 10 &&</span><br><span style="color: hsl(0, 100%, 40%);">- !strcasecmp(a->argv[7 + use_random_num], "every")) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* rtp drop <N> [random] incoming packets on <ip[:port]> every <N> [random] {usec|msec|sec|min} */</span><br><span style="color: hsl(0, 100%, 40%);">- interval_s = a->argv[8 + use_random_num];</span><br><span style="color: hsl(0, 100%, 40%);">- unit_s = a->argv[9 + use_random_num + use_random_interval];</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (a->argc - use_random_num >= 8 && !strcasecmp(a->argv[5 + use_random_num], "every")) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* rtp drop <N> [random] incoming packets every <N> [random] {usec|msec|sec|min} */</span><br><span style="color: hsl(0, 100%, 40%);">- interval_s = a->argv[6 + use_random_num];</span><br><span style="color: hsl(0, 100%, 40%);">- unit_s = a->argv[7 + use_random_num + use_random_interval];</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc == 10 + use_random_num + use_random_interval &&</span><br><span style="color: hsl(0, 100%, 40%);">- !strcasecmp(a->argv[8 + use_random_num + use_random_interval], "on")) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* rtp drop <N> [random] incoming packets every <N> [random] {usec|msec|sec|min} on <ip[:port]> */</span><br><span style="color: hsl(0, 100%, 40%);">- addr_s = a->argv[9 + use_random_num + use_random_interval];</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc - use_random_num >= 8 && !interval_s && !addr_s) {</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (interval_s && ast_str_to_uint(interval_s, &interval)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "%s is not a valid interval number\n", interval_s);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- memset(&addr, 0, sizeof(addr));</span><br><span style="color: hsl(0, 100%, 40%);">- if (addr_s && !ast_sockaddr_parse(&addr, addr_s, 0)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "%s is not a valid hostname[:port]\n", addr_s);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.use_random_num = use_random_num;</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.use_random_interval = use_random_interval;</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.num_to_drop = num_to_drop;</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.interval = ast_time_create_by_unit_str(interval, unit_s);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sockaddr_copy(&drop_packets_data.addr, &addr);</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data.port = ast_sockaddr_port(&addr);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- drop_packets_data_update(ast_tvnow());</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static struct ast_cli_entry cli_rtp[] = {</span><br><span> AST_CLI_DEFINE(handle_cli_rtp_set_debug, "Enable/Disable RTP debugging"),</span><br><span> AST_CLI_DEFINE(handle_cli_rtp_settings, "Display RTP settings"),</span><br><span> AST_CLI_DEFINE(handle_cli_rtcp_set_debug, "Enable/Disable RTCP debugging"),</span><br><span> AST_CLI_DEFINE(handle_cli_rtcp_set_stats, "Enable/Disable RTCP stats"),</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef AST_DEVMODE</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(handle_cli_rtp_drop_incoming_packets, "Drop RTP incoming packets"),</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span> };</span><br><span> </span><br><span> static int rtp_reload(int reload, int by_external_config)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15716">change 15716</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15716"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I30cb1c4d49d29f5660336bfb93b708385430c9f3 </div>
<div style="display:none"> Gerrit-Change-Number: 15716 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>