summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2007-06-25 15:35:10 +0000
committerJoshua Colp <jcolp@digium.com>2007-06-25 15:35:10 +0000
commitd77301b8cd72c72d8d4bdc70b0557bcec3685b3b (patch)
treee2a4ba49642b64003e93650f022c79327b2dc8f0 /channels
parentb7cd8648b50d697f8b9a8271437e92ab56b48d1e (diff)
Tweak CLI command completion and some help text. (issue #10049 reported by IgorG)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@71613 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b5e1c7a38..54e842bd1 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1430,9 +1430,11 @@ static const struct cfsubscription_types *find_subscription_type(enum subscripti
static int __sip_show_channels(int fd, int argc, char *argv[], int subscriptions);
static int sip_show_channels(int fd, int argc, char *argv[]);
static int sip_show_subscriptions(int fd, int argc, char *argv[]);
-static char *complete_sipch(const char *line, const char *word, int pos, int state);
+static char *complete_sip_channel(const char *word, int state);
static char *complete_sip_peer(const char *word, int state, int flags2);
static char *complete_sip_registered_peer(const char *word, int state, int flags2);
+static char *complete_sip_show_channel(const char *line, const char *word, int pos, int state);
+static char *complete_sip_show_history(const char *line, const char *word, int pos, int state);
static char *complete_sip_show_peer(const char *line, const char *word, int pos, int state);
static char *complete_sip_unregister(const char *line, const char *word, int pos, int state);
static char *complete_sip_debug_peer(const char *line, const char *word, int pos, int state);
@@ -11285,8 +11287,8 @@ static int __sip_show_channels(int fd, int argc, char *argv[], int subscriptions
#undef FORMAT3
}
-/*! \brief Support routine for 'sip show channel' CLI */
-static char *complete_sipch(const char *line, const char *word, int pos, int state)
+/*! \brief Support routine for 'sip show channel' and 'sip show history' CLI */
+static char *complete_sip_channel(const char *word, int state)
{
int which=0;
struct sip_pvt *cur;
@@ -11339,6 +11341,24 @@ static char *complete_sip_registered_peer(const char *word, int state, int flags
return result;
}
+/*! \brief Support routine for 'sip show channel' CLI */
+static char *complete_sip_show_channel(const char *line, const char *word, int pos, int state)
+{
+ if (pos == 3)
+ return complete_sip_channel(word, state);
+
+ return NULL;
+}
+
+/*! \brief Support routine for 'sip show history' CLI */
+static char *complete_sip_show_history(const char *line, const char *word, int pos, int state)
+{
+ if (pos == 3)
+ return complete_sip_channel(word, state);
+
+ return NULL;
+}
+
/*! \brief Support routine for 'sip show peer' CLI */
static char *complete_sip_show_peer(const char *line, const char *word, int pos, int state)
{
@@ -11360,7 +11380,7 @@ static char *complete_sip_unregister(const char *line, const char *word, int pos
/*! \brief Support routine for 'sip debug peer' CLI */
static char *complete_sip_debug_peer(const char *line, const char *word, int pos, int state)
{
- if (pos == 3)
+ if (pos == 4)
return complete_sip_peer(word, state, 0);
return NULL;
@@ -11771,7 +11791,7 @@ static int sip_do_debug_peer(int fd, int argc, char *argv[])
static int sip_do_debug(int fd, int argc, char *argv[])
{
int oldsipdebug = sipdebug_console;
- if (argc != 4) {
+ if (argc != 4 || strcmp(argv[3], "on") != 0) {
if (argc != 5)
return RESULT_SHOWUSAGE;
else if (strcmp(argv[3], "ip") == 0)
@@ -12131,9 +12151,11 @@ static const char sip_unregister_usage[] =
" Unregister (force expiration) a SIP peer from the registry\n";
static const char debug_usage[] =
-"Usage: sip set debug {on|ip <host[:PORT]>|peer <peername>}\n"
+"Usage: sip set debug {on|off|ip <host[:PORT]>|peer <peername>}\n"
" sip set debug on\n"
" Enables dumping of all SIP messages for debugging purposes\n\n"
+" sip set debug off\n"
+" Disables dumping of all SIP messages\n\n"
" sip set debug ip <host[:PORT]>\n"
" Enables dumping of SIP messages to and from host.\n\n"
" sip set debug peer <peername>\n"
@@ -18238,11 +18260,11 @@ static struct ast_cli_entry cli_sip[] = {
{ { "sip", "show", "channel", NULL },
sip_show_channel, "Show detailed SIP channel info",
- show_channel_usage, complete_sipch },
+ show_channel_usage, complete_sip_show_channel },
{ { "sip", "show", "history", NULL },
sip_show_history, "Show SIP dialog history",
- show_history_usage, complete_sipch },
+ show_history_usage, complete_sip_show_history },
{ { "sip", "show", "peer", NULL },
sip_show_peer, "Show details on specific SIP peer",
@@ -18268,6 +18290,10 @@ static struct ast_cli_entry cli_sip[] = {
sip_do_debug, "Enable SIP debugging",
debug_usage },
+ { { "sip", "set", "debug", "on", NULL },
+ sip_do_debug, "Enable SIP debugging",
+ debug_usage },
+
{ { "sip", "set", "debug", "ip", NULL },
sip_do_debug, "Enable SIP debugging on IP",
debug_usage },