aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_skinny.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-11 19:03:06 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-11 19:03:06 +0000
commit13b9c5237c9f5b8b3d72634d575665b1d1147ba3 (patch)
tree44dcb2c14abed6932db4f248b17626a01a38f59b /channels/chan_skinny.c
parenta8506328befc2a11643cea88772609610ec11c33 (diff)
Merge a ton of NEW_CLI conversions. Thanks to everyone that helped out! :)
(closes issue #10724) Reported by: eliel Patches: chan_skinny.c.patch uploaded by eliel (license 64) chan_oss.c.patch uploaded by eliel (license 64) chan_mgcp.c.patch2 uploaded by eliel (license 64) pbx_config.c.patch uploaded by seanbright (license 71) iax2-provision.c.patch uploaded by eliel (license 64) chan_gtalk.c.patch uploaded by eliel (license 64) pbx_ael.c.patch uploaded by seanbright (license 71) file.c.patch uploaded by seanbright (license 71) image.c.patch uploaded by seanbright (license 71) cli.c.patch uploaded by moy (license 222) astobj2.c.patch uploaded by moy (license 222) asterisk.c.patch uploaded by moy (license 222) res_limit.c.patch uploaded by seanbright (license 71) res_convert.c.patch uploaded by seanbright (license 71) res_crypto.c.patch uploaded by seanbright (license 71) app_osplookup.c.patch uploaded by seanbright (license 71) app_rpt.c.patch uploaded by seanbright (license 71) app_mixmonitor.c.patch uploaded by seanbright (license 71) channel.c.patch uploaded by seanbright (license 71) translate.c.patch uploaded by seanbright (license 71) udptl.c.patch uploaded by seanbright (license 71) threadstorage.c.patch uploaded by seanbright (license 71) db.c.patch uploaded by seanbright (license 71) cdr.c.patch uploaded by moy (license 222) pbd_dundi.c.patch uploaded by moy (license 222) app_osplookup-rev83558.patch uploaded by moy (license 222) res_clioriginate.c.patch uploaded by moy (license 222) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@85460 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r--channels/chan_skinny.c390
1 files changed, 211 insertions, 179 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index b1a83abbe..0e5868982 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -2262,24 +2262,46 @@ static struct ast_rtp_protocol skinny_rtp = {
.set_rtp_peer = skinny_set_rtp_peer,
};
-static int skinny_do_debug(int fd, int argc, char *argv[])
+static char *handle_skinny_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- if (argc != 3)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "skinny set debug";
+ e->usage =
+ "Usage: skinny set debug\n"
+ " Enables dumping of Skinny packets for debugging purposes\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
skinnydebug = 1;
- ast_cli(fd, "Skinny Debugging Enabled\n");
- return RESULT_SUCCESS;
+ ast_cli(a->fd, "Skinny Debugging Enabled\n");
+ return CLI_SUCCESS;
}
-static int skinny_no_debug(int fd, int argc, char *argv[])
+static char *handle_skinny_set_debug_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- if (argc != 4)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "skinny set debug off";
+ e->usage =
+ "Usage: skinny set debug off\n"
+ " Disables dumping of Skinny packets for debugging purposes\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 4)
+ return CLI_SHOWUSAGE;
skinnydebug = 0;
- ast_cli(fd, "Skinny Debugging Disabled\n");
- return RESULT_SUCCESS;
+ ast_cli(a->fd, "Skinny Debugging Disabled\n");
+ return CLI_SUCCESS;
}
static char *complete_skinny_devices(const char *word, int state)
@@ -2306,7 +2328,7 @@ static char *complete_skinny_reset(const char *line, const char *word, int pos,
return (pos == 2 ? ast_strdup(complete_skinny_devices(word, state)) : NULL);
}
-static char *complete_skinny_show_lines(const char *line, const char *word, int pos, int state)
+static char *complete_skinny_show_line(const char *line, const char *word, int pos, int state)
{
struct skinny_device *d;
struct skinny_line *l;
@@ -2326,26 +2348,37 @@ static char *complete_skinny_show_lines(const char *line, const char *word, int
return result;
}
-static int skinny_reset_device(int fd, int argc, char *argv[])
+static char *handle_skinny_reset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct skinny_device *d;
struct skinny_req *req;
- if (argc < 3 || argc > 4)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "skinny reset";
+ e->usage =
+ "Usage: skinny reset <DeviceId|DeviceName|all> [restart]\n"
+ " Causes a Skinny device to reset itself, optionally with a full restart\n";
+ return NULL;
+ case CLI_GENERATE:
+ return complete_skinny_reset(a->line, a->word, a->pos, a->n);
+ }
+
+ if (a->argc < 3 || a->argc > 4)
+ return CLI_SHOWUSAGE;
ast_mutex_lock(&devicelock);
for (d = devices; d; d = d->next) {
int fullrestart = 0;
- if (!strcasecmp(argv[2], d->id) || !strcasecmp(argv[2], d->name) || !strcasecmp(argv[2], "all")) {
+ if (!strcasecmp(a->argv[2], d->id) || !strcasecmp(a->argv[2], d->name) || !strcasecmp(a->argv[2], "all")) {
if (!(d->session))
continue;
if (!(req = req_alloc(sizeof(struct reset_message), RESET_MESSAGE)))
continue;
- if (argc == 4 && !strcasecmp(argv[3], "restart"))
+ if (a->argc == 4 && !strcasecmp(a->argv[3], "restart"))
fullrestart = 1;
if (fullrestart)
@@ -2358,7 +2391,7 @@ static int skinny_reset_device(int fd, int argc, char *argv[])
}
}
ast_mutex_unlock(&devicelock);
- return RESULT_SUCCESS;
+ return CLI_SUCCESS;
}
static char *device2str(int type)
@@ -2450,18 +2483,29 @@ static void print_codec_to_cli(int fd, struct ast_codec_pref *pref)
ast_cli(fd, "none");
}
-static int skinny_show_devices(int fd, int argc, char *argv[])
+static char *handle_skinny_show_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct skinny_device *d;
struct skinny_line *l;
- if (argc != 3)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "skinny show devices";
+ e->usage =
+ "Usage: skinny show devices\n"
+ " Lists all devices known to the Skinny subsystem.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
ast_mutex_lock(&devicelock);
- ast_cli(fd, "Name DeviceId IP Type R NL\n");
- ast_cli(fd, "-------------------- ---------------- --------------- --------------- - --\n");
+ ast_cli(a->fd, "Name DeviceId IP Type R NL\n");
+ ast_cli(a->fd, "-------------------- ---------------- --------------- --------------- - --\n");
for (d = devices; d; d = d->next) {
int numlines = 0;
@@ -2469,7 +2513,7 @@ static int skinny_show_devices(int fd, int argc, char *argv[])
for (l = d->lines; l; l = l->next)
numlines++;
- ast_cli(fd, "%-20s %-16s %-15s %-15s %c %2d\n",
+ ast_cli(a->fd, "%-20s %-16s %-15s %-15s %c %2d\n",
d->name,
d->id,
d->session?ast_inet_ntoa(d->session->sin.sin_addr):"",
@@ -2480,69 +2524,91 @@ static int skinny_show_devices(int fd, int argc, char *argv[])
ast_mutex_unlock(&devicelock);
- return RESULT_SUCCESS;
+ return CLI_SUCCESS;
}
/*! \brief Show device information */
-static int skinny_show_device(int fd, int argc, char *argv[])
+static char *handle_skinny_show_device(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct skinny_device *d;
struct skinny_line *l;
struct skinny_speeddial *sd;
- struct skinny_addon *a;
+ struct skinny_addon *sa;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "skinny show device";
+ e->usage =
+ "Usage: skinny show device <DeviceId|DeviceName>\n"
+ " Lists all deviceinformation of a specific device known to the Skinny subsystem.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return complete_skinny_show_device(a->line, a->word, a->pos, a->n);
+ }
- if (argc < 4)
- return RESULT_SHOWUSAGE;
+ if (a->argc < 4)
+ return CLI_SHOWUSAGE;
ast_mutex_lock(&devicelock);
for (d = devices; d; d = d->next) {
- if (!strcasecmp(argv[3], d->id) || !strcasecmp(argv[3], d->name)) {
+ if (!strcasecmp(a->argv[3], d->id) || !strcasecmp(a->argv[3], d->name)) {
int numlines = 0, numaddons = 0, numspeeddials = 0;
for (l = d->lines; l; l = l->next)
numlines++;
- ast_cli(fd, "Name: %s\n", d->name);
- ast_cli(fd, "Id: %s\n", d->id);
- ast_cli(fd, "version: %s\n", S_OR(d->version_id, "Unknown"));
- ast_cli(fd, "Ip address: %s\n", (d->session ? ast_inet_ntoa(d->session->sin.sin_addr) : "Unknown"));
- ast_cli(fd, "Port: %d\n", (d->session ? ntohs(d->session->sin.sin_port) : 0));
- ast_cli(fd, "Device Type: %s\n", device2str(d->type));
- ast_cli(fd, "Registered: %s\n", (d->registered ? "Yes" : "No"));
- ast_cli(fd, "Lines: %d\n", numlines);
+ ast_cli(a->fd, "Name: %s\n", d->name);
+ ast_cli(a->fd, "Id: %s\n", d->id);
+ ast_cli(a->fd, "version: %s\n", S_OR(d->version_id, "Unknown"));
+ ast_cli(a->fd, "Ip address: %s\n", (d->session ? ast_inet_ntoa(d->session->sin.sin_addr) : "Unknown"));
+ ast_cli(a->fd, "Port: %d\n", (d->session ? ntohs(d->session->sin.sin_port) : 0));
+ ast_cli(a->fd, "Device Type: %s\n", device2str(d->type));
+ ast_cli(a->fd, "Registered: %s\n", (d->registered ? "Yes" : "No"));
+ ast_cli(a->fd, "Lines: %d\n", numlines);
for (l = d->lines; l; l = l->next)
- ast_cli(fd, " %s (%s)\n", l->name, l->label);
- for (a = d->addons; a; a = a->next)
+ ast_cli(a->fd, " %s (%s)\n", l->name, l->label);
+ for (sa = d->addons; sa; sa = sa->next)
numaddons++;
- ast_cli(fd, "Addons: %d\n", numaddons);
- for (a = d->addons; a; a = a->next)
- ast_cli(fd, " %s\n", a->type);
+ ast_cli(a->fd, "Addons: %d\n", numaddons);
+ for (sa = d->addons; sa; sa = sa->next)
+ ast_cli(a->fd, " %s\n", sa->type);
for (sd = d->speeddials; sd; sd = sd->next)
numspeeddials++;
- ast_cli(fd, "Speeddials: %d\n", numspeeddials);
+ ast_cli(a->fd, "Speeddials: %d\n", numspeeddials);
for (sd = d->speeddials; sd; sd = sd->next)
- ast_cli(fd, " %s (%s) ishint: %d\n", sd->exten, sd->label, sd->isHint);
+ ast_cli(a->fd, " %s (%s) ishint: %d\n", sd->exten, sd->label, sd->isHint);
}
}
ast_mutex_unlock(&devicelock);
- return RESULT_SUCCESS;
+ return CLI_SUCCESS;
}
-static int skinny_show_lines(int fd, int argc, char *argv[])
+static char *handle_skinny_show_lines(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct skinny_device *d;
struct skinny_line *l;
- if (argc != 3)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "skinny show lines";
+ e->usage =
+ "Usage: skinny show lines\n"
+ " Lists all lines known to the Skinny subsystem.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
ast_mutex_lock(&devicelock);
- ast_cli(fd, "Device Name Instance Name Label \n");
- ast_cli(fd, "-------------------- -------- -------------------- --------------------\n");
+ ast_cli(a->fd, "Device Name Instance Name Label \n");
+ ast_cli(a->fd, "-------------------- -------- -------------------- --------------------\n");
for (d = devices; d; d = d->next) {
for (l = d->lines; l; l = l->next) {
- ast_cli(fd, "%-20s %8d %-20s %-20s\n",
+ ast_cli(a->fd, "%-20s %8d %-20s %-20s\n",
d->name,
l->instance,
l->name,
@@ -2551,162 +2617,128 @@ static int skinny_show_lines(int fd, int argc, char *argv[])
}
ast_mutex_unlock(&devicelock);
- return RESULT_SUCCESS;
+ return CLI_SUCCESS;
}
/*! \brief List line information. */
-static int skinny_show_line(int fd, int argc, char *argv[])
+static char *handle_skinny_show_line(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct skinny_device *d;
struct skinny_line *l;
-
char codec_buf[512];
char group_buf[256];
- if (argc < 4)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "skinny show line";
+ e->usage =
+ "Usage: skinny show line <Line> [ on <DeviceID|DeviceName> ]\n"
+ " List all lineinformation of a specific line known to the Skinny subsystem.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return complete_skinny_show_line(a->line, a->word, a->pos, a->n);
+ }
+
+ if (a->argc < 4)
+ return CLI_SHOWUSAGE;
ast_mutex_lock(&devicelock);
/* Show all lines matching the one supplied */
for (d = devices; d; d = d->next) {
- if (argc == 6 && (strcasecmp(argv[5], d->id) && strcasecmp(argv[5], d->name)))
+ if (a->argc == 6 && (strcasecmp(a->argv[5], d->id) && strcasecmp(a->argv[5], d->name)))
continue;
for (l = d->lines; l; l = l->next) {
- if (strcasecmp(argv[3], l->name))
+ if (strcasecmp(a->argv[3], l->name))
continue;
- ast_cli(fd, "Line: %s\n", l->name);
- ast_cli(fd, "On Device: %s\n", d->name);
- ast_cli(fd, "Line Label: %s\n", l->label);
- ast_cli(fd, "Extension: %s\n", S_OR(l->exten, "<not set>"));
- ast_cli(fd, "Context: %s\n", l->context);
- ast_cli(fd, "CallGroup: %s\n", ast_print_group(group_buf, sizeof(group_buf), l->callgroup));
- ast_cli(fd, "PickupGroup: %s\n", ast_print_group(group_buf, sizeof(group_buf), l->pickupgroup));
- ast_cli(fd, "Language: %s\n", S_OR(l->language, "<not set>"));
- ast_cli(fd, "Accountcode: %s\n", S_OR(l->accountcode, "<not set>"));
- ast_cli(fd, "AmaFlag: %s\n", ast_cdr_flags2str(l->amaflags));
- ast_cli(fd, "CallerId Number: %s\n", S_OR(l->cid_num, "<not set>"));
- ast_cli(fd, "CallerId Name: %s\n", S_OR(l->cid_name, "<not set>"));
- ast_cli(fd, "Hide CallerId: %s\n", (l->hidecallerid ? "Yes" : "No"));
- ast_cli(fd, "CallForward: %s\n", S_OR(l->call_forward, "<not set>"));
- ast_cli(fd, "VoicemailBox: %s\n", S_OR(l->mailbox, "<not set>"));
- ast_cli(fd, "VoicemailNumber: %s\n", S_OR(l->vmexten, "<not set>"));
- ast_cli(fd, "MWIblink: %d\n", l->mwiblink);
- ast_cli(fd, "Regextension: %s\n", S_OR(l->regexten, "<not set>"));
- ast_cli(fd, "Regcontext: %s\n", S_OR(l->regcontext, "<not set>"));
- ast_cli(fd, "MoHInterpret: %s\n", S_OR(l->mohinterpret, "<not set>"));
- ast_cli(fd, "MoHSuggest: %s\n", S_OR(l->mohsuggest, "<not set>"));
- ast_cli(fd, "Last dialed nr: %s\n", S_OR(l->lastnumberdialed, "<no calls made yet>"));
- ast_cli(fd, "Last CallerID: %s\n", S_OR(l->lastcallerid, "<not set>"));
- ast_cli(fd, "Transfer enabled: %s\n", (l->transfer ? "Yes" : "No"));
- ast_cli(fd, "Callwaiting: %s\n", (l->callwaiting ? "Yes" : "No"));
- ast_cli(fd, "3Way Calling: %s\n", (l->threewaycalling ? "Yes" : "No"));
- ast_cli(fd, "Can forward: %s\n", (l->cancallforward ? "Yes" : "No"));
- ast_cli(fd, "Do Not Disturb: %s\n", (l->dnd ? "Yes" : "No"));
- ast_cli(fd, "NAT: %s\n", (l->nat ? "Yes" : "No"));
- ast_cli(fd, "immediate: %s\n", (l->immediate ? "Yes" : "No"));
- ast_cli(fd, "Group: %d\n", l->group);
- ast_cli(fd, "Codecs: ");
- ast_getformatname_multiple(codec_buf, sizeof(codec_buf) -1, l->capability);
- ast_cli(fd, "%s\n", codec_buf);
- ast_cli(fd, "Codec Order: (");
- print_codec_to_cli(fd, &l->prefs);
- ast_cli(fd, ")\n");
- ast_cli(fd, "\n");
+ ast_cli(a->fd, "Line: %s\n", l->name);
+ ast_cli(a->fd, "On Device: %s\n", d->name);
+ ast_cli(a->fd, "Line Label: %s\n", l->label);
+ ast_cli(a->fd, "Extension: %s\n", S_OR(l->exten, "<not set>"));
+ ast_cli(a->fd, "Context: %s\n", l->context);
+ ast_cli(a->fd, "CallGroup: %s\n", ast_print_group(group_buf, sizeof(group_buf), l->callgroup));
+ ast_cli(a->fd, "PickupGroup: %s\n", ast_print_group(group_buf, sizeof(group_buf), l->pickupgroup));
+ ast_cli(a->fd, "Language: %s\n", S_OR(l->language, "<not set>"));
+ ast_cli(a->fd, "Accountcode: %s\n", S_OR(l->accountcode, "<not set>"));
+ ast_cli(a->fd, "AmaFlag: %s\n", ast_cdr_flags2str(l->amaflags));
+ ast_cli(a->fd, "CallerId Number: %s\n", S_OR(l->cid_num, "<not set>"));
+ ast_cli(a->fd, "CallerId Name: %s\n", S_OR(l->cid_name, "<not set>"));
+ ast_cli(a->fd, "Hide CallerId: %s\n", (l->hidecallerid ? "Yes" : "No"));
+ ast_cli(a->fd, "CallForward: %s\n", S_OR(l->call_forward, "<not set>"));
+ ast_cli(a->fd, "VoicemailBox: %s\n", S_OR(l->mailbox, "<not set>"));
+ ast_cli(a->fd, "VoicemailNumber: %s\n", S_OR(l->vmexten, "<not set>"));
+ ast_cli(a->fd, "MWIblink: %d\n", l->mwiblink);
+ ast_cli(a->fd, "Regextension: %s\n", S_OR(l->regexten, "<not set>"));
+ ast_cli(a->fd, "Regcontext: %s\n", S_OR(l->regcontext, "<not set>"));
+ ast_cli(a->fd, "MoHInterpret: %s\n", S_OR(l->mohinterpret, "<not set>"));
+ ast_cli(a->fd, "MoHSuggest: %s\n", S_OR(l->mohsuggest, "<not set>"));
+ ast_cli(a->fd, "Last dialed nr: %s\n", S_OR(l->lastnumberdialed, "<no calls made yet>"));
+ ast_cli(a->fd, "Last CallerID: %s\n", S_OR(l->lastcallerid, "<not set>"));
+ ast_cli(a->fd, "Transfer enabled: %s\n", (l->transfer ? "Yes" : "No"));
+ ast_cli(a->fd, "Callwaiting: %s\n", (l->callwaiting ? "Yes" : "No"));
+ ast_cli(a->fd, "3Way Calling: %s\n", (l->threewaycalling ? "Yes" : "No"));
+ ast_cli(a->fd, "Can forward: %s\n", (l->cancallforward ? "Yes" : "No"));
+ ast_cli(a->fd, "Do Not Disturb: %s\n", (l->dnd ? "Yes" : "No"));
+ ast_cli(a->fd, "NAT: %s\n", (l->nat ? "Yes" : "No"));
+ ast_cli(a->fd, "immediate: %s\n", (l->immediate ? "Yes" : "No"));
+ ast_cli(a->fd, "Group: %d\n", l->group);
+ ast_cli(a->fd, "Codecs: ");
+ ast_getformatname_multiple(codec_buf, sizeof(codec_buf) - 1, l->capability);
+ ast_cli(a->fd, "%s\n", codec_buf);
+ ast_cli(a->fd, "Codec Order: (");
+ print_codec_to_cli(a->fd, &l->prefs);
+ ast_cli(a->fd, ")\n");
+ ast_cli(a->fd, "\n");
}
}
ast_mutex_unlock(&devicelock);
- return RESULT_SUCCESS;
+ return CLI_SUCCESS;
}
/*! \brief List global settings for the Skinny subsystem. */
-static int skinny_show_settings(int fd, int argc, char *argv[])
+static char *handle_skinny_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- if (argc != 3)
- return RESULT_SHOWUSAGE;
-
- ast_cli(fd, "\nGlobal Settings:\n");
- ast_cli(fd, " Skinny Port: %d\n", ntohs(bindaddr.sin_port));
- ast_cli(fd, " Bindaddress: %s\n", ast_inet_ntoa(bindaddr.sin_addr));
- ast_cli(fd, " KeepAlive: %d\n", keep_alive);
- ast_cli(fd, " Date Format: %s\n", date_format);
- ast_cli(fd, " Voice Mail Extension: %s\n", S_OR(vmexten, "(not set)"));
- ast_cli(fd, " Reg. context: %s\n", S_OR(regcontext, "(not set)"));
- ast_cli(fd, " Jitterbuffer enabled: %s\n", (ast_test_flag(&global_jbconf, AST_JB_ENABLED) ? "Yes" : "No"));
- ast_cli(fd, " Jitterbuffer forced: %s\n", (ast_test_flag(&global_jbconf, AST_JB_FORCED) ? "Yes" : "No"));
- ast_cli(fd, " Jitterbuffer max size: %ld\n", global_jbconf.max_size);
- ast_cli(fd, " Jitterbuffer resync: %ld\n", global_jbconf.resync_threshold);
- ast_cli(fd, " Jitterbuffer impl: %s\n", global_jbconf.impl);
- ast_cli(fd, " Jitterbuffer log: %s\n", (ast_test_flag(&global_jbconf, AST_JB_LOG) ? "Yes" : "No"));
-
- return RESULT_SUCCESS;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "skinny show settings";
+ e->usage =
+ "Usage: skinny show settings\n"
+ " Lists all global configuration settings of the Skinny subsystem.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+
+ ast_cli(a->fd, "\nGlobal Settings:\n");
+ ast_cli(a->fd, " Skinny Port: %d\n", ntohs(bindaddr.sin_port));
+ ast_cli(a->fd, " Bindaddress: %s\n", ast_inet_ntoa(bindaddr.sin_addr));
+ ast_cli(a->fd, " KeepAlive: %d\n", keep_alive);
+ ast_cli(a->fd, " Date Format: %s\n", date_format);
+ ast_cli(a->fd, " Voice Mail Extension: %s\n", S_OR(vmexten, "(not set)"));
+ ast_cli(a->fd, " Reg. context: %s\n", S_OR(regcontext, "(not set)"));
+ ast_cli(a->fd, " Jitterbuffer enabled: %s\n", (ast_test_flag(&global_jbconf, AST_JB_ENABLED) ? "Yes" : "No"));
+ ast_cli(a->fd, " Jitterbuffer forced: %s\n", (ast_test_flag(&global_jbconf, AST_JB_FORCED) ? "Yes" : "No"));
+ ast_cli(a->fd, " Jitterbuffer max size: %ld\n", global_jbconf.max_size);
+ ast_cli(a->fd, " Jitterbuffer resync: %ld\n", global_jbconf.resync_threshold);
+ ast_cli(a->fd, " Jitterbuffer impl: %s\n", global_jbconf.impl);
+ ast_cli(a->fd, " Jitterbuffer log: %s\n", (ast_test_flag(&global_jbconf, AST_JB_LOG) ? "Yes" : "No"));
+
+ return CLI_SUCCESS;
}
-static const char show_devices_usage[] =
-"Usage: skinny show devices\n"
-" Lists all devices known to the Skinny subsystem.\n";
-
-static const char show_device_usage[] =
-"Usage: skinny show device <DeviceId|DeviceName>\n"
-" Lists all deviceinformation of a specific device known to the Skinny subsystem.\n";
-
-static const char show_lines_usage[] =
-"Usage: skinny show lines\n"
-" Lists all lines known to the Skinny subsystem.\n";
-
-static const char show_line_usage[] =
-"Usage: skinny show line <Line> [ on <DeviceID|DeviceName> ]\n"
-" List all lineinformation of a specific line known to the Skinny subsystem.\n";
-
-static const char show_settings_usage[] =
-"Usage: skinny show settings\n"
-" Lists all global configuration settings of the Skinny subsystem.\n";
-
-static const char debug_usage[] =
-"Usage: skinny set debug\n"
-" Enables dumping of Skinny packets for debugging purposes\n";
-
-static const char no_debug_usage[] =
-"Usage: skinny set debug off\n"
-" Disables dumping of Skinny packets for debugging purposes\n";
-
-static const char reset_usage[] =
-"Usage: skinny reset <DeviceId|DeviceName|all> [restart]\n"
-" Causes a Skinny device to reset itself, optionally with a full restart\n";
-
static struct ast_cli_entry cli_skinny[] = {
- { { "skinny", "show", "devices", NULL },
- skinny_show_devices, "List defined Skinny devices",
- show_devices_usage },
-
- { { "skinny", "show", "device", NULL },
- skinny_show_device, "List Skinny device information",
- show_device_usage, complete_skinny_show_device },
-
- { { "skinny", "show", "lines", NULL },
- skinny_show_lines, "List defined Skinny lines per device",
- show_lines_usage },
-
- { { "skinny", "show", "line", NULL },
- skinny_show_line, "List Skinny line information",
- show_line_usage, complete_skinny_show_lines },
-
- { { "skinny", "show", "settings", NULL },
- skinny_show_settings, "List global Skinny settings",
- show_settings_usage },
-
- { { "skinny", "set", "debug", NULL },
- skinny_do_debug, "Enable Skinny debugging",
- debug_usage },
-
- { { "skinny", "set", "debug", "off", NULL },
- skinny_no_debug, "Disable Skinny debugging",
- no_debug_usage },
-
- { { "skinny", "reset", NULL },
- skinny_reset_device, "Reset Skinny device(s)",
- reset_usage, complete_skinny_reset },
+ NEW_CLI(handle_skinny_show_devices, "List defined Skinny devices"),
+ NEW_CLI(handle_skinny_show_device, "List Skinny device information"),
+ NEW_CLI(handle_skinny_show_lines, "List defined Skinny lines per device"),
+ NEW_CLI(handle_skinny_show_line, "List Skinny line information"),
+ NEW_CLI(handle_skinny_show_settings, "List global Skinny settings"),
+ NEW_CLI(handle_skinny_set_debug, "Enable Skinny debugging"),
+ NEW_CLI(handle_skinny_set_debug_off, "Disable Skinny debugging"),
+ NEW_CLI(handle_skinny_reset, "Reset Skinny device(s)"),
};
#if 0