summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c42
-rw-r--r--channels/chan_alsa.c270
-rw-r--r--channels/chan_features.c19
-rw-r--r--channels/chan_h323.c76
-rw-r--r--channels/chan_iax2.c276
-rw-r--r--channels/chan_local.c19
-rw-r--r--channels/chan_mgcp.c138
-rw-r--r--channels/chan_misdn.c4
-rw-r--r--channels/chan_oss.c429
-rw-r--r--channels/chan_sip.c237
-rw-r--r--channels/chan_skinny.c80
-rw-r--r--channels/chan_zap.c87
-rw-r--r--channels/iax2-provision.c18
13 files changed, 1316 insertions, 379 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 18f1f6250..d5c327965 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1682,11 +1682,11 @@ static int agents_show_online(int fd, int argc, char **argv)
static char show_agents_usage[] =
-"Usage: show agents\n"
+"Usage: agent list\n"
" Provides summary information on agents.\n";
static char show_agents_online_usage[] =
-"Usage: show agents\n"
+"Usage: agent list online\n"
" Provides a list of all online agents.\n";
static char agent_logoff_usage[] =
@@ -1694,17 +1694,29 @@ static char agent_logoff_usage[] =
" Sets an agent as no longer logged in.\n"
" If 'soft' is specified, do not hangup existing calls.\n";
-static struct ast_cli_entry cli_show_agents = {
- { "show", "agents", NULL }, agents_show,
- "Show status of agents", show_agents_usage, NULL };
+static struct ast_cli_entry cli_show_agents_deprecated = {
+ { "show", "agents", NULL },
+ agents_show, NULL,
+ NULL, NULL };
-static struct ast_cli_entry cli_show_agents_online = {
- { "show", "agents", "online" }, agents_show_online,
- "Show all online agents", show_agents_online_usage, NULL };
+static struct ast_cli_entry cli_show_agents_online_deprecated = {
+ { "show", "agents", "online" },
+ agents_show_online, NULL,
+ NULL, NULL };
-static struct ast_cli_entry cli_agent_logoff = {
- { "agent", "logoff", NULL }, agent_logoff_cmd,
- "Sets an agent offline", agent_logoff_usage, complete_agent_logoff_cmd };
+static struct ast_cli_entry cli_agents[] = {
+ { { "agent", "list", NULL },
+ agents_show, "Show status of agents",
+ show_agents_usage, NULL, &cli_show_agents_deprecated },
+
+ { { "agent", "list", "online" },
+ agents_show_online, "Show all online agents",
+ show_agents_online_usage, NULL, &cli_show_agents_online_deprecated },
+
+ { { "agent", "logoff", NULL },
+ agent_logoff_cmd, "Sets an agent offline",
+ agent_logoff_usage, complete_agent_logoff_cmd },
+};
/*!
* \brief Log in agent application.
@@ -2560,9 +2572,7 @@ static int load_module(void)
ast_manager_register2("AgentCallbackLogin", EVENT_FLAG_AGENT, action_agent_callback_login, "Sets an agent as logged in by callback", mandescr_agent_callback_login);
/* CLI Commands */
- ast_cli_register(&cli_show_agents);
- ast_cli_register(&cli_show_agents_online);
- ast_cli_register(&cli_agent_logoff);
+ ast_cli_register_multiple(cli_agents, sizeof(cli_agents) / sizeof(struct ast_cli_entry));
/* Dialplan Functions */
ast_custom_function_register(&agent_function);
@@ -2586,9 +2596,7 @@ static int unload_module(void)
/* Unregister dialplan functions */
ast_custom_function_unregister(&agent_function);
/* Unregister CLI commands */
- ast_cli_unregister(&cli_show_agents);
- ast_cli_unregister(&cli_show_agents_online);
- ast_cli_unregister(&cli_agent_logoff);
+ ast_cli_unregister_multiple(cli_agents, sizeof(cli_agents) / sizeof(struct ast_cli_entry));
/* Unregister dialplan applications */
ast_unregister_application(app);
ast_unregister_application(app2);
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index 7dfd55df7..c3a4315e7 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -841,7 +841,7 @@ static struct ast_channel *alsa_request(const char *type, int format, void *data
return tmp;
}
-static int console_autoanswer(int fd, int argc, char *argv[])
+static int console_autoanswer_deprecated(int fd, int argc, char *argv[])
{
int res = RESULT_SUCCESS;
@@ -866,6 +866,26 @@ static int console_autoanswer(int fd, int argc, char *argv[])
return res;
}
+static int console_autoanswer(int fd, int argc, char *argv[])
+{
+ int res = RESULT_SUCCESS;;
+ if ((argc != 2) && (argc != 3))
+ return RESULT_SHOWUSAGE;
+ ast_mutex_lock(&alsalock);
+ if (argc == 2) {
+ ast_cli(fd, "Auto answer is %s.\n", autoanswer ? "on" : "off");
+ } else {
+ if (!strcasecmp(argv[2], "on"))
+ autoanswer = -1;
+ else if (!strcasecmp(argv[2], "off"))
+ autoanswer = 0;
+ else
+ res = RESULT_SHOWUSAGE;
+ }
+ ast_mutex_unlock(&alsalock);
+ return res;
+}
+
static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
{
#ifndef MIN
@@ -885,11 +905,12 @@ static char *autoanswer_complete(const char *line, const char *word, int pos, in
}
static const char autoanswer_usage[] =
- "Usage: autoanswer [on|off]\n"
+ "Usage: console autoanswer [on|off]\n"
" Enables or disables autoanswer feature. If used without\n"
- " argument, displays the current on/off status of autoanswer.\n" " The default value of autoanswer is in 'alsa.conf'.\n";
+ " argument, displays the current on/off status of autoanswer.\n"
+ " The default value of autoanswer is in 'alsa.conf'.\n";
-static int console_answer(int fd, int argc, char *argv[])
+static int console_answer_deprecated(int fd, int argc, char *argv[])
{
int res = RESULT_SUCCESS;
@@ -921,9 +942,43 @@ static int console_answer(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char sendtext_usage[] = "Usage: send text <message>\n" " Sends a text message for display on the remote terminal.\n";
+static int console_answer(int fd, int argc, char *argv[])
+{
+ int res = RESULT_SUCCESS;
-static int console_sendtext(int fd, int argc, char *argv[])
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+
+ ast_mutex_lock(&alsalock);
+
+ if (!alsa.owner) {
+ ast_cli(fd, "No one is calling us\n");
+ res = RESULT_FAILURE;
+ } else {
+ hookstate = 1;
+ cursound = -1;
+ grab_owner();
+ if (alsa.owner) {
+ struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
+ ast_queue_frame(alsa.owner, &f);
+ ast_mutex_unlock(&alsa.owner->lock);
+ }
+ answer_sound();
+ }
+
+ snd_pcm_prepare(alsa.icard);
+ snd_pcm_start(alsa.icard);
+
+ ast_mutex_unlock(&alsalock);
+
+ return RESULT_SUCCESS;
+}
+
+static char sendtext_usage[] =
+ "Usage: console send text <message>\n"
+ " Sends a text message for display on the remote terminal.\n";
+
+static int console_sendtext_deprecated(int fd, int argc, char *argv[])
{
int tmparg = 2;
int res = RESULT_SUCCESS;
@@ -964,9 +1019,52 @@ static int console_sendtext(int fd, int argc, char *argv[])
return res;
}
-static char answer_usage[] = "Usage: answer\n" " Answers an incoming call on the console (ALSA) channel.\n";
+static int console_sendtext(int fd, int argc, char *argv[])
+{
+ int tmparg = 3;
+ int res = RESULT_SUCCESS;
-static int console_hangup(int fd, int argc, char *argv[])
+ if (argc < 3)
+ return RESULT_SHOWUSAGE;
+
+ ast_mutex_lock(&alsalock);
+
+ if (!alsa.owner) {
+ ast_cli(fd, "No one is calling us\n");
+ res = RESULT_FAILURE;
+ } else {
+ struct ast_frame f = { AST_FRAME_TEXT, 0 };
+ char text2send[256] = "";
+ text2send[0] = '\0';
+ while (tmparg < argc) {
+ strncat(text2send, argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);
+ strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 1);
+ }
+ text2send[strlen(text2send) - 1] = '\n';
+ f.data = text2send;
+ f.datalen = strlen(text2send) + 1;
+ grab_owner();
+ if (alsa.owner) {
+ ast_queue_frame(alsa.owner, &f);
+ f.frametype = AST_FRAME_CONTROL;
+ f.subclass = AST_CONTROL_ANSWER;
+ f.data = NULL;
+ f.datalen = 0;
+ ast_queue_frame(alsa.owner, &f);
+ ast_mutex_unlock(&alsa.owner->lock);
+ }
+ }
+
+ ast_mutex_unlock(&alsalock);
+
+ return res;
+}
+
+static char answer_usage[] =
+ "Usage: console answer\n"
+ " Answers an incoming call on the console (ALSA) channel.\n";
+
+static int console_hangup_deprecated(int fd, int argc, char *argv[])
{
int res = RESULT_SUCCESS;
@@ -994,10 +1092,39 @@ static int console_hangup(int fd, int argc, char *argv[])
return res;
}
-static char hangup_usage[] = "Usage: hangup\n" " Hangs up any call currently placed on the console.\n";
+static int console_hangup(int fd, int argc, char *argv[])
+{
+ int res = RESULT_SUCCESS;
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
-static int console_dial(int fd, int argc, char *argv[])
+ cursound = -1;
+
+ ast_mutex_lock(&alsalock);
+
+ if (!alsa.owner && !hookstate) {
+ ast_cli(fd, "No call to hangup up\n");
+ res = RESULT_FAILURE;
+ } else {
+ hookstate = 0;
+ grab_owner();
+ if (alsa.owner) {
+ ast_queue_hangup(alsa.owner);
+ ast_mutex_unlock(&alsa.owner->lock);
+ }
+ }
+
+ ast_mutex_unlock(&alsalock);
+
+ return res;
+}
+
+static char hangup_usage[] =
+ "Usage: console hangup\n"
+ " Hangs up any call currently placed on the console.\n";
+
+static int console_dial_deprecated(int fd, int argc, char *argv[])
{
char tmp[256], *tmp2;
char *mye, *myc;
@@ -1054,20 +1181,117 @@ static int console_dial(int fd, int argc, char *argv[])
return res;
}
-static char dial_usage[] = "Usage: dial [extension[@context]]\n" " Dials a given extension (and context if specified)\n";
+static int console_dial(int fd, int argc, char *argv[])
+{
+ char tmp[256], *tmp2;
+ char *mye, *myc;
+ char *d;
+ int res = RESULT_SUCCESS;
+
+ if ((argc != 2) && (argc != 3))
+ return RESULT_SHOWUSAGE;
+ ast_mutex_lock(&alsalock);
-static struct ast_cli_entry myclis[] = {
- {{"answer", NULL}, console_answer, "Answer an incoming console call", answer_usage},
- {{"hangup", NULL}, console_hangup, "Hangup a call on the console", hangup_usage},
- {{"dial", NULL}, console_dial, "Dial an extension on the console", dial_usage},
- {{"send", "text", NULL}, console_sendtext, "Send text to the remote device", sendtext_usage},
- {{"autoanswer", NULL}, console_autoanswer, "Sets/displays autoanswer", autoanswer_usage, autoanswer_complete}
+ if (alsa.owner) {
+ if (argc == 3) {
+ d = argv[2];
+ grab_owner();
+ if (alsa.owner) {
+ struct ast_frame f = { AST_FRAME_DTMF };
+ while (*d) {
+ f.subclass = *d;
+ ast_queue_frame(alsa.owner, &f);
+ d++;
+ }
+ ast_mutex_unlock(&alsa.owner->lock);
+ }
+ } else {
+ ast_cli(fd, "You're already in a call. You can use this only to dial digits until you hangup\n");
+ res = RESULT_FAILURE;
+ }
+ } else {
+ mye = exten;
+ myc = context;
+ if (argc == 3) {
+ char *stringp = NULL;
+ strncpy(tmp, argv[2], sizeof(tmp) - 1);
+ stringp = tmp;
+ strsep(&stringp, "@");
+ tmp2 = strsep(&stringp, "@");
+ if (!ast_strlen_zero(tmp))
+ mye = tmp;
+ if (!ast_strlen_zero(tmp2))
+ myc = tmp2;
+ }
+ if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
+ strncpy(alsa.exten, mye, sizeof(alsa.exten) - 1);
+ strncpy(alsa.context, myc, sizeof(alsa.context) - 1);
+ hookstate = 1;
+ alsa_new(&alsa, AST_STATE_RINGING);
+ } else
+ ast_cli(fd, "No such extension '%s' in context '%s'\n", mye, myc);
+ }
+
+ ast_mutex_unlock(&alsalock);
+
+ return res;
+}
+
+static char dial_usage[] =
+ "Usage: console dial [extension[@context]]\n"
+ " Dials a given extension (and context if specified)\n";
+
+static struct ast_cli_entry cli_alsa_answer_deprecated = {
+ { "answer", NULL },
+ console_answer_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_alsa_hangup_deprecated = {
+ { "hangup", NULL },
+ console_hangup_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_alsa_dial_deprecated = {
+ { "dial", NULL },
+ console_dial_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_alsa_send_text_deprecated = {
+ { "send", "text", NULL },
+ console_sendtext_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_alsa_autoanswer_deprecated = {
+ { "autoanswer", NULL },
+ console_autoanswer_deprecated, NULL,
+ NULL, autoanswer_complete };
+
+static struct ast_cli_entry cli_alsa[] = {
+ { { "console", "answer", NULL },
+ console_answer, "Answer an incoming console call",
+ answer_usage, NULL, &cli_alsa_answer_deprecated },
+
+ { { "console", "hangup", NULL },
+ console_hangup, "Hangup a call on the console",
+ hangup_usage, NULL, &cli_alsa_hangup_deprecated },
+
+ { { "console", "dial", NULL },
+ console_dial, "Dial an extension on the console",
+ dial_usage, NULL, &cli_alsa_dial_deprecated },
+
+ { { "console", "send", "text", NULL },
+ console_sendtext, "Send text to the remote device",
+ sendtext_usage, NULL, &cli_alsa_send_text_deprecated },
+
+ { { "console", "autoanswer", NULL },
+ console_autoanswer, "Sets/displays autoanswer",
+ autoanswer_usage, autoanswer_complete, &cli_alsa_autoanswer_deprecated },
};
static int load_module(void)
{
- int res, x;
+ int res;
struct ast_config *cfg;
struct ast_variable *v;
@@ -1123,8 +1347,8 @@ static int load_module(void)
ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n");
return -1;
}
- for (x = 0; x < sizeof(myclis) / sizeof(struct ast_cli_entry); x++)
- ast_cli_register(myclis + x);
+ ast_cli_register_multiple(cli_alsa, sizeof(cli_alsa) / sizeof(struct ast_cli_entry));
+
ast_pthread_create(&sthread, NULL, sound_thread, NULL);
#ifdef ALSA_MONITOR
if (alsa_monitor_start())
@@ -1135,11 +1359,9 @@ static int load_module(void)
static int unload_module(void)
{
- int x;
-
ast_channel_unregister(&alsa_tech);
- for (x = 0; x < sizeof(myclis) / sizeof(struct ast_cli_entry); x++)
- ast_cli_unregister(myclis + x);
+ ast_cli_unregister_multiple(cli_alsa, sizeof(cli_alsa) / sizeof(struct ast_cli_entry));
+
if (alsa.icard)
snd_pcm_close(alsa.icard);
if (alsa.ocard)
diff --git a/channels/chan_features.c b/channels/chan_features.c
index 66b6da3e3..5f01738d2 100644
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -530,12 +530,19 @@ static int features_show(int fd, int argc, char **argv)
}
static char show_features_usage[] =
-"Usage: feature show channels\n"
+"Usage: feature list channels\n"
" Provides summary information on feature channels.\n";
-static struct ast_cli_entry cli_show_features = {
- { "feature", "show", "channels", NULL }, features_show,
- "Show status of feature channels", show_features_usage, NULL };
+static struct ast_cli_entry cli_features_show_channels_deprecated = {
+ { "feature", "show", "channels", NULL },
+ features_show, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_features[] = {
+ { { "feature", "list", "channels", NULL },
+ features_show, "List status of feature channels",
+ show_features_usage, NULL, &cli_features_show_channels_deprecated },
+};
static int load_module(void)
{
@@ -544,7 +551,7 @@ static int load_module(void)
ast_log(LOG_ERROR, "Unable to register channel class 'Feature'\n");
return -1;
}
- ast_cli_register(&cli_show_features);
+ ast_cli_register_multiple(cli_features, sizeof(cli_features) / sizeof(struct ast_cli_entry));
return 0;
}
@@ -553,7 +560,7 @@ static int unload_module(void)
struct feature_pvt *p;
/* First, take us out of the channel loop */
- ast_cli_unregister(&cli_show_features);
+ ast_cli_unregister_multiple(cli_features, sizeof(cli_features) / sizeof(struct ast_cli_entry));
ast_channel_unregister(&features_tech);
if (!AST_LIST_LOCK(&features))
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index ded2afbd5..c4e44fddd 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -1821,22 +1821,43 @@ static char h323_reload_usage[] =
"Usage: h323 reload\n"
" Reloads H.323 configuration from sip.conf\n";
-static struct ast_cli_entry cli_trace =
- { { "h.323", "trace", NULL }, h323_do_trace, "Enable H.323 Stack Tracing", trace_usage };
-static struct ast_cli_entry cli_no_trace =
- { { "h.323", "no", "trace", NULL }, h323_no_trace, "Disable H.323 Stack Tracing", no_trace_usage };
-static struct ast_cli_entry cli_debug =
- { { "h.323", "debug", NULL }, h323_do_debug, "Enable H.323 debug", debug_usage };
-static struct ast_cli_entry cli_no_debug =
- { { "h.323", "no", "debug", NULL }, h323_no_debug, "Disable H.323 debug", no_debug_usage };
-static struct ast_cli_entry cli_show_codecs =
- { { "h.323", "show", "codecs", NULL }, h323_show_codec, "Show enabled codecs", show_codec_usage };
-static struct ast_cli_entry cli_gk_cycle =
- { { "h.323", "gk", "cycle", NULL }, h323_gk_cycle, "Manually re-register with the Gatekeper", show_cycle_usage };
-static struct ast_cli_entry cli_hangup_call =
- { { "h.323", "hangup", NULL }, h323_ep_hangup, "Manually try to hang up a call", show_hangup_usage };
-static struct ast_cli_entry cli_show_tokens =
- { { "h.323", "show", "tokens", NULL }, h323_tokens_show, "Show all active call tokens", show_tokens_usage };
+static struct ast_cli_entry cli_h323[] = {
+ { { "h.323", "trace", NULL },
+ h323_do_trace, "Enable H.323 Stack Tracing",
+ trace_usage },
+
+ { { "h.323", "no", "trace", NULL },
+ h323_no_trace, "Disable H.323 Stack Tracing",
+ no_trace_usage },
+
+ { { "h.323", "debug", NULL },
+ h323_do_debug, "Enable H.323 debug",
+ debug_usage },
+
+ { { "h.323", "no", "debug", NULL },
+ h323_no_debug, "Disable H.323 debug",
+ no_debug_usage },
+
+ { { "h.323", "show", "codecs", NULL },
+ h323_show_codec, "Show enabled codecs",
+ show_codec_usage },
+
+ { { "h.323", "gk", "cycle", NULL },
+ h323_gk_cycle, "Manually re-register with the Gatekeper",
+ show_cycle_usage },
+
+ { { "h.323", "hangup", NULL },
+ h323_ep_hangup, "Manually try to hang up a call",
+ show_hangup_usage },
+
+ { { "h.323", "show", "tokens", NULL },
+ h323_tokens_show, "Show all active call tokens",
+ show_tokens_usage },
+
+ { { "h.323", "reload", NULL },
+ h323_reload, "Reload H.323 configuration",
+ h323_reload_usage },
+};
static int update_common_options(struct ast_variable *v, struct call_options *options)
{
@@ -2298,9 +2319,6 @@ static int reload(void *mod)
return h323_reload(0, 0, NULL);
}
-static struct ast_cli_entry cli_h323_reload =
- { { "h.323", "reload", NULL }, h323_reload, "Reload H.323 configuration", h323_reload_usage };
-
static struct ast_rtp *oh323_get_rtp_peer(struct ast_channel *chan)
{
struct oh323_pvt *pvt;
@@ -2397,15 +2415,7 @@ static int load_module(void *mod)
h323_end_process();
return -1;
}
- ast_cli_register(&cli_debug);
- ast_cli_register(&cli_no_debug);
- ast_cli_register(&cli_trace);
- ast_cli_register(&cli_no_trace);
- ast_cli_register(&cli_show_codecs);
- ast_cli_register(&cli_gk_cycle);
- ast_cli_register(&cli_hangup_call);
- ast_cli_register(&cli_show_tokens);
- ast_cli_register(&cli_h323_reload);
+ ast_cli_register_multiple(cli_h323, sizeof(cli_h323) / sizeof(struct ast_cli_entry));
ast_rtp_proto_register(&oh323_rtp);
@@ -2446,15 +2456,7 @@ static int unload_module(void *mod)
struct oh323_pvt *p, *pl;
/* unregister commands */
- ast_cli_unregister(&cli_debug);
- ast_cli_unregister(&cli_no_debug);
- ast_cli_unregister(&cli_trace);
- ast_cli_unregister(&cli_no_trace);
- ast_cli_unregister(&cli_show_codecs);
- ast_cli_unregister(&cli_gk_cycle);
- ast_cli_unregister(&cli_hangup_call);
- ast_cli_unregister(&cli_show_tokens);
- ast_cli_unregister(&cli_h323_reload);
+ ast_cli_unregister_multiple(cli_h323, sizeof(cli_h323) / sizeof(struct ast_cli_entry));
ast_rtp_proto_unregister(&oh323_rtp);
ast_channel_unregister(&oh323_tech);
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 501f28d02..1fa4c8784 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -4441,7 +4441,7 @@ static int iax2_do_jb_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static int iax2_no_debug(int fd, int argc, char *argv[])
+static int iax2_no_debug_deprecated(int fd, int argc, char *argv[])
{
if (argc != 3)
return RESULT_SHOWUSAGE;
@@ -4450,7 +4450,16 @@ static int iax2_no_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static int iax2_no_trunk_debug(int fd, int argc, char *argv[])
+static int iax2_no_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ iaxdebug = 0;
+ ast_cli(fd, "IAX2 Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
+
+static int iax2_no_trunk_debug_deprecated(int fd, int argc, char *argv[])
{
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -4459,7 +4468,16 @@ static int iax2_no_trunk_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static int iax2_no_jb_debug(int fd, int argc, char *argv[])
+static int iax2_no_trunk_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+ iaxtrunkdebug = 0;
+ ast_cli(fd, "IAX2 Trunk Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
+
+static int iax2_no_jb_debug_deprecated(int fd, int argc, char *argv[])
{
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -4469,6 +4487,16 @@ static int iax2_no_jb_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
+static int iax2_no_jb_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+ jb_setoutput(jb_error_output, jb_warning_output, NULL);
+ jb_debug_output("\n");
+ ast_cli(fd, "IAX2 Jitterbuffer Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
+
static int iax2_write(struct ast_channel *c, struct ast_frame *f)
{
unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
@@ -9625,15 +9653,15 @@ static struct ast_switch iax2_switch =
};
static char show_stats_usage[] =
-"Usage: iax show stats\n"
+"Usage: iax2 list stats\n"
" Display statistics on IAX channel driver.\n";
static char show_cache_usage[] =
-"Usage: iax show cache\n"
+"Usage: iax2 list cache\n"
" Display currently cached IAX Dialplan results.\n";
static char show_peer_usage[] =
-"Usage: iax show peer <name>\n"
+"Usage: iax2 show peer <name>\n"
" Display details on specific IAX peer\n";
static char prune_realtime_usage[] =
@@ -9652,34 +9680,34 @@ static char show_prov_usage[] =
" fields will be provisioned as empty fields.\n";
static char show_users_usage[] =
-"Usage: iax2 show users [like <pattern>]\n"
+"Usage: iax2 list users [like <pattern>]\n"
" Lists all known IAX2 users.\n"
" Optional regular expression pattern is used to filter the user list.\n";
static char show_channels_usage[] =
-"Usage: iax2 show channels\n"
+"Usage: iax2 list channels\n"
" Lists all currently active IAX channels.\n";
static char show_netstats_usage[] =
-"Usage: iax2 show netstats\n"
+"Usage: iax2 list netstats\n"
" Lists network status for all currently active IAX channels.\n";
static char show_threads_usage[] =
-"Usage: iax2 show threads\n"
+"Usage: iax2 list threads\n"
" Lists status of IAX helper threads\n";
static char show_peers_usage[] =
-"Usage: iax2 show peers [registered] [like <pattern>]\n"
+"Usage: iax2 list peers [registered] [like <pattern>]\n"
" Lists all known IAX2 peers.\n"
" Optional 'registered' argument lists only peers with known addresses.\n"
" Optional regular expression pattern is used to filter the peer list.\n";
static char show_firmware_usage[] =
-"Usage: iax2 show firmware\n"
+"Usage: iax2 list firmware\n"
" Lists all known IAX firmware images.\n";
static char show_reg_usage[] =
-"Usage: iax2 show registry\n"
+"Usage: iax2 list registry\n"
" Lists all registration requests and status.\n";
static char debug_usage[] =
@@ -9687,23 +9715,23 @@ static char debug_usage[] =
" Enables dumping of IAX packets for debugging purposes\n";
static char no_debug_usage[] =
-"Usage: iax2 no debug\n"
+"Usage: iax2 nodebug\n"
" Disables dumping of IAX packets for debugging purposes\n";
static char debug_trunk_usage[] =
-"Usage: iax2 trunk debug\n"
+"Usage: iax2 debug trunk\n"
" Requests current status of IAX trunking\n";
static char no_debug_trunk_usage[] =
-"Usage: iax2 no trunk debug\n"
+"Usage: iax2 nodebug trunk\n"
" Requests current status of IAX trunking\n";
static char debug_jb_usage[] =
-"Usage: iax2 jb debug\n"
+"Usage: iax2 debug jb\n"
" Enables jitterbuffer debugging information\n";
static char no_debug_jb_usage[] =
-"Usage: iax2 no jb debug\n"
+"Usage: iax2 nodebug jb\n"
" Disables jitterbuffer debugging information\n";
static char iax2_test_losspct_usage[] =
@@ -9724,54 +9752,168 @@ static char iax2_test_jitter_usage[] =
" For testing, simulate maximum jitter of +/- <ms> on <pct> percentage of packets. If <pct> is not specified, adds jitter to all packets.\n";
#endif /* IAXTESTS */
-static struct ast_cli_entry iax2_cli[] = {
- { { "iax2", "show", "stats", NULL }, iax2_show_stats,
- "Display IAX statistics", show_stats_usage },
- { { "iax2", "show", "cache", NULL }, iax2_show_cache,
- "Display IAX cached dialplan", show_cache_usage },
- { { "iax2", "show", "peer", NULL }, iax2_show_peer,
- "Show details on specific IAX peer", show_peer_usage, complete_iax2_show_peer },
- { { "iax2", "prune", "realtime", NULL }, iax2_prune_realtime,
- "Prune a cached realtime lookup", prune_realtime_usage, complete_iax2_show_peer },
- { { "iax2", "reload", NULL }, iax2_reload,
- "Reload IAX configuration", iax2_reload_usage },
- { { "iax2", "show", "users", NULL }, iax2_show_users,
- "Show defined IAX users", show_users_usage },
- { { "iax2", "show", "firmware", NULL }, iax2_show_firmware,
- "Show available IAX firmwares", show_firmware_usage },
- { { "iax2", "show", "channels", NULL }, iax2_show_channels,
- "Show active IAX channels", show_channels_usage },
- { { "iax2", "show", "netstats", NULL }, iax2_show_netstats,
- "Show active IAX channel netstats", show_netstats_usage },
- { { "iax2", "show", "peers", NULL }, iax2_show_peers,
- "Show defined IAX peers", show_peers_usage },
- { { "iax2", "show", "threads", NULL }, iax2_show_threads,
- "Show IAX helper thread info", show_threads_usage },
- { { "iax2", "show", "registry", NULL }, iax2_show_registry,
- "Show IAX registration status", show_reg_usage },
- { { "iax2", "debug", NULL }, iax2_do_debug,
- "Enable IAX debugging", debug_usage },
- { { "iax2", "trunk", "debug", NULL }, iax2_do_trunk_debug,
- "Enable IAX trunk debugging", debug_trunk_usage },
- { { "iax2", "jb", "debug", NULL }, iax2_do_jb_debug,
- "Enable IAX jitterbuffer debugging", debug_jb_usage },
- { { "iax2", "no", "debug", NULL }, iax2_no_debug,
- "Disable IAX debugging", no_debug_usage },
- { { "iax2", "no", "trunk", "debug", NULL }, iax2_no_trunk_debug,
- "Disable IAX trunk debugging", no_debug_trunk_usage },
- { { "iax2", "no", "jb", "debug", NULL }, iax2_no_jb_debug,
- "Disable IAX jitterbuffer debugging", no_debug_jb_usage },
- { { "iax2", "test", "losspct", NULL }, iax2_test_losspct,
- "Set IAX2 incoming frame loss percentage", iax2_test_losspct_usage },
- { { "iax2", "provision", NULL }, iax2_prov_cmd,
- "Provision an IAX device", show_prov_usage, iax2_prov_complete_template_3rd },
+static struct ast_cli_entry cli_iax2_trunk_debug_deprecated = {
+ { "iax2", "trunk", "debug", NULL },
+ iax2_do_trunk_debug, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_jb_debug_deprecated = {
+ { "iax2", "jb", "debug", NULL },
+ iax2_do_jb_debug, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_no_debug_deprecated = {
+ { "iax2", "no", "debug", NULL },
+ iax2_no_debug_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_no_trunk_debug_deprecated = {
+ { "iax2", "no", "trunk", "debug", NULL },
+ iax2_no_trunk_debug_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_no_jb_debug_deprecated = {
+ { "iax2", "no", "jb", "debug", NULL },
+ iax2_no_jb_debug_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_show_cache_deprecated = {
+ { "iax2", "show", "cache", NULL },
+ iax2_show_cache, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_show_peers_deprecated = {
+ { "iax2", "show", "peers", NULL },
+ iax2_show_peers, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_show_stats_deprecated = {
+ { "iax2", "show", "stats", NULL },
+ iax2_show_stats, NULL };
+
+static struct ast_cli_entry cli_iax2_show_firmware_deprecated = {
+ { "iax2", "show", "firmware", NULL },
+ iax2_show_firmware, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_show_channels_deprecated = {
+ { "iax2", "show", "channels", NULL },
+ iax2_show_channels, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_show_netstats_deprecated = {
+ { "iax2", "show", "netstats", NULL },
+ iax2_show_netstats, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_show_users_deprecated = {
+ { "iax2", "show", "users", NULL },
+ iax2_show_users, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_show_threads_deprecated = {
+ { "iax2", "show", "threads", NULL },
+ iax2_show_threads, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_iax2_show_registry_deprecated = {
+ { "iax2", "show", "registry", NULL },
+ iax2_show_registry, "Show IAX registration status",
+ show_reg_usage };
+
+static struct ast_cli_entry cli_iax2[] = {
+ { { "iax2", "list", "cache", NULL },
+ iax2_show_cache, "Display IAX cached dialplan",
+ show_cache_usage, NULL, &cli_iax2_show_cache_deprecated },
+
+ { { "iax2", "list", "channels", NULL },
+ iax2_show_channels, "List active IAX channels",
+ show_channels_usage, NULL, &cli_iax2_show_channels_deprecated },
+
+ { { "iax2", "list", "firmware", NULL },
+ iax2_show_firmware, "List available IAX firmwares",
+ show_firmware_usage, NULL, &cli_iax2_show_firmware_deprecated },
+
+ { { "iax2", "list", "netstats", NULL },
+ iax2_show_netstats, "List active IAX channel netstats",
+ show_netstats_usage, NULL, &cli_iax2_show_netstats_deprecated },
+
+ { { "iax2", "list", "peers", NULL },
+ iax2_show_peers, "List defined IAX peers",
+ show_peers_usage, NULL, &cli_iax2_show_peers_deprecated },
+
+ { { "iax2", "list", "registry", NULL },
+ iax2_show_registry, "Display IAX registration status",
+ show_reg_usage, NULL, &cli_iax2_show_registry_deprecated },
+
+ { { "iax2", "list", "stats", NULL },
+ iax2_show_stats, "Display IAX statistics",
+ show_stats_usage, NULL, &cli_iax2_show_stats_deprecated },
+
+ { { "iax2", "list", "threads", NULL },
+ iax2_show_threads, "Display IAX helper thread info",
+ show_threads_usage, NULL, &cli_iax2_show_threads_deprecated },
+
+ { { "iax2", "list", "users", NULL },
+ iax2_show_users, "List defined IAX users",
+ show_users_usage, NULL, &cli_iax2_show_users_deprecated },
+
+ { { "iax2", "prune", "realtime", NULL },
+ iax2_prune_realtime, "Prune a cached realtime lookup",
+ prune_realtime_usage, complete_iax2_show_peer },
+
+ { { "iax2", "reload", NULL },
+ iax2_reload, "Reload IAX configuration",
+ iax2_reload_usage },
+
+ { { "iax2", "show", "peer", NULL },
+ iax2_show_peer, "Show details on specific IAX peer",
+ show_peer_usage, complete_iax2_show_peer },
+
+ { { "iax2", "debug", NULL },
+ iax2_do_debug, "Enable IAX debugging",
+ debug_usage },
+
+ { { "iax2", "debug", "trunk", NULL },
+ iax2_do_trunk_debug, "Enable IAX trunk debugging",
+ debug_trunk_usage, NULL, &cli_iax2_trunk_debug_deprecated },
+
+ { { "iax2", "debug", "jb", NULL },
+ iax2_do_jb_debug, "Enable IAX jitterbuffer debugging",
+ debug_jb_usage, NULL, &cli_iax2_jb_debug_deprecated },
+
+ { { "iax2", "nodebug", NULL },
+ iax2_no_debug, "Disable IAX debugging",
+ no_debug_usage, NULL, &cli_iax2_no_debug_deprecated },
+
+ { { "iax2", "nodebug", "trunk", NULL },
+ iax2_no_trunk_debug, "Disable IAX trunk debugging",
+ no_debug_trunk_usage, NULL, &cli_iax2_no_trunk_debug_deprecated },
+
+ { { "iax2", "nodebug", "jb", NULL },
+ iax2_no_jb_debug, "Disable IAX jitterbuffer debugging",
+ no_debug_jb_usage, NULL, &cli_iax2_no_jb_debug_deprecated },
+
+ { { "iax2", "test", "losspct", NULL },
+ iax2_test_losspct, "Set IAX2 incoming frame loss percentage",
+ iax2_test_losspct_usage },
+
+ { { "iax2", "provision", NULL },
+ iax2_prov_cmd, "Provision an IAX device",
+ show_prov_usage, iax2_prov_complete_template_3rd },
+
#ifdef IAXTESTS
- { { "iax2", "test", "late", NULL }, iax2_test_late,
- "Test the receipt of a late frame", iax2_test_late_usage },
- { { "iax2", "test", "resync", NULL }, iax2_test_resync,
- "Test a resync in received timestamps", iax2_test_resync_usage },
- { { "iax2", "test", "jitter", NULL }, iax2_test_jitter,
- "Simulates jitter for testing", iax2_test_jitter_usage },
+ { { "iax2", "test", "late", NULL },
+ iax2_test_late, "Test the receipt of a late frame",
+ iax2_test_late_usage },
+
+ { { "iax2", "test", "resync", NULL },
+ iax2_test_resync, "Test a resync in received timestamps",
+ iax2_test_resync_usage },
+
+ { { "iax2", "test", "jitter", NULL },
+ iax2_test_jitter, "Simulates jitter for testing",
+ iax2_test_jitter_usage },
#endif /* IAXTESTS */
};
@@ -9836,7 +9978,7 @@ static int __unload_module(void)
ast_manager_unregister( "IAXpeers" );
ast_manager_unregister( "IAXnetstats" );
ast_unregister_application(papp);
- ast_cli_unregister_multiple(iax2_cli, sizeof(iax2_cli) / sizeof(iax2_cli[0]));
+ ast_cli_unregister_multiple(cli_iax2, sizeof(cli_iax2) / sizeof(struct ast_cli_entry));
ast_unregister_switch(&iax2_switch);
ast_channel_unregister(&iax2_tech);
delete_users();
@@ -9900,7 +10042,7 @@ static int load_module(void)
ast_mutex_init(&waresl.lock);
- ast_cli_register_multiple(iax2_cli, sizeof(iax2_cli) / sizeof(iax2_cli[0]));
+ ast_cli_register_multiple(cli_iax2, sizeof(cli_iax2) / sizeof(struct ast_cli_entry));
ast_register_application(papp, iax2_prov_app, psyn, pdescrip);
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 3420ebb1a..99b3177b2 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -622,12 +622,19 @@ static int locals_show(int fd, int argc, char **argv)
}
static char show_locals_usage[] =
-"Usage: local show channels\n"
+"Usage: local list channels\n"
" Provides summary information on active local proxy channels.\n";
-static struct ast_cli_entry cli_show_locals = {
- { "local", "show", "channels", NULL }, locals_show,
- "Show status of local channels", show_locals_usage, NULL };
+static struct ast_cli_entry cli_local_show_channels_deprecated = {
+ { "local", "show", "channels", NULL },
+ locals_show, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_local[] = {
+ { { "local", "list", "channels", NULL },
+ locals_show, "List status of local channels",
+ show_locals_usage, NULL, &cli_local_show_channels_deprecated },
+};
/*! \brief Load module into PBX, register channel */
static int load_module(void)
@@ -637,7 +644,7 @@ static int load_module(void)
ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n");
return -1;
}
- ast_cli_register(&cli_show_locals);
+ ast_cli_register_multiple(cli_local, sizeof(cli_local) / sizeof(struct ast_cli_entry));
return 0;
}
@@ -647,7 +654,7 @@ static int unload_module(void)
struct local_pvt *p = NULL;
/* First, take us out of the channel loop */
- ast_cli_unregister(&cli_show_locals);
+ ast_cli_unregister_multiple(cli_local, sizeof(cli_local) / sizeof(struct ast_cli_entry));
ast_channel_unregister(&local_tech);
if (!AST_LIST_LOCK(&locals)) {
/* Hangup all interfaces if they have an owner */
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 1a27fc8f0..9ae00b837 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1040,11 +1040,25 @@ static int mgcp_show_endpoints(int fd, int argc, char *argv[])
}
static char show_endpoints_usage[] =
-"Usage: mgcp show endpoints\n"
+"Usage: mgcp endpoint list\n"
" Lists all endpoints known to the MGCP (Media Gateway Control Protocol) subsystem.\n";
-static struct ast_cli_entry cli_show_endpoints =
- { { "mgcp", "show", "endpoints", NULL }, mgcp_show_endpoints, "Show defined MGCP endpoints", show_endpoints_usage };
+static char audit_endpoint_usage[] =
+"Usage: mgcp endpoint audit <endpointid>\n"
+" Lists the capabilities of an endpoint in the MGCP (Media Gateway Control Protocol) subsystem.\n"
+" mgcp debug MUST be on to see the results of this command.\n";
+
+static char debug_usage[] =
+"Usage: mgcp debug\n"
+" Enables dumping of MGCP packets for debugging purposes\n";
+
+static char no_debug_usage[] =
+"Usage: mgcp nodebug\n"
+" Disables dumping of MGCP packets for debugging purposes\n";
+
+static char mgcp_reload_usage[] =
+"Usage: mgcp reload\n"
+" Reloads MGCP configuration from mgcp.conf\n";
static int mgcp_audit_endpoint(int fd, int argc, char *argv[])
{
@@ -1099,13 +1113,69 @@ static int mgcp_audit_endpoint(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char audit_endpoint_usage[] =
-"Usage: mgcp audit endpoint <endpointid>\n"
-" Lists the capabilities of an endpoint in the MGCP (Media Gateway Control Protocol) subsystem.\n"
-" mgcp debug MUST be on to see the results of this command.\n";
+static int mgcp_do_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ mgcpdebug = 1;
+ ast_cli(fd, "MGCP Debugging Enabled\n");
+ return RESULT_SUCCESS;
+}
+
+static int mgcp_no_debug_deprecated(int fd, int argc, char *argv[])
+{
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+ mgcpdebug = 0;
+ ast_cli(fd, "MGCP Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
+
+static int mgcp_no_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ mgcpdebug = 0;
+ ast_cli(fd, "MGCP Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
-static struct ast_cli_entry cli_audit_endpoint =
- { { "mgcp", "audit", "endpoint", NULL }, mgcp_audit_endpoint, "Audit specified MGCP endpoint", audit_endpoint_usage };
+static struct ast_cli_entry cli_mgcp_no_debug_deprecated = {
+ { "mgcp", "no", "debug", NULL },
+ mgcp_no_debug_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_mgcp_audit_endpoint_deprecated = {
+ { "mgcp", "audit", "endpoint", NULL },
+ mgcp_audit_endpoint, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_mgcp_show_endpoints_deprecated = {
+ { "mgcp", "show", "endpoints", NULL },
+ mgcp_show_endpoints, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_mgcp[] = {
+ { { "mgcp", "endpoint", "audit", NULL },
+ mgcp_audit_endpoint, "Audit specified MGCP endpoint",
+ audit_endpoint_usage, NULL, &cli_mgcp_audit_endpoint_deprecated },
+
+ { { "mgcp", "endpoint", "list", NULL },
+ mgcp_show_endpoints, "List defined MGCP endpoints",
+ show_endpoints_usage, NULL, &cli_mgcp_show_endpoints_deprecated },
+
+ { { "mgcp", "debug", NULL },
+ mgcp_do_debug, "Enable MGCP debugging",
+ debug_usage },
+
+ { { "mgcp", "nodebug", NULL },
+ mgcp_no_debug, "Disable MGCP debugging",
+ no_debug_usage, NULL, &cli_mgcp_no_debug_deprecated },
+
+ { { "mgcp", "reload", NULL },
+ mgcp_reload, "Reload MGCP configuration",
+ mgcp_reload_usage },
+};
static int mgcp_answer(struct ast_channel *ast)
{
@@ -3917,44 +3987,6 @@ static struct ast_rtp_protocol mgcp_rtp = {
.set_rtp_peer = mgcp_set_rtp_peer,
};
-static int mgcp_do_debug(int fd, int argc, char *argv[])
-{
- if (argc != 2)
- return RESULT_SHOWUSAGE;
- mgcpdebug = 1;
- ast_cli(fd, "MGCP Debugging Enabled\n");
- return RESULT_SUCCESS;
-}
-
-static int mgcp_no_debug(int fd, int argc, char *argv[])
-{
- if (argc != 3)
- return RESULT_SHOWUSAGE;
- mgcpdebug = 0;
- ast_cli(fd, "MGCP Debugging Disabled\n");
- return RESULT_SUCCESS;
-}
-
-static char debug_usage[] =
-"Usage: mgcp debug\n"
-" Enables dumping of MGCP packets for debugging purposes\n";
-
-static char no_debug_usage[] =
-"Usage: mgcp no debug\n"
-" Disables dumping of MGCP packets for debugging purposes\n";
-
-static char mgcp_reload_usage[] =
-"Usage: mgcp reload\n"
-" Reloads MGCP configuration from mgcp.conf\n";
-
-static struct ast_cli_entry cli_debug =
- { { "mgcp", "debug", NULL }, mgcp_do_debug, "Enable MGCP debugging", debug_usage };
-static struct ast_cli_entry cli_no_debug =
- { { "mgcp", "no", "debug", NULL }, mgcp_no_debug, "Disable MGCP debugging", no_debug_usage };
-static struct ast_cli_entry cli_mgcp_reload =
- { { "mgcp", "reload", NULL }, mgcp_reload, "Reload MGCP configuration", mgcp_reload_usage };
-
-
static void destroy_endpoint(struct mgcp_endpoint *e)
{
struct mgcp_subchannel *sub = e->sub->next, *s;
@@ -4254,11 +4286,7 @@ static int load_module(void)
return -1;
}
ast_rtp_proto_register(&mgcp_rtp);
- ast_cli_register(&cli_show_endpoints);
- ast_cli_register(&cli_audit_endpoint);
- ast_cli_register(&cli_debug);
- ast_cli_register(&cli_no_debug);
- ast_cli_register(&cli_mgcp_reload);
+ ast_cli_register_multiple(cli_mgcp, sizeof(cli_mgcp) / sizeof(struct ast_cli_entry));
/* And start the monitor for the first time */
restart_monitor();
@@ -4350,11 +4378,7 @@ static int unload_module(void)
close(mgcpsock);
ast_rtp_proto_unregister(&mgcp_rtp);
- ast_cli_unregister(&cli_show_endpoints);
- ast_cli_unregister(&cli_audit_endpoint);
- ast_cli_unregister(&cli_debug);
- ast_cli_unregister(&cli_no_debug);
- ast_cli_unregister(&cli_mgcp_reload);
+ ast_cli_unregister_multiple(cli_mgcp, sizeof(cli_mgcp) / sizeof(struct ast_cli_entry));
sched_context_destroy(sched);
return 0;
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 66c459b35..6987542ce 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -4464,7 +4464,7 @@ static int unload_module(void)
if (!g_config_initialized) return 0;
- ast_cli_unregister_multiple(chan_misdn_clis, sizeof(chan_misdn_clis) / sizeof(chan_misdn_clis[0]));
+ ast_cli_unregister_multiple(chan_misdn_clis, sizeof(chan_misdn_clis) / sizeof(struct ast_cli_entry));
/* ast_unregister_application("misdn_crypt"); */
ast_unregister_application("misdn_set_opt");
@@ -4566,7 +4566,7 @@ static int load_module(void)
}
}
- ast_cli_register_multiple(chan_misdn_clis, sizeof(chan_misdn_clis) / sizeof(chan_misdn_clis[0]));
+ ast_cli_register_multiple(chan_misdn_clis, sizeof(chan_misdn_clis) / sizeof(struct ast_cli_entry));
ast_register_application("misdn_set_opt", misdn_set_opt_exec, "misdn_set_opt",
"misdn_set_opt(:<opt><optarg>:<opt><optarg>..):\n"
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 6b31c0e24..876e247dc 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1068,7 +1068,7 @@ static struct ast_channel *oss_request(const char *type, int format, void *data,
return c;
}
-static int console_autoanswer(int fd, int argc, char *argv[])
+static int console_autoanswer_deprecated(int fd, int argc, char *argv[])
{
struct chan_oss_pvt *o = find_desc(oss_active);
@@ -1091,22 +1091,54 @@ static int console_autoanswer(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
+static int console_autoanswer(int fd, int argc, char *argv[])
+{
+ struct chan_oss_pvt *o = find_desc(oss_active);
+
+ if (argc == 2) {
+ ast_cli(fd, "Auto answer is %s.\n", o->autoanswer ? "on" : "off");
+ return RESULT_SUCCESS;
+ }
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+ if (o == NULL) {
+ ast_log(LOG_WARNING, "Cannot find device %s (should not happen!)\n",
+ oss_active);
+ return RESULT_FAILURE;
+ }
+ if (!strcasecmp(argv[2], "on"))
+ o->autoanswer = -1;
+ else if (!strcasecmp(argv[2], "off"))
+ o->autoanswer = 0;
+ else
+ return RESULT_SHOWUSAGE;
+ return RESULT_SUCCESS;
+}
+
+static char *autoanswer_complete_deprecated(const char *line, const char *word, int pos, int state)
+{
+ static char *choices[] = { "on", "off", NULL };
+
+ return (pos != 2) ? NULL : ast_cli_complete(word, choices, state);
+}
+
static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
{
static char *choices[] = { "on", "off", NULL };
- return (pos != 1) ? NULL : ast_cli_complete(word, choices, state);
+ return (pos != 3) ? NULL : ast_cli_complete(word, choices, state);
}
static char autoanswer_usage[] =
- "Usage: autoanswer [on|off]\n"
+ "Usage: console autoanswer [on|off]\n"
" Enables or disables autoanswer feature. If used without\n"
- " argument, displays the current on/off status of autoanswer.\n" " The default value of autoanswer is in 'oss.conf'.\n";
+ " argument, displays the current on/off status of autoanswer.\n"
+ " The default value of autoanswer is in 'oss.conf'.\n";
/*
* answer command from the console
*/
-static int console_answer(int fd, int argc, char *argv[])
+static int console_answer_deprecated(int fd, int argc, char *argv[])
{
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
struct chan_oss_pvt *o = find_desc(oss_active);
@@ -1128,13 +1160,37 @@ static int console_answer(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char sendtext_usage[] = "Usage: send text <message>\n" " Sends a text message for display on the remote terminal.\n";
+static int console_answer(int fd, int argc, char *argv[])
+{
+ struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
+ struct chan_oss_pvt *o = find_desc(oss_active);
+
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ if (!o->owner) {
+ ast_cli(fd, "No one is calling us\n");
+ return RESULT_FAILURE;
+ }
+ o->hookstate = 1;
+ o->cursound = -1;
+ o->nosound = 0;
+ ast_queue_frame(o->owner, &f);
+#if 0
+ /* XXX do we really need it ? considering we shut down immediately... */
+ ring(o, AST_CONTROL_ANSWER);
+#endif
+ return RESULT_SUCCESS;
+}
+
+static char answer_usage[] =
+ "Usage: console answer\n"
+ " Answers an incoming call on the console (OSS) channel.\n";
/*
* concatenate all arguments into a single string. argv is NULL-terminated
* so we can use it right away
*/
-static int console_sendtext(int fd, int argc, char *argv[])
+static int console_sendtext_deprecated(int fd, int argc, char *argv[])
{
struct chan_oss_pvt *o = find_desc(oss_active);
char buf[TEXT_SIZE];
@@ -1159,9 +1215,36 @@ static int console_sendtext(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char answer_usage[] = "Usage: answer\n" " Answers an incoming call on the console (OSS) channel.\n";
+static int console_sendtext(int fd, int argc, char *argv[])
+{
+ struct chan_oss_pvt *o = find_desc(oss_active);
+ char buf[TEXT_SIZE];
-static int console_hangup(int fd, int argc, char *argv[])
+ if (argc < 3)
+ return RESULT_SHOWUSAGE;
+ if (!o->owner) {
+ ast_cli(fd, "Not in a call\n");
+ return RESULT_FAILURE;
+ }
+ ast_join(buf, sizeof(buf) - 1, argv + 3);
+ if (!ast_strlen_zero(buf)) {
+ struct ast_frame f = { 0, };
+ int i = strlen(buf);
+ buf[i] = '\n';
+ f.frametype = AST_FRAME_TEXT;
+ f.subclass = 0;
+ f.data = buf;
+ f.datalen = i + 1;
+ ast_queue_frame(o->owner, &f);
+ }
+ return RESULT_SUCCESS;
+}
+
+static char sendtext_usage[] =
+ "Usage: console send text <message>\n"
+ " Sends a text message for display on the remote terminal.\n";
+
+static int console_hangup_deprecated(int fd, int argc, char *argv[])
{
struct chan_oss_pvt *o = find_desc(oss_active);
@@ -1169,7 +1252,7 @@ static int console_hangup(int fd, int argc, char *argv[])
return RESULT_SHOWUSAGE;
o->cursound = -1;
o->nosound = 0;
- if (!o->owner && !o->hookstate) { /* XXX maybe only one ? */
+ if (!o->owner && !o->hookstate) { /* XXX maybe only one ? */
ast_cli(fd, "No call to hang up\n");
return RESULT_FAILURE;
}
@@ -1180,10 +1263,30 @@ static int console_hangup(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char hangup_usage[] = "Usage: hangup\n" " Hangs up any call currently placed on the console.\n";
+static int console_hangup(int fd, int argc, char *argv[])
+{
+ struct chan_oss_pvt *o = find_desc(oss_active);
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ o->cursound = -1;
+ o->nosound = 0;
+ if (!o->owner && !o->hookstate) { /* XXX maybe only one ? */
+ ast_cli(fd, "No call to hang up\n");
+ return RESULT_FAILURE;
+ }
+ o->hookstate = 0;
+ if (o->owner)
+ ast_queue_hangup(o->owner);
+ setformat(o, O_CLOSE);
+ return RESULT_SUCCESS;
+}
-static int console_flash(int fd, int argc, char *argv[])
+static char hangup_usage[] =
+ "Usage: console hangup\n"
+ " Hangs up any call currently placed on the console.\n";
+
+static int console_flash_deprecated(int fd, int argc, char *argv[])
{
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
struct chan_oss_pvt *o = find_desc(oss_active);
@@ -1191,6 +1294,25 @@ static int console_flash(int fd, int argc, char *argv[])
if (argc != 1)
return RESULT_SHOWUSAGE;
o->cursound = -1;
+ o->nosound = 0; /* when cursound is -1 nosound must be 0 */
+ if (!o->owner) { /* XXX maybe !o->hookstate too ? */
+ ast_cli(fd, "No call to flash\n");
+ return RESULT_FAILURE;
+ }
+ o->hookstate = 0;
+ if (o->owner) /* XXX must be true, right ? */
+ ast_queue_frame(o->owner, &f);
+ return RESULT_SUCCESS;
+}
+
+static int console_flash(int fd, int argc, char *argv[])
+{
+ struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
+ struct chan_oss_pvt *o = find_desc(oss_active);
+
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ o->cursound = -1;
o->nosound = 0; /* when cursound is -1 nosound must be 0 */
if (!o->owner) { /* XXX maybe !o->hookstate too ? */
ast_cli(fd, "No call to flash\n");
@@ -1202,23 +1324,22 @@ static int console_flash(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
+static char flash_usage[] =
+ "Usage: console flash\n"
+ " Flashes the call currently placed on the console.\n";
-static char flash_usage[] = "Usage: flash\n" " Flashes the call currently placed on the console.\n";
-
-
-
-static int console_dial(int fd, int argc, char *argv[])
+static int console_dial_deprecated(int fd, int argc, char *argv[])
{
char *s = NULL, *mye = NULL, *myc = NULL;
struct chan_oss_pvt *o = find_desc(oss_active);
if (argc != 1 && argc != 2)
return RESULT_SHOWUSAGE;
- if (o->owner) { /* already in a call */
+ if (o->owner) { /* already in a call */
int i;
struct ast_frame f = { AST_FRAME_DTMF, 0 };
- if (argc == 1) { /* argument is mandatory here */
+ if (argc == 1) { /* argument is mandatory here */
ast_cli(fd, "Already in a call. You can only dial digits until you hangup.\n");
return RESULT_FAILURE;
}
@@ -1248,29 +1369,125 @@ static int console_dial(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char dial_usage[] = "Usage: dial [extension[@context]]\n" " Dials a given extension (and context if specified)\n";
+static int console_dial(int fd, int argc, char *argv[])
+{
+ char *s = NULL, *mye = NULL, *myc = NULL;
+ struct chan_oss_pvt *o = find_desc(oss_active);
-static char mute_usage[] = "Usage: mute\nMutes the microphone\n";
+ if (argc != 2 && argc != 3)
+ return RESULT_SHOWUSAGE;
+ if (o->owner) { /* already in a call */
+ int i;
+ struct ast_frame f = { AST_FRAME_DTMF, 0 };
-static char unmute_usage[] = "Usage: unmute\nUnmutes the microphone\n";
+ if (argc == 1) { /* argument is mandatory here */
+ ast_cli(fd, "Already in a call. You can only dial digits until you hangup.\n");
+ return RESULT_FAILURE;
+ }
+ s = argv[2];
+ /* send the string one char at a time */
+ for (i = 0; i < strlen(s); i++) {
+ f.subclass = s[i];
+ ast_queue_frame(o->owner, &f);
+ }
+ return RESULT_SUCCESS;
+ }
+ /* if we have an argument split it into extension and context */
+ if (argc == 3)
+ s = ast_ext_ctx(argv[2], &mye, &myc);
+ /* supply default values if needed */
+ if (mye == NULL)
+ mye = o->ext;
+ if (myc == NULL)
+ myc = o->ctx;
+ if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
+ o->hookstate = 1;
+ oss_new(o, mye, myc, AST_STATE_RINGING);
+ } else
+ ast_cli(fd, "No such extension '%s' in context '%s'\n", mye, myc);
+ if (s)
+ free(s);
+ return RESULT_SUCCESS;
+}
-static int console_mute(int fd, int argc, char *argv[])
+static char dial_usage[] =
+ "Usage: console dial [extension[@context]]\n"
+ " Dials a given extension (and context if specified)\n";
+
+static int __console_mute_unmute(int mute)
{
struct chan_oss_pvt *o = find_desc(oss_active);
+
+ o->mute = mute;
+ return RESULT_SUCCESS;
+}
+static int console_mute_deprecated(int fd, int argc, char *argv[])
+{
if (argc != 1)
return RESULT_SHOWUSAGE;
- o->mute = 1;
- return RESULT_SUCCESS;
+
+ return __console_mute_unmute(1);
+}
+
+static int console_mute(int fd, int argc, char *argv[])
+{
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+
+ return __console_mute_unmute(1);
+}
+
+static char mute_usage[] =
+ "Usage: console mute\nMutes the microphone\n";
+
+static int console_unmute_deprecated(int fd, int argc, char *argv[])
+{
+ if (argc != 1)
+ return RESULT_SHOWUSAGE;
+
+ return __console_mute_unmute(0);
}
static int console_unmute(int fd, int argc, char *argv[])
{
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+
+ return __console_mute_unmute(0);
+}
+
+static char unmute_usage[] =
+ "Usage: console unmute\nUnmutes the microphone\n";
+
+static int console_transfer_deprecated(int fd, int argc, char *argv[])
+{
struct chan_oss_pvt *o = find_desc(oss_active);
+ struct ast_channel *b = NULL;
+ char *tmp, *ext, *ctx;
- if (argc != 1)
+ if (argc != 2)
return RESULT_SHOWUSAGE;
- o->mute = 0;
+ if (o == NULL)
+ return RESULT_FAILURE;
+ if (o->owner ==NULL || (b = ast_bridged_channel(o->owner)) == NULL) {
+ ast_cli(fd, "There is no call to transfer\n");
+ return RESULT_SUCCESS;
+ }
+
+ tmp = ast_ext_ctx(argv[1], &ext, &ctx);
+ if (ctx == NULL) /* supply default context if needed */
+ ctx = o->owner->context;
+ if (!ast_exists_extension(b, ctx, ext, 1, b->cid.cid_num))
+ ast_cli(fd, "No such extension exists\n");
+ else {
+ ast_cli(fd, "Whee, transferring %s to %s@%s.\n",
+ b->name, ext, ctx);
+ if (ast_async_goto(b, ctx, ext, 1))
+ ast_cli(fd, "Failed to transfer :(\n");
+ }
+ if (tmp)
+ free(tmp);
return RESULT_SUCCESS;
}
@@ -1280,7 +1497,7 @@ static int console_transfer(int fd, int argc, char *argv[])
struct ast_channel *b = NULL;
char *tmp, *ext, *ctx;
- if (argc != 2)
+ if (argc != 3)
return RESULT_SHOWUSAGE;
if (o == NULL)
return RESULT_FAILURE;
@@ -1289,7 +1506,7 @@ static int console_transfer(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
- tmp = ast_ext_ctx(argv[1], &ext, &ctx);
+ tmp = ast_ext_ctx(argv[2], &ext, &ctx);
if (ctx == NULL) /* supply default context if needed */
ctx = o->owner->context;
if (!ast_exists_extension(b, ctx, ext, 1, b->cid.cid_num))
@@ -1304,13 +1521,12 @@ static int console_transfer(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char transfer_usage[] = "Usage: transfer <extension>[@context]\n" " Transfers the currently connected call to the given extension (and\n" "context if specified)\n";
-
-static char console_usage[] =
- "Usage: console [device]\n"
- " If used without a parameter, displays which device is the current\n" "console. If a device is specified, the console sound device is changed to\n" "the device specified.\n";
+static char transfer_usage[] =
+ "Usage: console transfer <extension>[@context]\n"
+ " Transfers the currently connected call to the given extension (and\n"
+ "context if specified)\n";
-static int console_active(int fd, int argc, char *argv[])
+static int console_active_deprecated(int fd, int argc, char *argv[])
{
if (argc == 1)
ast_cli(fd, "active console is [%s]\n", oss_active);
@@ -1332,6 +1548,34 @@ static int console_active(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
+static int console_active(int fd, int argc, char *argv[])
+{
+ if (argc == 2)
+ ast_cli(fd, "active console is [%s]\n", oss_active);
+ else if (argc != 3)
+ return RESULT_SHOWUSAGE;
+ else {
+ struct chan_oss_pvt *o;
+ if (strcmp(argv[2], "show") == 0) {
+ for (o = oss_default.next; o; o = o->next)
+ ast_cli(fd, "device [%s] exists\n", o->name);
+ return RESULT_SUCCESS;
+ }
+ o = find_desc(argv[2]);
+ if (o == NULL)
+ ast_cli(fd, "No device [%s] exists\n", argv[2]);
+ else
+ oss_active = o->name;
+ }
+ return RESULT_SUCCESS;
+}
+
+static char active_usage[] =
+ "Usage: console active [device]\n"
+ " If used without a parameter, displays which device is the current\n"
+ "console. If a device is specified, the console sound device is changed to\n"
+ "the device specified.\n";
+
/*
* store the boost factor
*/
@@ -1365,18 +1609,105 @@ static int do_boost(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static struct ast_cli_entry myclis[] = {
- {{"answer", NULL}, console_answer, "Answer an incoming console call", answer_usage},
- {{"hangup", NULL}, console_hangup, "Hangup a call on the console", hangup_usage},
- {{"flash", NULL}, console_flash, "Flash a call on the console", flash_usage},
- {{"dial", NULL}, console_dial, "Dial an extension on the console", dial_usage},
- {{"mute", NULL}, console_mute, "Disable mic input", mute_usage},
- {{"unmute", NULL}, console_unmute, "Enable mic input", unmute_usage},
- {{"transfer", NULL}, console_transfer, "Transfer a call to a different extension", transfer_usage},
- {{"send", "text", NULL}, console_sendtext, "Send text to the remote device", sendtext_usage},
- {{"autoanswer", NULL}, console_autoanswer, "Sets/displays autoanswer", autoanswer_usage, autoanswer_complete},
- {{"oss", "boost", NULL}, do_boost, "Sets/displays mic boost in dB"},
- {{"console", NULL}, console_active, "Sets/displays active console", console_usage},
+static struct ast_cli_entry cli_oss_answer_deprecated = {
+ { "answer", NULL },
+ console_answer_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_hangup_deprecated = {
+ { "hangup", NULL },
+ console_hangup_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_flash_deprecated = {
+ { "flash", NULL },
+ console_flash_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_dial_deprecated = {
+ { "dial", NULL },
+ console_dial_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_mute_deprecated = {
+ { "mute", NULL },
+ console_mute_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_unmute_deprecated = {
+ { "unmute", NULL },
+ console_unmute_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_transfer_deprecated = {
+ { "transfer", NULL },
+ console_transfer_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_send_text_deprecated = {
+ { "send", "text", NULL },
+ console_sendtext_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_autoanswer_deprecated = {
+ { "autoanswer", NULL },
+ console_autoanswer_deprecated, NULL,
+ NULL, autoanswer_complete_deprecated };
+
+static struct ast_cli_entry cli_oss_boost_deprecated = {
+ { "oss", "boost", NULL },
+ do_boost, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss_active_deprecated = {
+ { "console", NULL },
+ console_active_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_oss[] = {
+ { { "console", "answer", NULL },
+ console_answer, "Answer an incoming console call",
+ answer_usage, NULL, &cli_oss_answer_deprecated },
+
+ { { "console", "hangup", NULL },
+ console_hangup, "Hangup a call on the console",
+ hangup_usage, NULL, &cli_oss_hangup_deprecated },
+
+ { { "console", "flash", NULL },
+ console_flash, "Flash a call on the console",
+ flash_usage, NULL, &cli_oss_flash_deprecated },
+
+ { { "console", "dial", NULL },
+ console_dial, "Dial an extension on the console",
+ dial_usage, NULL, &cli_oss_dial_deprecated },
+
+ { { "console", "mute", NULL },
+ console_mute, "Disable mic input",
+ mute_usage, NULL, &cli_oss_mute_deprecated },
+
+ { { "console", "unmute", NULL },
+ console_unmute, "Enable mic input",
+ unmute_usage, NULL, &cli_oss_unmute_deprecated },
+
+ { { "console", "transfer", NULL },
+ console_transfer, "Transfer a call to a different extension",
+ transfer_usage, NULL, &cli_oss_transfer_deprecated },
+
+ { { "console", "send", "text", NULL },
+ console_sendtext, "Send text to the remote device",
+ sendtext_usage, NULL, &cli_oss_send_text_deprecated },
+
+ { { "console", "autoanswer", NULL },
+ console_autoanswer, "Sets/displays autoanswer",
+ autoanswer_usage, autoanswer_complete, &cli_oss_autoanswer_deprecated },
+
+ { { "console", "boost", NULL },
+ do_boost, "Sets/displays mic boost in dB",
+ NULL, NULL, &cli_oss_boost_deprecated },
+
+ { { "console", "active", NULL },
+ console_active, "Sets/displays active console",
+ active_usage, NULL, &cli_oss_active_deprecated },
};
/*
@@ -1536,7 +1867,7 @@ static int load_module(void)
/* XXX should cleanup allocated memory etc. */
return -1;
}
- ast_cli_register_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
+ ast_cli_register_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
return 0;
}
@@ -1546,7 +1877,7 @@ static int unload_module(void)
struct chan_oss_pvt *o;
ast_channel_unregister(&oss_tech);
- ast_cli_unregister_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
+ ast_cli_unregister_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
for (o = oss_default.next; o; o = o->next) {
close(o->sounddev);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a9de2e3f0..5314f498d 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -10570,7 +10570,7 @@ static int sip_notify(int fd, int argc, char *argv[])
}
/*! \brief Disable SIP Debugging in CLI */
-static int sip_no_debug(int fd, int argc, char *argv[])
+static int sip_no_debug_deprecated(int fd, int argc, char *argv[])
{
if (argc != 3)
return RESULT_SHOWUSAGE;
@@ -10579,6 +10579,15 @@ static int sip_no_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
+static int sip_no_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ ast_clear_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONSOLE);
+ ast_cli(fd, "SIP Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
+
/*! \brief Enable SIP History logging (CLI) */
static int sip_do_history(int fd, int argc, char *argv[])
{
@@ -10591,7 +10600,7 @@ static int sip_do_history(int fd, int argc, char *argv[])
}
/*! \brief Disable SIP History logging (CLI) */
-static int sip_no_history(int fd, int argc, char *argv[])
+static int sip_no_history_deprecated(int fd, int argc, char *argv[])
{
if (argc != 3) {
return RESULT_SHOWUSAGE;
@@ -10601,6 +10610,15 @@ static int sip_no_history(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
+static int sip_no_history(int fd, int argc, char *argv[])
+{
+ if (argc != 2) {
+ return RESULT_SHOWUSAGE;
+ }
+ recordhistory = FALSE;
+ ast_cli(fd, "SIP History Recording Disabled\n");
+ return RESULT_SUCCESS;
+}
/*! \brief Authenticate for outbound registration */
static int do_register_auth(struct sip_pvt *p, struct sip_request *req, char *header, char *respheader)
@@ -10790,7 +10808,7 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d
}
static char show_domains_usage[] =
-"Usage: sip show domains\n"
+"Usage: sip list domains\n"
" Lists all configured SIP local domains.\n"
" Asterisk only responds to SIP messages to local domains.\n";
@@ -10800,22 +10818,22 @@ static char notify_usage[] =
" Message types are defined in sip_notify.conf\n";
static char show_users_usage[] =
-"Usage: sip show users [like <pattern>]\n"
+"Usage: sip list users [like <pattern>]\n"
" Lists all known SIP users.\n"
" Optional regular expression pattern is used to filter the user list.\n";
static char show_user_usage[] =
"Usage: sip show user <name> [load]\n"
-" Lists all details on one SIP user and the current status.\n"
+" Shows all details on one SIP user and the current status.\n"
" Option \"load\" forces lookup of peer in realtime storage.\n";
static char show_inuse_usage[] =
-"Usage: sip show inuse [all]\n"
+"Usage: sip list inuse [all]\n"
" List all SIP users and peers usage counters and limits.\n"
" Add option \"all\" to show all devices, not only those with a limit.\n";
static char show_channels_usage[] =
-"Usage: sip show channels\n"
+"Usage: sip list channels\n"
" Lists all currently active SIP channels.\n";
static char show_channel_usage[] =
@@ -10827,13 +10845,13 @@ static char show_history_usage[] =
" Provides detailed dialog history on a given SIP channel.\n";
static char show_peers_usage[] =
-"Usage: sip show peers [like <pattern>]\n"
+"Usage: sip list peers [like <pattern>]\n"
" Lists all known SIP peers.\n"
" Optional regular expression pattern is used to filter the peer list.\n";
static char show_peer_usage[] =
"Usage: sip show peer <name> [load]\n"
-" Lists all details on one SIP peer and the current status.\n"
+" Shows all details on one SIP peer and the current status.\n"
" Option \"load\" forces lookup of peer in realtime storage.\n";
static char prune_realtime_usage[] =
@@ -10842,7 +10860,7 @@ static char prune_realtime_usage[] =
" Optional regular expression pattern is used to filter the objects.\n";
static char show_reg_usage[] =
-"Usage: sip show registry\n"
+"Usage: sip list registry\n"
" Lists all registration requests and status.\n";
static char debug_usage[] =
@@ -10855,11 +10873,11 @@ static char debug_usage[] =
" Require peer to be registered.\n";
static char no_debug_usage[] =
-"Usage: sip no debug\n"
+"Usage: sip nodebug\n"
" Disables dumping of SIP packets for debugging purposes\n";
static char no_history_usage[] =
-"Usage: sip no history\n"
+"Usage: sip nohistory\n"
" Disables recording of SIP dialog history for debugging purposes\n";
static char history_usage[] =
@@ -10872,19 +10890,17 @@ static char sip_reload_usage[] =
" Reloads SIP configuration from sip.conf\n";
static char show_subscriptions_usage[] =
-"Usage: sip show subscriptions\n"
-" Shows active SIP subscriptions for extension states\n";
+"Usage: sip list subscriptions\n"
+" Lists active SIP subscriptions for extension states\n";
static char show_objects_usage[] =
-"Usage: sip show objects\n"
-" Shows status of known SIP objects\n";
+"Usage: sip list objects\n"
+" Lists status of known SIP objects\n";
static char show_settings_usage[] =
-"Usage: sip show settings\n"
+"Usage: sip list settings\n"
" Provides detailed list of the configuration of the SIP channel.\n";
-
-
/*! \brief Read SIP header (dialplan function) */
static int func_header_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len)
{
@@ -16569,34 +16585,157 @@ static int reload(void)
return sip_reload(0, 0, NULL);
}
-static struct ast_cli_entry my_clis[] = {
- { { "sip", "notify", NULL }, sip_notify, "Send a notify packet to a SIP peer", notify_usage, complete_sipnotify },
- { { "sip", "show", "objects", NULL }, sip_show_objects, "Show all SIP object allocations", show_objects_usage },
- { { "sip", "show", "users", NULL }, sip_show_users, "Show defined SIP users", show_users_usage },
- { { "sip", "show", "user", NULL }, sip_show_user, "Show details on specific SIP user", show_user_usage, complete_sip_show_user },
- { { "sip", "show", "subscriptions", NULL }, sip_show_subscriptions, "Show active SIP subscriptions", show_subscriptions_usage},
- { { "sip", "show", "channels", NULL }, sip_show_channels, "Show active SIP channels", show_channels_usage},
- { { "sip", "show", "channel", NULL }, sip_show_channel, "Show detailed SIP channel info", show_channel_usage, complete_sipch },
- { { "sip", "show", "history", NULL }, sip_show_history, "Show SIP dialog history", show_history_usage, complete_sipch },
- { { "sip", "show", "domains", NULL }, sip_show_domains, "List our local SIP domains.", show_domains_usage },
- { { "sip", "show", "settings", NULL }, sip_show_settings, "Show SIP global settings", show_settings_usage },
- { { "sip", "debug", NULL }, sip_do_debug, "Enable SIP debugging", debug_usage },
- { { "sip", "debug", "ip", NULL }, sip_do_debug, "Enable SIP debugging on IP", debug_usage },
- { { "sip", "debug", "peer", NULL }, sip_do_debug, "Enable SIP debugging on Peername", debug_usage, complete_sip_debug_peer },
- { { "sip", "show", "peer", NULL }, sip_show_peer, "Show details on specific SIP peer", show_peer_usage, complete_sip_show_peer },
- { { "sip", "show", "peers", NULL }, sip_show_peers, "Show defined SIP peers", show_peers_usage },
- { { "sip", "prune", "realtime", NULL }, sip_prune_realtime,
- "Prune cached Realtime object(s)", prune_realtime_usage },
- { { "sip", "prune", "realtime", "peer", NULL }, sip_prune_realtime,
- "Prune cached Realtime peer(s)", prune_realtime_usage, complete_sip_prune_realtime_peer },
- { { "sip", "prune", "realtime", "user", NULL }, sip_prune_realtime,
- "Prune cached Realtime user(s)", prune_realtime_usage, complete_sip_prune_realtime_user },
- { { "sip", "show", "inuse", NULL }, sip_show_inuse, "List all inuse/limits", show_inuse_usage },
- { { "sip", "show", "registry", NULL }, sip_show_registry, "Show SIP registration status", show_reg_usage },
- { { "sip", "history", NULL }, sip_do_history, "Enable SIP history", history_usage },
- { { "sip", "no", "history", NULL }, sip_no_history, "Disable SIP history", no_history_usage },
- { { "sip", "no", "debug", NULL }, sip_no_debug, "Disable SIP debugging", no_debug_usage },
- { { "sip", "reload", NULL }, sip_reload, "Reload SIP configuration", sip_reload_usage },
+static struct ast_cli_entry cli_sip_no_history_deprecated = {
+ { "sip", "no", "history", NULL },
+ sip_no_history_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_no_debug_deprecated = {
+ { "sip", "no", "debug", NULL },
+ sip_no_debug_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_objects_deprecated = {
+ { "sip", "show", "objects", NULL },
+ sip_show_objects, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_users_deprecated = {
+ { "sip", "show", "users", NULL },
+ sip_show_users, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_subscriptions_deprecated = {
+ { "sip", "show", "subscriptions", NULL },
+ sip_show_subscriptions, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_channels_deprecated = {
+ { "sip", "show", "channels", NULL },
+ sip_show_channels, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_domains_deprecated = {
+ { "sip", "show", "domains", NULL },
+ sip_show_domains, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_settings_deprecated = {
+ { "sip", "show", "settings", NULL },
+ sip_show_settings, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_peers_deprecated = {
+ { "sip", "show", "peers", NULL },
+ sip_show_peers, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_inuse_deprecated = {
+ { "sip", "show", "inuse", NULL },
+ sip_show_inuse, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip_show_registry_deprecated = {
+ { "sip", "show", "registry", NULL },
+ sip_show_registry, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_sip[] = {
+ { { "sip", "list", "channels", NULL },
+ sip_show_channels, "List active SIP channels",
+ show_channels_usage, NULL, &cli_sip_show_channels_deprecated },
+
+ { { "sip", "list", "domains", NULL },
+ sip_show_domains, "List our local SIP domains.",
+ show_domains_usage, NULL, &cli_sip_show_domains_deprecated },
+
+ { { "sip", "list", "inuse", NULL },
+ sip_show_inuse, "List all inuse/limits",
+ show_inuse_usage, NULL, &cli_sip_show_inuse_deprecated },
+
+ { { "sip", "list", "objects", NULL },
+ sip_show_objects, "List all SIP object allocations",
+ show_objects_usage, NULL, &cli_sip_show_objects_deprecated },
+
+ { { "sip", "list", "peers", NULL },
+ sip_show_peers, "List defined SIP peers",
+ show_peers_usage, NULL, &cli_sip_show_peers_deprecated },
+
+ { { "sip", "list", "registry", NULL },
+ sip_show_registry, "List SIP registration status",
+ show_reg_usage, NULL, &cli_sip_show_registry_deprecated },
+
+ { { "sip", "list", "settings", NULL },
+ sip_show_settings, "List SIP global settings",
+ show_settings_usage, NULL, &cli_sip_show_settings_deprecated },
+
+ { { "sip", "list", "subscriptions", NULL },
+ sip_show_subscriptions, "List active SIP subscriptions",
+ show_subscriptions_usage, NULL, &cli_sip_show_subscriptions_deprecated },
+
+ { { "sip", "list", "users", NULL },
+ sip_show_users, "List defined SIP users",
+ show_users_usage, NULL, &cli_sip_show_users_deprecated },
+
+ { { "sip", "notify", NULL },
+ sip_notify, "Send a notify packet to a SIP peer",
+ notify_usage, complete_sipnotify },
+
+ { { "sip", "show", "channel", NULL },
+ sip_show_channel, "Show detailed SIP channel info",
+ show_channel_usage, complete_sipch },
+
+ { { "sip", "show", "history", NULL },
+ sip_show_history, "Show SIP dialog history",
+ show_history_usage, complete_sipch },
+
+ { { "sip", "show", "peer", NULL },
+ sip_show_peer, "Show details on specific SIP peer",
+ show_peer_usage, complete_sip_show_peer },
+
+ { { "sip", "show", "user", NULL },
+ sip_show_user, "Show details on specific SIP user",
+ show_user_usage, complete_sip_show_user },
+
+ { { "sip", "prune", "realtime", NULL },
+ sip_prune_realtime, "Prune cached Realtime object(s)",
+ prune_realtime_usage },
+
+ { { "sip", "prune", "realtime", "peer", NULL },
+ sip_prune_realtime, "Prune cached Realtime peer(s)",
+ prune_realtime_usage, complete_sip_prune_realtime_peer },
+
+ { { "sip", "prune", "realtime", "user", NULL },
+ sip_prune_realtime, "Prune cached Realtime user(s)",
+ prune_realtime_usage, complete_sip_prune_realtime_user },
+
+ { { "sip", "debug", NULL },
+ sip_do_debug, "Enable SIP debugging",
+ debug_usage },
+
+ { { "sip", "debug", "ip", NULL },
+ sip_do_debug, "Enable SIP debugging on IP",
+ debug_usage },
+
+ { { "sip", "debug", "peer", NULL },
+ sip_do_debug, "Enable SIP debugging on Peername",
+ debug_usage, complete_sip_debug_peer },
+
+ { { "sip", "nodebug", NULL },
+ sip_no_debug, "Disable SIP debugging",
+ no_debug_usage, NULL, &cli_sip_no_debug_deprecated },
+
+ { { "sip", "history", NULL },
+ sip_do_history, "Enable SIP history",
+ history_usage },
+
+ { { "sip", "nohistory", NULL },
+ sip_no_history, "Disable SIP history",
+ no_history_usage, NULL, &cli_sip_no_history_deprecated },
+
+ { { "sip", "reload", NULL },
+ sip_reload, "Reload SIP configuration",
+ sip_reload_usage },
};
/*! \brief load_module: PBX load module - initialization */
@@ -16625,7 +16764,7 @@ static int load_module(void)
}
/* Register all CLI functions for SIP */
- ast_cli_register_multiple(my_clis, sizeof(my_clis)/ sizeof(my_clis[0]));
+ ast_cli_register_multiple(cli_sip, sizeof(cli_sip)/ sizeof(struct ast_cli_entry));
/* Tell the RTP subdriver that we're here */
ast_rtp_proto_register(&sip_rtp);
@@ -16673,7 +16812,7 @@ static int unload_module(void)
ast_unregister_application(app_dtmfmode);
ast_unregister_application(app_sipaddheader);
- ast_cli_unregister_multiple(my_clis, sizeof(my_clis) / sizeof(my_clis[0]));
+ ast_cli_unregister_multiple(cli_sip, sizeof(cli_sip) / sizeof(struct ast_cli_entry));
ast_rtp_proto_unregister(&sip_rtp);
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index c6c906cda..3d16ab92f 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -1648,7 +1648,7 @@ static int skinny_do_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static int skinny_no_debug(int fd, int argc, char *argv[])
+static int skinny_no_debug_deprecated(int fd, int argc, char *argv[])
{
if (argc != 3) {
return RESULT_SHOWUSAGE;
@@ -1658,6 +1658,16 @@ static int skinny_no_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
+static int skinny_no_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 2) {
+ return RESULT_SHOWUSAGE;
+ }
+ skinnydebug = 0;
+ ast_cli(fd, "Skinny Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
+
static char *complete_skinny_reset(const char *line, const char *word, int pos, int state)
{
struct skinny_device *d;
@@ -1839,11 +1849,11 @@ static int skinny_show_lines(int fd, int argc, char *argv[])
}
static char show_devices_usage[] =
-"Usage: skinny show devices\n"
+"Usage: skinny list devices\n"
" Lists all devices known to the Skinny subsystem.\n";
static char show_lines_usage[] =
-"Usage: skinny show lines\n"
+"Usage: skinny list lines\n"
" Lists all lines known to the Skinny subsystem.\n";
static char debug_usage[] =
@@ -1851,27 +1861,49 @@ static char debug_usage[] =
" Enables dumping of Skinny packets for debugging purposes\n";
static char no_debug_usage[] =
-"Usage: skinny no debug\n"
+"Usage: skinny nodebug\n"
" Disables dumping of Skinny packets for debugging purposes\n";
static char reset_usage[] =
"Usage: skinny reset <DeviceId|all> [restart]\n"
" Causes a Skinny device to reset itself, optionally with a full restart\n";
-static struct ast_cli_entry cli_show_devices =
- { { "skinny", "show", "devices", NULL }, skinny_show_devices, "Show defined Skinny devices", show_devices_usage };
-
-static struct ast_cli_entry cli_show_lines =
- { { "skinny", "show", "lines", NULL }, skinny_show_lines, "Show defined Skinny lines per device", show_lines_usage };
-
-static struct ast_cli_entry cli_debug =
- { { "skinny", "debug", NULL }, skinny_do_debug, "Enable Skinny debugging", debug_usage };
-
-static struct ast_cli_entry cli_no_debug =
- { { "skinny", "no", "debug", NULL }, skinny_no_debug, "Disable Skinny debugging", no_debug_usage };
-
-static struct ast_cli_entry cli_reset_device =
- { { "skinny", "reset", NULL }, skinny_reset_device, "Reset Skinny device(s)", reset_usage, complete_skinny_reset };
+static struct ast_cli_entry cli_skinny_show_devices_deprecated = {
+ { "skinny", "show", "devices", NULL },
+ skinny_show_devices, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_skinny_show_lines_deprecated = {
+ { "skinny", "show", "lines", NULL },
+ skinny_show_lines, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_skinny_no_debug_deprecated = {
+ { "skinny", "no", "debug", NULL },
+ skinny_no_debug_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_skinny[] = {
+ { { "skinny", "list", "devices", NULL },
+ skinny_show_devices, "List defined Skinny devices",
+ show_devices_usage, NULL, &cli_skinny_show_devices_deprecated },
+
+ { { "skinny", "list", "lines", NULL },
+ skinny_show_lines, "List defined Skinny lines per device",
+ show_lines_usage, NULL, &cli_skinny_show_lines_deprecated },
+
+ { { "skinny", "debug", NULL },
+ skinny_do_debug, "Enable Skinny debugging",
+ debug_usage },
+
+ { { "skinny", "nodebug", NULL },
+ skinny_no_debug, "Disable Skinny debugging",
+ no_debug_usage, NULL, &cli_skinny_no_debug_deprecated },
+
+ { { "skinny", "reset", NULL },
+ skinny_reset_device, "Reset Skinny device(s)",
+ reset_usage, complete_skinny_reset },
+};
#if 0
static struct skinny_paging_device *build_paging_device(const char *cat, struct ast_variable *v)
@@ -4496,11 +4528,7 @@ static int load_module(void)
}
ast_rtp_proto_register(&skinny_rtp);
- ast_cli_register(&cli_show_devices);
- ast_cli_register(&cli_show_lines);
- ast_cli_register(&cli_debug);
- ast_cli_register(&cli_no_debug);
- ast_cli_register(&cli_reset_device);
+ ast_cli_register_multiple(cli_skinny, sizeof(cli_skinny) / sizeof(struct ast_cli_entry));
sched = sched_context_create();
if (!sched) {
ast_log(LOG_WARNING, "Unable to create schedule context\n");
@@ -4558,11 +4586,7 @@ static int unload_module(void)
ast_rtp_proto_unregister(&skinny_rtp);
ast_channel_unregister(&skinny_tech);
- ast_cli_unregister(&cli_show_devices);
- ast_cli_unregister(&cli_show_lines);
- ast_cli_unregister(&cli_debug);
- ast_cli_unregister(&cli_no_debug);
- ast_cli_unregister(&cli_reset_device);
+ ast_cli_unregister_multiple(cli_skinny, sizeof(cli_skinny) / sizeof(struct ast_cli_entry));
return 0;
#endif
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 4d8f010cc..b10cd6bcc 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -9621,22 +9621,34 @@ static const char pri_show_spans_help[] =
" Displays PRI Information\n";
static struct ast_cli_entry zap_pri_cli[] = {
- { { "pri", "debug", "span", NULL }, handle_pri_debug,
- "Enables PRI debugging on a span", pri_debug_help, complete_span_4 },
- { { "pri", "no", "debug", "span", NULL }, handle_pri_no_debug,
- "Disables PRI debugging on a span", pri_no_debug_help, complete_span_5 },
- { { "pri", "intense", "debug", "span", NULL }, handle_pri_really_debug,
- "Enables REALLY INTENSE PRI debugging", pri_really_debug_help, complete_span_5 },
- { { "pri", "show", "spans", NULL }, handle_pri_show_spans,
- "Displays PRI Information", pri_show_spans_help },
- { { "pri", "show", "span", NULL }, handle_pri_show_span,
- "Displays PRI Information", pri_show_span_help, complete_span_4 },
- { { "pri", "show", "debug", NULL }, handle_pri_show_debug,
- "Displays current PRI debug settings" },
- { { "pri", "set", "debug", "file", NULL }, handle_pri_set_debug_file,
- "Sends PRI debug output to the specified file" },
- { { "pri", "unset", "debug", "file", NULL }, handle_pri_set_debug_file,
- "Ends PRI debug output to file" },
+ { { "pri", "debug", "span", NULL },
+ handle_pri_debug, "Enables PRI debugging on a span",
+ pri_debug_help, complete_span_4 },
+
+ { { "pri", "no", "debug", "span", NULL },
+ handle_pri_no_debug, "Disables PRI debugging on a span",
+ pri_no_debug_help, complete_span_5 },
+
+ { { "pri", "intense", "debug", "span", NULL },
+ handle_pri_really_debug, "Enables REALLY INTENSE PRI debugging",
+ pri_really_debug_help, complete_span_5 },
+
+ { { "pri", "show", "spans", NULL },
+ handle_pri_show_spans, "Displays PRI Information",
+ pri_show_spans_help },
+
+ { { "pri", "show", "span", NULL },
+ handle_pri_show_span, "Displays PRI Information",
+ pri_show_span_help, complete_span_4 },
+
+ { { "pri", "show", "debug", NULL },
+ handle_pri_show_debug, "Displays current PRI debug settings" },
+
+ { { "pri", "set", "debug", "file", NULL },
+ handle_pri_set_debug_file, "Sends PRI debug output to the specified file" },
+
+ { { "pri", "unset", "debug", "file", NULL },
+ handle_pri_set_debug_file, "Ends PRI debug output to file" },
};
#endif /* HAVE_PRI */
@@ -10012,18 +10024,29 @@ static char zap_restart_usage[] =
"";
static struct ast_cli_entry zap_cli[] = {
- { { "zap", "show", "cadences", NULL }, handle_zap_show_cadences,
- "List cadences", zap_show_cadences_help },
- { {"zap", "show", "channels", NULL}, zap_show_channels,
- "Show active zapata channels", show_channels_usage },
- { {"zap", "show", "channel", NULL}, zap_show_channel,
- "Show information on a channel", show_channel_usage },
- { {"zap", "destroy", "channel", NULL}, zap_destroy_channel,
- "Destroy a channel", destroy_channel_usage },
- { {"zap", "restart", NULL}, zap_restart_cmd,
- "Fully restart zaptel channels", zap_restart_usage },
- { {"zap", "show", "status", NULL}, zap_show_status,
- "Show all Zaptel cards status", zap_show_status_usage },
+ { { "zap", "show", "cadences", NULL },
+ handle_zap_show_cadences, "List cadences",
+ zap_show_cadences_help },
+
+ { { "zap", "show", "channels", NULL},
+ zap_show_channels, "Show active zapata channels",
+ show_channels_usage },
+
+ { { "zap", "show", "channel", NULL},
+ zap_show_channel, "Show information on a channel",
+ show_channel_usage },
+
+ { { "zap", "destroy", "channel", NULL},
+ zap_destroy_channel, "Destroy a channel",
+ destroy_channel_usage },
+
+ { { "zap", "restart", NULL},
+ zap_restart_cmd, "Fully restart zaptel channels",
+ zap_restart_usage },
+
+ { { "zap", "show", "status", NULL},
+ zap_show_status, "Show all Zaptel cards status",
+ zap_show_status_usage },
};
#define TRANSFER 0
@@ -10213,10 +10236,10 @@ static int __unload_module(void)
if (pris[i].master != AST_PTHREADT_NULL)
pthread_cancel(pris[i].master);
}
- ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
+ ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(struct ast_cli_entry));
ast_unregister_application(zap_send_keypad_facility_app);
#endif
- ast_cli_unregister_multiple(zap_cli, sizeof(zap_cli) / sizeof(zap_cli[0]));
+ ast_cli_unregister_multiple(zap_cli, sizeof(zap_cli) / sizeof(struct ast_cli_entry));
ast_manager_unregister( "ZapDialOffhook" );
ast_manager_unregister( "ZapHangup" );
ast_manager_unregister( "ZapTransfer" );
@@ -11186,9 +11209,9 @@ static int load_module(void)
#ifdef HAVE_PRI
ast_string_field_init(&inuse, 16);
ast_string_field_set(&inuse, name, "GR-303InUse");
- ast_cli_register_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
+ ast_cli_register_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(struct ast_cli_entry));
#endif
- ast_cli_register_multiple(zap_cli, sizeof(zap_cli) / sizeof(zap_cli[0]));
+ ast_cli_register_multiple(zap_cli, sizeof(zap_cli) / sizeof(struct ast_cli_entry));
memset(round_robin, 0, sizeof(round_robin));
ast_manager_register( "ZapTransfer", 0, action_transfer, "Transfer Zap Channel" );
diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c
index 0b1fc3e33..229c64043 100644
--- a/channels/iax2-provision.c
+++ b/channels/iax2-provision.c
@@ -400,7 +400,7 @@ static int iax_process_template(struct ast_config *cfg, char *s, char *def)
}
static char show_provisioning_usage[] =
-"Usage: iax show provisioning [template]\n"
+"Usage: iax list provisioning [template]\n"
" Lists all known IAX provisioning templates or a\n"
" specific one if specified.\n";
@@ -466,12 +466,20 @@ static int iax_show_provisioning(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static struct ast_cli_entry cli_show_provisioning =
- { { "iax2", "show", "provisioning", NULL }, iax_show_provisioning, "Show iax provisioning", show_provisioning_usage, iax_prov_complete_template };
+static struct ast_cli_entry cli_iax2_show_provisioning = {
+ { "iax2", "show", "provisioning", NULL },
+ iax_show_provisioning, NULL,
+ NULL, iax_prov_complete_template };
+
+static struct ast_cli_entry cli_iax2_provision[] = {
+ { { "iax2", "show", "provisioning", NULL },
+ iax_show_provisioning, "Display iax provisioning",
+ show_provisioning_usage, iax_prov_complete_template, &cli_iax2_show_provisioning },
+};
static int iax_provision_init(void)
{
- ast_cli_register(&cli_show_provisioning);
+ ast_cli_register_multiple(cli_iax2_provision, sizeof(cli_iax2_provision) / sizeof(struct ast_cli_entry));
provinit = 1;
return 0;
}
@@ -479,7 +487,7 @@ static int iax_provision_init(void)
int iax_provision_unload(void)
{
provinit = 0;
- ast_cli_unregister(&cli_show_provisioning);
+ ast_cli_unregister_multiple(cli_iax2_provision, sizeof(cli_iax2_provision) / sizeof(struct ast_cli_entry));
return 0;
}