[asterisk-addons-commits] qwell: trunk r474 - in /trunk: ./ asterisk-ooh323c/src/
SVN commits to the Asterisk addons project
asterisk-addons-commits at lists.digium.com
Mon Oct 22 15:11:46 CDT 2007
Author: qwell
Date: Mon Oct 22 15:11:45 2007
New Revision: 474
URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=474
Log:
Move to new AST_CLI_DEFINE way of creating CLI commands.
Closes issue #11042, patch by seanbright.
Modified:
trunk/asterisk-ooh323c/src/chan_h323.c
trunk/cdr_addon_mysql.c
trunk/chan_mobile.c
trunk/res_config_mysql.c
Modified: trunk/asterisk-ooh323c/src/chan_h323.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/asterisk-ooh323c/src/chan_h323.c?view=diff&rev=474&r1=473&r2=474
==============================================================================
--- trunk/asterisk-ooh323c/src/chan_h323.c (original)
+++ trunk/asterisk-ooh323c/src/chan_h323.c Mon Oct 22 15:11:45 2007
@@ -2047,98 +2047,115 @@
ast_verbose("+++ reload_config\n");
return 0;
-
-}
-
-
-static int ooh323_show_peer(int fd, int argc, char *argv[])
-{
- struct ooh323_peer *prev=NULL, *peer=NULL;
- char formats[512];
- char ip_port[30];
- if(argc != 4)
- return RESULT_SHOWUSAGE;
-
-
- ast_mutex_lock(&peerl.lock);
- peer = peerl.peers;
- while(peer)
- {
- ast_mutex_lock(&peer->lock);
- if(!strcmp(peer->name, argv[3]))
- break;
- else{
- prev = peer;
- peer = peer->next;
- ast_mutex_unlock(&prev->lock);
- }
- }
-
- if(peer)
- {
- sprintf(ip_port, "%s:%d", peer->ip, peer->port);
- ast_cli(fd, "%-15.15s%s\n", "Name: ", peer->name);
- ast_cli(fd, "%-15.15s%s", "Format Prefs: ", "(");
- print_codec_to_cli(fd, &peer->prefs);
- ast_cli(fd, ")\n");
- ast_cli(fd, "%-15.15s", "DTMF Mode: ");
- if(peer->dtmfmode & H323_DTMF_RFC2833)
- ast_cli(fd, "%s\n", "rfc2833");
- else if(peer->dtmfmode & H323_DTMF_Q931)
- ast_cli(fd, "%s\n", "q931keypad");
- else if(peer->dtmfmode & H323_DTMF_H245ALPHANUMERIC)
- ast_cli(fd, "%s\n", "h245alphanumeric");
- else if(peer->dtmfmode & H323_DTMF_H245SIGNAL)
- ast_cli(fd, "%s\n", "h245signal");
- else
- ast_cli(fd, "%s\n", "unknown");
- ast_cli(fd, "%-15.15s%s\n", "AccountCode: ", peer->accountcode);
- ast_cli(fd, "%-15.15s%s\n", "AMA flags: ",
- ast_cdr_flags2str(peer->amaflags));
- ast_cli(fd, "%-15.15s%s\n", "Ip:Port: ", ip_port);
- ast_cli(fd, "%-15.15s%d\n", "OutgoingLimit: ", peer->outgoinglimit);
- ast_cli(fd, "%-15.15s%d\n", "rtptimeout: ", peer->rtptimeout);
- ast_mutex_unlock(&peer->lock);
- }
- else{
- ast_cli(fd, "Peer %s not found\n", argv[3]);
- ast_cli(fd, "\n");
- }
- ast_mutex_unlock(&peerl.lock);
-
- return RESULT_SUCCESS;
-}
-
-static int ooh323_show_peers(int fd, int argc, char *argv[])
-{
- struct ooh323_peer *prev = NULL, *peer=NULL;
- char formats[512];
- char ip_port[30];
+}
+
+static char *handle_cli_ooh323_show_peer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ char ip_port[30];
+ struct ooh323_peer *prev = NULL, *peer = NULL;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ooh323 show peer";
+ e->usage =
+ "Usage: ooh323 show peer <name>\n"
+ " List details of specific OOH323 peer.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 4)
+ return CLI_SHOWUSAGE;
+
+ ast_mutex_lock(&peerl.lock);
+ peer = peerl.peers;
+ while (peer) {
+ ast_mutex_lock(&peer->lock);
+ if (!strcmp(peer->name, a->argv[3]))
+ break;
+ else {
+ prev = peer;
+ peer = peer->next;
+ ast_mutex_unlock(&prev->lock);
+ }
+ }
+
+ if (peer) {
+ snprintf(ip_port, sizeof(ip_port), "%s:%d", peer->ip, peer->port);
+ ast_cli(a->fd, "%-15.15s%s\n", "Name: ", peer->name);
+ ast_cli(a->fd, "%-15.15s%s", "Format Prefs: ", "(");
+ print_codec_to_cli(a->fd, &peer->prefs);
+ ast_cli(a->fd, ")\n");
+ ast_cli(a->fd, "%-15.15s", "DTMF Mode: ");
+ if (peer->dtmfmode & H323_DTMF_RFC2833)
+ ast_cli(a->fd, "%s\n", "rfc2833");
+ else if (peer->dtmfmode & H323_DTMF_Q931)
+ ast_cli(a->fd, "%s\n", "q931keypad");
+ else if (peer->dtmfmode & H323_DTMF_H245ALPHANUMERIC)
+ ast_cli(a->fd, "%s\n", "h245alphanumeric");
+ else if (peer->dtmfmode & H323_DTMF_H245SIGNAL)
+ ast_cli(a->fd, "%s\n", "h245signal");
+ else
+ ast_cli(a->fd, "%s\n", "unknown");
+ ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", peer->accountcode);
+ ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ",
+ ast_cdr_flags2str(peer->amaflags));
+ ast_cli(a->fd, "%-15.15s%s\n", "Ip:Port: ", ip_port);
+ ast_cli(a->fd, "%-15.15s%d\n", "OutgoingLimit: ", peer->outgoinglimit);
+ ast_cli(a->fd, "%-15.15s%d\n", "rtptimeout: ", peer->rtptimeout);
+ ast_mutex_unlock(&peer->lock);
+ } else {
+ ast_cli(a->fd, "Peer %s not found\n", a->argv[3]);
+ ast_cli(a->fd, "\n");
+ }
+ ast_mutex_unlock(&peerl.lock);
+
+ return CLI_SUCCESS;
+}
+
+static char *handle_cli_ooh323_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ char ip_port[30];
+ char formats[512];
+ struct ooh323_peer *prev = NULL, *peer=NULL;
+
#define FORMAT "%-15.15s %-15.15s %-23.23s %-s\n"
- if (argc != 3)
- return RESULT_SHOWUSAGE;
-
- ast_cli(fd, FORMAT, "Name", "Accountcode", "ip:port", "Formats");
-
- ast_mutex_lock(&peerl.lock);
- peer = peerl.peers;
- while(peer)
- {
- ast_mutex_lock(&peer->lock);
- sprintf(ip_port, "%s:%d", peer->ip, peer->port);
- ast_cli(fd, FORMAT, peer->name,
- peer->accountcode,
- ip_port,
- ast_getformatname_multiple(formats,512,peer->capability));
- prev = peer;
- peer = peer->next;
- ast_mutex_unlock(&prev->lock);
-
- }
- ast_mutex_unlock(&peerl.lock);
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ooh323 show peers";
+ e->usage =
+ "Usage: ooh323 show peers\n"
+ " Lists all known OOH323 peers.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+
+ ast_cli(a->fd, FORMAT, "Name", "Accountcode", "ip:port", "Formats");
+
+ ast_mutex_lock(&peerl.lock);
+ peer = peerl.peers;
+ while (peer) {
+ ast_mutex_lock(&peer->lock);
+ snprintf(ip_port, sizeof(ip_port), "%s:%d", peer->ip, peer->port);
+ ast_cli(a->fd, FORMAT, peer->name,
+ peer->accountcode,
+ ip_port,
+ ast_getformatname_multiple(formats, 512, peer->capability));
+ prev = peer;
+ peer = peer->next;
+ ast_mutex_unlock(&prev->lock);
+ }
+ ast_mutex_unlock(&peerl.lock);
+
#undef FORMAT
- return RESULT_SUCCESS;
+
+ return CLI_SUCCESS;
}
/*! \brief Print codec list from preference to CLI/manager */
@@ -2159,249 +2176,229 @@
ast_cli(fd, "none");
}
-static int ooh323_show_user(int fd, int argc, char *argv[])
-{
- struct ooh323_user *prev=NULL, *user=NULL;
+static char *handle_cli_ooh323_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ struct ooh323_user *prev = NULL, *user = NULL;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ooh323 show user";
+ e->usage =
+ "Usage: ooh323 show user <name>\n"
+ " List details of specific OOH323 user.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 4)
+ return CLI_SHOWUSAGE;
+
+ ast_mutex_lock(&userl.lock);
+ user = userl.users;
+ while (user) {
+ ast_mutex_lock(&user->lock);
+ if (!strcmp(user->name, a->argv[3]))
+ break;
+ else {
+ prev = user;
+ user = user->next;
+ ast_mutex_unlock(&prev->lock);
+ }
+ }
+
+ if (user) {
+ ast_cli(a->fd, "%-15.15s%s\n", "Name: ", user->name);
+ ast_cli(a->fd, "%-15.15s%s", "Format Prefs: ", "(");
+ print_codec_to_cli(a->fd, &user->prefs);
+ ast_cli(a->fd, ")\n");
+ ast_cli(a->fd, "%-15.15s", "DTMF Mode: ");
+ if (user->dtmfmode & H323_DTMF_RFC2833)
+ ast_cli(a->fd, "%s\n", "rfc2833");
+ else if (user->dtmfmode & H323_DTMF_Q931)
+ ast_cli(a->fd, "%s\n", "q931keypad");
+ else if (user->dtmfmode & H323_DTMF_H245ALPHANUMERIC)
+ ast_cli(a->fd, "%s\n", "h245alphanumeric");
+ else if(user->dtmfmode & H323_DTMF_H245SIGNAL)
+ ast_cli(a->fd, "%s\n", "h245signal");
+ else
+ ast_cli(a->fd, "%s\n", "unknown");
+ ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", user->accountcode);
+ ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ", ast_cdr_flags2str(user->amaflags));
+ ast_cli(a->fd, "%-15.15s%s\n", "Context: ", user->context);
+ ast_cli(a->fd, "%-15.15s%d\n", "IncomingLimit: ", user->incominglimit);
+ ast_cli(a->fd, "%-15.15s%d\n", "rtptimeout: ", user->rtptimeout);
+ ast_mutex_unlock(&user->lock);
+ } else {
+ ast_cli(a->fd, "User %s not found\n", a->argv[3]);
+ ast_cli(a->fd, "\n");
+ }
+ ast_mutex_unlock(&userl.lock);
+
+ return CLI_SUCCESS;
+}
+
+static char *handle_cli_ooh323_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
char formats[512];
-
- if(argc != 4)
- return RESULT_SHOWUSAGE;
-
-
- ast_mutex_lock(&userl.lock);
- user = userl.users;
- while(user)
- {
- ast_mutex_lock(&user->lock);
- if(!strcmp(user->name, argv[3])) {
- break;
- }
- else {
- prev = user;
- user = user->next;
- ast_mutex_unlock(&prev->lock);
- }
- }
-
- if(user)
- {
- ast_cli(fd, "%-15.15s%s\n", "Name: ", user->name);
- ast_cli(fd, "%-15.15s%s", "Format Prefs: ", "(");
- print_codec_to_cli(fd, &user->prefs);
- ast_cli(fd, ")\n");
- ast_cli(fd, "%-15.15s", "DTMF Mode: ");
- if(user->dtmfmode & H323_DTMF_RFC2833)
- ast_cli(fd, "%s\n", "rfc2833");
- else if(user->dtmfmode & H323_DTMF_Q931)
- ast_cli(fd, "%s\n", "q931keypad");
- else if(user->dtmfmode & H323_DTMF_H245ALPHANUMERIC)
- ast_cli(fd, "%s\n", "h245alphanumeric");
- else if(user->dtmfmode & H323_DTMF_H245SIGNAL)
- ast_cli(fd, "%s\n", "h245signal");
- else
- ast_cli(fd, "%s\n", "unknown");
- ast_cli(fd, "%-15.15s%s\n", "AccountCode: ", user->accountcode);
- ast_cli(fd, "%-15.15s%s\n", "AMA flags: ",
- ast_cdr_flags2str(user->amaflags));
- ast_cli(fd, "%-15.15s%s\n", "Context: ", user->context);
- ast_cli(fd, "%-15.15s%d\n", "IncomingLimit: ", user->incominglimit);
- ast_cli(fd, "%-15.15s%d\n", "rtptimeout: ", user->rtptimeout);
- ast_mutex_unlock(&user->lock);
- }
- else{
- ast_cli(fd, "User %s not found\n", argv[3]);
- ast_cli(fd, "\n");
- }
- ast_mutex_unlock(&userl.lock);
-
+ struct ooh323_user *prev = NULL, *user=NULL;
+
+#define FORMAT1 "%-15.15s %-15.15s %-15.15s %-s\n"
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ooh323 show users";
+ e->usage =
+ "Usage: ooh323 show users \n"
+ " Lists all known OOH323 users.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+
+ ast_cli(a->fd, FORMAT1, "Username", "Accountcode", "Context", "Formats");
+
+ ast_mutex_lock(&userl.lock);
+ user = userl.users;
+ while (user) {
+ ast_mutex_lock(&user->lock);
+ ast_cli(a->fd, FORMAT1, user->name,
+ user->accountcode, user->context,
+ ast_getformatname_multiple(formats, 512, user->capability));
+ prev = user;
+ user = user->next;
+ ast_mutex_unlock(&prev->lock);
+ }
+ ast_mutex_unlock(&userl.lock);
+
+#undef FORMAT1
+
+ return CLI_SUCCESS;
+}
+
+static char *handle_cli_ooh323_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ooh323 set debug [off]";
+ e->usage =
+ "Usage: ooh323 set debug [off]\n"
+ " Enables/Disables debugging of OOH323 channel driver\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc < 3 || a->argc > 4)
+ return CLI_SHOWUSAGE;
+ if (a->argc == 4 && strcasecmp(a->argv[3], "off"))
+ return CLI_SHOWUSAGE;
+
+ gH323Debug = (a->argc == 4) ? FALSE : TRUE;
+ ast_cli(a->fd, "OOH323 Debugging %s\n", gH323Debug ? "Enabled" : "Disabled");
+
+ return CLI_SUCCESS;
+}
+
+static int ooh323_show_channels(int fd, int argc, char *argv[])
+{
return RESULT_SUCCESS;
}
-static int ooh323_show_users(int fd, int argc, char *argv[])
-{
- struct ooh323_user *prev = NULL, *user=NULL;
- char formats[512];
-#define FORMAT1 "%-15.15s %-15.15s %-15.15s %-s\n"
-
- if (argc != 3)
- return RESULT_SHOWUSAGE;
-
- ast_cli(fd, FORMAT1, "Username", "Accountcode", "Context", "Formats");
-
- ast_mutex_lock(&userl.lock);
- user = userl.users;
- while(user)
- {
- ast_mutex_lock(&user->lock);
- ast_cli(fd, FORMAT1, user->name,
- user->accountcode, user->context,
- ast_getformatname_multiple(formats,512,user->capability));
- prev = user;
- user = user->next;
- ast_mutex_unlock(&prev->lock);
-
- }
- ast_mutex_unlock(&userl.lock);
-#undef FORMAT1
- return RESULT_SUCCESS;
-
-}
-
-static int ooh323_do_debug(int fd, int argc, char *argv[])
-{
- if (argc != 2)
- return RESULT_SHOWUSAGE;
-
- gH323Debug = TRUE;
- ast_cli(fd, "OOH323 Debugging Enabled\n");
- return RESULT_SUCCESS;
-}
-
-static int ooh323_no_debug(int fd, int argc, char *argv[])
-
-{
- if (argc != 3)
- return RESULT_SHOWUSAGE;
- gH323Debug = FALSE;
- ast_cli(fd, "OOH323 Debugging Disabled\n");
- return RESULT_SUCCESS;
-}
-
-static int ooh323_show_channels(int fd, int argc, char *argv[])
-{
- return RESULT_SUCCESS;
-}
-
-static int ooh323_show_config(int fd, int argc, char *argv[])
-{
- char value[512];
- ooAliases *pAlias = NULL, *pAliasNext=NULL;;
-
- ast_cli(fd, "\nObjective Open H.323 Channel Driver's Config:\n");
- sprintf(value, "%s:%d", gIP, gPort);
- ast_cli(fd, "%-20s%s\n", "IP:Port: ", value);
- ast_cli(fd, "%-20s%s\n", "FastStart", gFastStart?"yes":"no");
- ast_cli(fd, "%-20s%s\n", "Tunneling", gTunneling?"yes":"no");
- ast_cli(fd, "%-20s%s\n", "CallerId", gCallerID);
- ast_cli(fd, "%-20s%s\n", "MediaWaitForConnect",
- gMediaWaitForConnect?"yes":"no");
- ast_cli(fd, "%-15s%s\n", "MediaWaitForConnect",
- gMediaWaitForConnect?"yes":"no");
+static char *handle_cli_ooh323_show_config(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ char value[512];
+ ooAliases *pAlias = NULL, *pAliasNext=NULL;;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ooh323 show config";
+ e->usage =
+ "Usage: ooh323 show config\n"
+ " Shows global configuration of H.323 channel driver\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+
+ snprintf(value, sizeof(value), "%s:%d", gIP, gPort);
+ ast_cli(a->fd, "\nObjective Open H.323 Channel Driver's Config:\n");
+ ast_cli(a->fd, "%-20s%s\n", "IP:Port: ", value);
+ ast_cli(a->fd, "%-20s%s\n", "FastStart", gFastStart?"yes":"no");
+ ast_cli(a->fd, "%-20s%s\n", "Tunneling", gTunneling?"yes":"no");
+ ast_cli(a->fd, "%-20s%s\n", "CallerId", gCallerID);
+ ast_cli(a->fd, "%-20s%s\n", "MediaWaitForConnect", gMediaWaitForConnect ? "yes" : "no");
+ ast_cli(a->fd, "%-15s%s\n", "MediaWaitForConnect", gMediaWaitForConnect ? "yes" : "no");
#if (0)
- extern OOH323EndPoint gH323ep;
- ast_cli(fd, "%-20s%s\n", "FASTSTART",
- (OO_TESTFLAG(gH323ep.flags, OO_M_FASTSTART) != 0) ? "yes" : "no");
- ast_cli(fd, "%-20s%s\n", "TUNNELING",
- (OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING) != 0) ? "yes" : "no");
- ast_cli(fd, "%-20s%s\n", "MEDIAWAITFORCONN",
- (OO_TESTFLAG(gH323ep.flags, OO_M_MEDIAWAITFORCONN) != 0) ? "yes" : "no");
+ {
+ extern OOH323EndPoint gH323ep;
+
+ ast_cli(a->fd, "%-20s%s\n", "FASTSTART",
+ (OO_TESTFLAG(gH323ep.flags, OO_M_FASTSTART) != 0) ? "yes" : "no");
+ ast_cli(a->fd, "%-20s%s\n", "TUNNELING",
+ (OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING) != 0) ? "yes" : "no");
+ ast_cli(a->fd, "%-20s%s\n", "MEDIAWAITFORCONN",
+ (OO_TESTFLAG(gH323ep.flags, OO_M_MEDIAWAITFORCONN) != 0) ? "yes" : "no");
+ }
#endif
- if(gRasGkMode == RasNoGatekeeper)
- sprintf(value, "%s", "No Gatekeeper");
- else if(gRasGkMode == RasDiscoverGatekeeper)
- sprintf(value, "%s", "Discover");
- else
- sprintf(value, "%s", gGatekeeper);
-
- ast_cli(fd, "%-20s%s\n", "Gatekeeper:", value);
-
- ast_cli(fd, "%-20s%s\n", "H.323 LogFile:", gLogFile);
-
- ast_cli(fd, "%-20s%s\n", "Context:", gContext);
-
- ast_cli(fd, "%-20s%s\n", "Capability:",
- ast_getformatname_multiple(value,512,gCapability));
-
- ast_cli(fd, "%-20s", "DTMF Mode: ");
- if(gDTMFMode & H323_DTMF_RFC2833)
- ast_cli(fd, "%s\n", "rfc2833");
- else if (gDTMFMode & H323_DTMF_Q931)
- ast_cli(fd, "%s\n", "q931keypad");
- else if(gDTMFMode & H323_DTMF_H245ALPHANUMERIC)
- ast_cli(fd, "%s\n", "h245alphanumeric");
- else if(gDTMFMode & H323_DTMF_H245SIGNAL)
- ast_cli(fd, "%s\n", "h245signal");
- else
- ast_cli(fd, "%s\n", "unknown");
-
- ast_cli(fd, "%-20s%s\n", "AccountCode: ", gAccountcode);
-
- ast_cli(fd, "%-20s%s\n", "AMA flags: ", ast_cdr_flags2str(gAMAFLAGS));
-
- pAlias = gAliasList;
- if(pAlias)
- {
- ast_cli(fd, "%-20s\n", "Aliases: ");
- }
- while(pAlias)
- {
- pAliasNext = pAlias->next;
- if(pAliasNext)
- {
- ast_cli(fd,"\t%-30s\t%-30s\n",pAlias->value, pAliasNext->value);
- pAlias = pAliasNext->next;
- }
- else{
- ast_cli(fd,"\t%-30s\n",pAlias->value);
- pAlias = pAlias->next;
- }
- }
- return RESULT_SUCCESS;
-}
-
-static char show_config_usage[]=
-"Usage: ooh323 show config\n"
-" Shows global configuration of H.323 channel driver\n";
-
-static char debug_usage[] =
-"Usage: ooh323 debug\n"
-" Enables debugging of OOH323 channel driver\n";
-
-static struct ast_cli_entry cli_debug =
- { { "ooh323", "debug", NULL }, ooh323_do_debug, "Enable OOH323 debugging", debug_usage };
-
-static char no_debug_usage[] =
-"Usage: ooh323 no debug\n"
-" Disables debugging of OOH323 channel driver\n";
-
-static struct ast_cli_entry cli_no_debug =
- { { "ooh323", "no", "debug", NULL }, ooh323_no_debug, "Disable OOH323 debugging", no_debug_usage };
-
-static char show_users_usage[] =
-"Usage: ooh323 show users \n"
-" Lists all known OOH323 users.\n";
-
-static struct ast_cli_entry cli_show_users =
- { { "ooh323", "show", "users", NULL }, ooh323_show_users, "Show defined OOH323 users", show_users_usage };
-
-static char show_user_usage[] =
-"Usage: ooh323 show user <name> \n"
-" List details of specific OOH323 user.\n";
-
-static struct ast_cli_entry cli_show_user =
- { { "ooh323", "show", "user", NULL }, ooh323_show_user, "Show details on specific OOH323 user", show_user_usage };
-
-static char show_peers_usage[] =
-"Usage: ooh323 show peers \n"
-" Lists all known OOH323 peers.\n";
-
-static struct ast_cli_entry cli_show_peers =
- { { "ooh323", "show", "peers", NULL }, ooh323_show_peers, "Show defined OOH323 peers", show_peers_usage };
-
-static char show_peer_usage[] =
-"Usage: ooh323 show peer <name> \n"
-" List details of specific OOH323 peer.\n";
-
-static struct ast_cli_entry cli_show_peer =
- { { "ooh323", "show", "peer", NULL }, ooh323_show_peer, "Show details on specific OOH323 peer", show_peer_usage };
-
-static struct ast_cli_entry cli_show_config =
- { { "ooh323", "show", "config", NULL }, ooh323_show_config, "Show details on global configuration of H.323 channel driver", show_config_usage };
-
-
-
+ if (gRasGkMode == RasNoGatekeeper)
+ snprintf(value, sizeof(value), "%s", "No Gatekeeper");
+ else if (gRasGkMode == RasDiscoverGatekeeper)
+ snprintf(value, sizeof(value), "%s", "Discover");
+ else
+ snprintf(value, sizeof(value), "%s", gGatekeeper);
+
+ ast_cli(a->fd, "%-20s%s\n", "Gatekeeper:", value);
+ ast_cli(a->fd, "%-20s%s\n", "H.323 LogFile:", gLogFile);
+ ast_cli(a->fd, "%-20s%s\n", "Context:", gContext);
+ ast_cli(a->fd, "%-20s%s\n", "Capability:", ast_getformatname_multiple(value, sizeof(value), gCapability));
+ ast_cli(a->fd, "%-20s", "DTMF Mode: ");
+ if (gDTMFMode & H323_DTMF_RFC2833)
+ ast_cli(a->fd, "%s\n", "rfc2833");
+ else if (gDTMFMode & H323_DTMF_Q931)
+ ast_cli(a->fd, "%s\n", "q931keypad");
+ else if(gDTMFMode & H323_DTMF_H245ALPHANUMERIC)
+ ast_cli(a->fd, "%s\n", "h245alphanumeric");
+ else if(gDTMFMode & H323_DTMF_H245SIGNAL)
+ ast_cli(a->fd, "%s\n", "h245signal");
+ else
+ ast_cli(a->fd, "%s\n", "unknown");
+ ast_cli(a->fd, "%-20s%s\n", "AccountCode: ", gAccountcode);
+ ast_cli(a->fd, "%-20s%s\n", "AMA flags: ", ast_cdr_flags2str(gAMAFLAGS));
+
+ pAlias = gAliasList;
+ if (pAlias)
+ ast_cli(a->fd, "%-20s\n", "Aliases: ");
+ while(pAlias) {
+ pAliasNext = pAlias->next;
+ if (pAliasNext) {
+ ast_cli(a->fd, "\t%-30s\t%-30s\n", pAlias->value, pAliasNext->value);
+ pAlias = pAliasNext->next;
+ } else {
+ ast_cli(a->fd, "\t%-30s\n", pAlias->value);
+ pAlias = pAlias->next;
+ }
+ }
+
+ return CLI_SUCCESS;
+}
+
+static struct ast_cli_entry cli_ooh323[] = {
+ AST_CLI_DEFINE(handle_cli_ooh323_set_debug, "Enable/Disable OOH323 debugging"),
+ AST_CLI_DEFINE(handle_cli_ooh323_show_config, "Show details on global configuration of H.323 channel driver"),
+ AST_CLI_DEFINE(handle_cli_ooh323_show_peer, "Show details on specific OOH323 peer"),
+ AST_CLI_DEFINE(handle_cli_ooh323_show_peers, "Show defined OOH323 peers"),
+ AST_CLI_DEFINE(handle_cli_ooh323_show_user, "Show details on specific OOH323 user"),
+ AST_CLI_DEFINE(handle_cli_ooh323_show_users, "Show defined OOH323 users"),
+};
static int load_module(void)
{
@@ -2448,13 +2445,7 @@
return 0;
}
ast_rtp_proto_register(&ooh323_rtp);
- ast_cli_register(&cli_show_users);
- ast_cli_register(&cli_show_user);
- ast_cli_register(&cli_show_peers);
- ast_cli_register(&cli_show_peer);
- ast_cli_register(&cli_show_config);
- ast_cli_register(&cli_debug);
- ast_cli_register(&cli_no_debug);
+ ast_cli_register_multiple(cli_ooh323, sizeof(cli_ooh323) / sizeof(struct ast_cli_entry));
/* fire up the H.323 Endpoint */
if(OO_OK != ooH323EpInitialize(OO_CALLMODE_AUDIOCALL, gLogFile))
@@ -2783,13 +2774,7 @@
ast_verbose("--- ooh323 unload_module \n");
}
/* First, take us out of the channel loop */
- ast_cli_unregister(&cli_show_users);
- ast_cli_unregister(&cli_show_user);
- ast_cli_unregister(&cli_show_peers);
- ast_cli_unregister(&cli_show_peer);
- ast_cli_unregister(&cli_show_config);
- ast_cli_unregister(&cli_debug);
- ast_cli_unregister(&cli_no_debug);
+ ast_cli_unregister_multiple(cli_ooh323, sizeof(cli_ooh323) / sizeof(struct ast_cli_entry));
ast_rtp_proto_unregister(&ooh323_rtp);
ast_channel_unregister(&ooh323_tech);
//ast_unregister_atexit(&ast_ooh323c_exit);
Modified: trunk/cdr_addon_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/cdr_addon_mysql.c?view=diff&rev=474&r1=473&r2=474
==============================================================================
--- trunk/cdr_addon_mysql.c (original)
+++ trunk/cdr_addon_mysql.c Mon Oct 22 15:11:45 2007
@@ -84,12 +84,22 @@
static MYSQL mysql;
-static char cdr_mysql_status_help[] =
-"Usage: cdr mysql status\n"
-" Shows current connection status for cdr_mysql\n";
-
-static int handle_cdr_mysql_status(int fd, int argc, char *argv[])
-{
+static char *handle_cli_cdr_mysql_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "cdr mysql status";
+ e->usage =
+ "Usage: cdr mysql status\n"
+ " Shows current connection status for cdr_mysql\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+
if (connected) {
char status[256], status2[100] = "";
int ctime = time(NULL) - connect_time;
@@ -105,31 +115,30 @@
if (!ast_strlen_zero(dbtable->str))
snprintf(status2, 99, " using table %s", dbtable->str);
if (ctime > 31536000) {
- ast_cli(fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 31536000, (ctime % 31536000) / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
+ ast_cli(a->fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 31536000, (ctime % 31536000) / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
} else if (ctime > 86400) {
- ast_cli(fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
+ ast_cli(a->fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
} else if (ctime > 3600) {
- ast_cli(fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 3600, (ctime % 3600) / 60, ctime % 60);
+ ast_cli(a->fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 3600, (ctime % 3600) / 60, ctime % 60);
} else if (ctime > 60) {
- ast_cli(fd, "%s%s for %d minutes, %d seconds.\n", status, status2, ctime / 60, ctime % 60);
+ ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, status2, ctime / 60, ctime % 60);
} else {
- ast_cli(fd, "%s%s for %d seconds.\n", status, status2, ctime);
+ ast_cli(a->fd, "%s%s for %d seconds.\n", status, status2, ctime);
}
if (records == totalrecords)
- ast_cli(fd, " Wrote %d records since last restart.\n", totalrecords);
+ ast_cli(a->fd, " Wrote %d records since last restart.\n", totalrecords);
else
- ast_cli(fd, " Wrote %d records since last restart and %d records since last reconnect.\n", totalrecords, records);
- return RESULT_SUCCESS;
+ ast_cli(a->fd, " Wrote %d records since last restart and %d records since last reconnect.\n", totalrecords, records);
} else {
- ast_cli(fd, "Not currently connected to a MySQL server.\n");
- return RESULT_FAILURE;
- }
-}
-
-static struct ast_cli_entry cdr_mysql_status_cli =
- { { "cdr", "mysql", "status", NULL },
- handle_cdr_mysql_status, "Show connection status of cdr_mysql",
- cdr_mysql_status_help, NULL };
+ ast_cli(a->fd, "Not currently connected to a MySQL server.\n");
+ }
+
+ return CLI_SUCCESS;
+}
+
+static struct ast_cli_entry cdr_mysql_status_cli[] = {
+ AST_CLI_DEFINE(handle_cli_cdr_mysql_status, "Show connection status of cdr_mysql"),
+};
static int mysql_log(struct ast_cdr *cdr)
{
@@ -260,7 +269,7 @@
{
struct unload_string *us;
- ast_cli_unregister(&cdr_mysql_status_cli);
+ ast_cli_unregister_multiple(cdr_mysql_status_cli, sizeof(cdr_mysql_status_cli) / sizeof(struct ast_cli_entry));
if (connected) {
mysql_close(&mysql);
@@ -445,7 +454,7 @@
if (res) {
ast_log(LOG_ERROR, "Unable to register MySQL CDR handling\n");
} else {
- res = ast_cli_register(&cdr_mysql_status_cli);
+ res = ast_cli_register_multiple(cdr_mysql_status_cli, sizeof(cdr_mysql_status_cli) / sizeof(struct ast_cli_entry));
}
return res;
Modified: trunk/chan_mobile.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/chan_mobile.c?view=diff&rev=474&r1=473&r2=474
==============================================================================
--- trunk/chan_mobile.c (original)
+++ trunk/chan_mobile.c Mon Oct 22 15:11:45 2007
@@ -174,26 +174,19 @@
static AST_LIST_HEAD_STATIC(devices, mbl_pvt);
/* CLI stuff */
-static const char show_usage[] =
-"Usage: mobile show devices\n"
-" Shows the state of Bluetooth Cell / Mobile devices.\n";
-
-static const char search_usage[] =
-"Usage: mobile search\n"
-" Searches for Bluetooth Cell / Mobile devices in range.\n";
-
-static const char rfcomm_usage[] =
-"Usage: mobile rfcomm command\n"
-" Send command to the rfcomm port.\n";
-
-static int do_show_devices(int, int, char **);
-static int do_search_devices(int, int, char **);
-static int do_send_rfcomm(int, int, char **);
+static char *handle_cli_mobile_show_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *handle_cli_mobile_search(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *handle_cli_mobile_rfcomm(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
static struct ast_cli_entry mbl_cli[] = {
+ AST_CLI_DEFINE(handle_cli_mobile_show_devices, "Show Bluetooth Cell / Mobile devices"),
+ AST_CLI_DEFINE(handle_cli_mobile_search, "Search for Bluetooth Cell / Mobile devices"),
+ AST_CLI_DEFINE(handle_cli_mobile_rfcomm, "Send commands to the rfcomm port for debugging"),
+/*
{{"mobile", "show", "devices", NULL}, do_show_devices, "Show Bluetooth Cell / Mobile devices", show_usage},
{{"mobile", "search", NULL}, do_search_devices, "Search for Bluetooth Cell / Mobile devices", search_usage},
{{"mobile", "rfcomm", NULL}, do_send_rfcomm, "Send commands to the rfcomm port for debugging", rfcomm_usage},
+*/
};
/* App stuff */
@@ -254,35 +247,46 @@
.devicestate = mbl_devicestate
};
-/*
-
- CLI Commands implementation
-
-*/
-
-static int do_show_devices(int fd, int argc, char **argv)
-{
-
+/* CLI Commands implementation */
+
+static char *handle_cli_mobile_show_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
struct mbl_pvt *pvt;
char bdaddr[18];
char group[6];
- #define FORMAT "%-15.15s %-17.17s %-5.5s %-15.15s %-9.9s %-5.5s %-3.3s\n"
-
- ast_cli(fd, FORMAT, "ID", "Address", "Group", "Adapter", "Connected", "State", "SMS");
+#define FORMAT1 "%-15.15s %-17.17s %-5.5s %-15.15s %-9.9s %-5.5s %-3.3s\n"
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "mobile show devices";
+ e->usage =
+ "Usage: mobile show devices\n"
+ " Shows the state of Bluetooth Cell / Mobile devices.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+
+ ast_cli(a->fd, FORMAT1, "ID", "Address", "Group", "Adapter", "Connected", "State", "SMS");
AST_LIST_TRAVERSE(&devices, pvt, entry) {
ba2str(&pvt->addr, bdaddr);
snprintf(group, 5, "%d", pvt->group);
- ast_cli(fd, FORMAT, pvt->id, bdaddr, group, pvt->adapter->id, pvt->connected?"Yes":"No", (pvt->state == MBL_STATE_IDLE)?"Free":(pvt->state < MBL_STATE_IDLE)?"Init":"Busy", (pvt->has_sms)?"Yes":"No");
- }
-
- return RESULT_SUCCESS;
-
-}
-
-static int do_search_devices(int fd, int argc, char **argv)
-{
-
+ ast_cli(a->fd, FORMAT1, pvt->id, bdaddr, group, pvt->adapter->id, pvt->connected ? "Yes" : "No",
+ (pvt->state == MBL_STATE_IDLE) ? "Free" : (pvt->state < MBL_STATE_IDLE) ? "Init" : "Busy",
+ (pvt->has_sms) ? "Yes" : "No");
+ }
+
+#undef FORMAT1
+
+ return CLI_SUCCESS;
+}
+
+static char *handle_cli_mobile_search(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
struct adapter_pvt *adapter;
inquiry_info *ii = NULL;
int max_rsp, num_rsp;
@@ -291,19 +295,34 @@
char addr[19] = {0};
char name[31] = {0};
- #define FORMAT2 "%-17.17s %-30.30s %-6.6s %-7.7s %-4.4s\n"
- #define FORMAT3 "%-17.17s %-30.30s %-6.6s %-7.7s %d\n"
+#define FORMAT1 "%-17.17s %-30.30s %-6.6s %-7.7s %-4.4s\n"
+#define FORMAT2 "%-17.17s %-30.30s %-6.6s %-7.7s %d\n"
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "mobile search";
+ e->usage =
+ "Usage: mobile search\n"
+ " Searches for Bluetooth Cell / Mobile devices in range.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 2)
+ return CLI_SHOWUSAGE;
/* find a free adapter */
AST_LIST_TRAVERSE(&adapters, adapter, entry) {
if (!adapter->inuse)
break;
}
+
if (!adapter) {
- ast_cli(fd, "All Bluetooth adapters are in use at this time.\n");
- return RESULT_SUCCESS;
- }
-
+ ast_cli(a->fd, "All Bluetooth adapters are in use at this time.\n");
+ return CLI_SUCCESS;
+ }
+
len = 8;
max_rsp = 255;
flags = IREQ_CACHE_FLUSH;
@@ -311,52 +330,63 @@
ii = alloca(max_rsp * sizeof(inquiry_info));
num_rsp = hci_inquiry(adapter->dev_id, len, max_rsp, NULL, &ii, flags);
if (num_rsp > 0) {
- ast_cli(fd, FORMAT2, "Address", "Name", "Usable", "Type", "Port");
+ ast_cli(a->fd, FORMAT1, "Address", "Name", "Usable", "Type", "Port");
for (i = 0; i < num_rsp; i++) {
- ba2str(&(ii+i)->bdaddr, addr);
+ ba2str(&(ii + i)->bdaddr, addr);
name[0] = 0x00;
- if (hci_read_remote_name(adapter->hci_socket, &(ii+i)->bdaddr, sizeof(name)-1, name, 0) < 0)
+ if (hci_read_remote_name(adapter->hci_socket, &(ii + i)->bdaddr, sizeof(name) - 1, name, 0) < 0)
strcpy(name, "[unknown]");
phport = sdp_search(addr, HANDSFREE_AGW_PROFILE_ID);
if (!phport)
hsport = sdp_search(addr, HEADSET_PROFILE_ID);
else
hsport = 0;
- ast_cli(fd, FORMAT3, addr, name, (phport > 0 || hsport > 0)?"Yes":"No", (phport > 0)?"Phone":"Headset", (phport > 0)?phport:hsport);
+ ast_cli(a->fd, FORMAT2, addr, name, (phport > 0 || hsport > 0) ? "Yes" : "No",
+ (phport > 0) ? "Phone" : "Headset", (phport > 0) ? phport : hsport);
}
} else
- ast_cli(fd, "No Bluetooth Cell / Mobile devices found.\n");
-
- return RESULT_SUCCESS;
-
-}
-
-static int do_send_rfcomm(int fd, int argc, char **argv)
-{
-
- struct mbl_pvt *pvt;
+ ast_cli(a->fd, "No Bluetooth Cell / Mobile devices found.\n");
+
+#undef FORMAT1
+#undef FORMAT2
+
+ return CLI_SUCCESS;
+}
+
+static char *handle_cli_mobile_rfcomm(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
char buf[128];
-
- if (argc != 4) {
- ast_cli(fd, "You must specify the name of the device and command.\n");
- return RESULT_SUCCESS;
- }
+ struct mbl_pvt *pvt = NULL;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "mobile rfcomm";
+ e->usage =
+ "Usage: mobile rfcomm <device ID> <command>\n"
+ " Send <command> to the rfcomm port on the device\n"
+ " with the specified <device ID>.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 4)
+ return CLI_SHOWUSAGE;
AST_LIST_TRAVERSE(&devices, pvt, entry) {
- if (!strcmp(pvt->id, argv[2]))
+ if (!strcmp(pvt->id, a->argv[2]))
break;
}
if (!pvt || !pvt->connected) {
- ast_cli(fd, "Device %s not found.\n", argv[2]);
- return RESULT_SUCCESS;
- }
-
- sprintf(buf, "%s\r", argv[3]);
+ ast_cli(a->fd, "Device %s not found.\n", a->argv[2]);
+ return CLI_SUCCESS;
+ }
+
+ snprintf(buf, sizeof(buf), "%s\r", a->argv[3]);
rfcomm_write(pvt, buf);
- return RESULT_SUCCESS;
-
+ return CLI_SUCCESS;
}
/*
Modified: trunk/res_config_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/res_config_mysql.c?view=diff&rev=474&r1=473&r2=474
==============================================================================
--- trunk/res_config_mysql.c (original)
+++ trunk/res_config_mysql.c Mon Oct 22 15:11:45 2007
@@ -77,17 +77,16 @@
static int parse_config(void);
static int mysql_reconnect(struct mysql_conn *conn);
-static int realtime_mysql_status(int fd, int argc, char **argv);
+static char *handle_cli_realtime_mysql_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
static int load_mysql_config(struct ast_config *config, const char *category, struct mysql_conn *conn);
-static char cli_realtime_mysql_status_usage[] =
-"Usage: realtime mysql status\n"
-" Shows connection information for the MySQL RealTime driver\n";
-
-static struct ast_cli_entry cli_realtime_mysql_status = {
+static struct ast_cli_entry cli_realtime_mysql_status[] = {
+ AST_CLI_DEFINE(handle_cli_realtime_mysql_status, "Shows connection information for the MySQL RealTime driver"),
+};
+/*
{ "realtime", "mysql", "status", NULL }, realtime_mysql_status,
"Shows connection information for the MySQL RealTime driver", cli_realtime_mysql_status_usage, NULL };
-
+*/
static struct ast_variable *realtime_mysql(const char *database, const char *table, va_list ap)
{
MYSQL_RES *result;
@@ -645,14 +644,14 @@
ast_config_engine_register(&mysql_engine);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "MySQL RealTime driver loaded.\n");
- ast_cli_register(&cli_realtime_mysql_status);
+ ast_cli_register_multiple(cli_realtime_mysql_status, sizeof(cli_realtime_mysql_status) / sizeof(struct ast_cli_entry));
return 0;
}
static int unload_module(void)
{
- ast_cli_unregister(&cli_realtime_mysql_status);
+ ast_cli_unregister_multiple(cli_realtime_mysql_status, sizeof(cli_realtime_mysql_status) / sizeof(struct ast_cli_entry));
ast_config_engine_deregister(&mysql_engine);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "MySQL RealTime unloaded.\n");
@@ -869,10 +868,26 @@
}
}
-static int realtime_mysql_status(int fd, int argc, char **argv)
+static char *handle_cli_realtime_mysql_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
char status[256], status2[100] = "";
- int ctime = time(NULL) - dbread.connect_time;
+ int ctime = 0;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "realtime mysql status";
+ e->usage =
+ "Usage: realtime mysql status\n"
+ " Shows connection information for the MySQL RealTime driver\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+
+ ctime = time(NULL) - dbread.connect_time;
if (mysql_reconnect(&dbread)) {
if (!ast_strlen_zero(dbread.host))
@@ -884,21 +899,21 @@
snprintf(status2, sizeof(status2), " with username %s", dbread.user);
if (ctime > 31536000)
- ast_cli(fd, "%s%s for %.1f years.\n", status, status2, (double)ctime / 31536000.0);
+ ast_cli(a->fd, "%s%s for %.1f years.\n", status, status2, (double)ctime / 31536000.0);
else if (ctime > 86400 * 30)
- ast_cli(fd, "%s%s for %d days.\n", status, status2, ctime / 86400);
+ ast_cli(a->fd, "%s%s for %d days.\n", status, status2, ctime / 86400);
else if (ctime > 86400)
- ast_cli(fd, "%s%s for %d days, %d hours.\n", status, status2, ctime / 86400, (ctime % 86400) / 3600);
+ ast_cli(a->fd, "%s%s for %d days, %d hours.\n", status, status2, ctime / 86400, (ctime % 86400) / 3600);
else if (ctime > 3600)
- ast_cli(fd, "%s%s for %d hours, %d minutes.\n", status, status2, ctime / 3600, (ctime % 3600) / 60);
+ ast_cli(a->fd, "%s%s for %d hours, %d minutes.\n", status, status2, ctime / 3600, (ctime % 3600) / 60);
else if (ctime > 60)
- ast_cli(fd, "%s%s for %d minutes.\n", status, status2, ctime / 60);
+ ast_cli(a->fd, "%s%s for %d minutes.\n", status, status2, ctime / 60);
else
- ast_cli(fd, "%s%s for %d seconds.\n", status, status2, ctime);
-
- return RESULT_SUCCESS;
+ ast_cli(a->fd, "%s%s for %d seconds.\n", status, status2, ctime);
+
+ return CLI_SUCCESS;
} else
- return RESULT_FAILURE;
+ return CLI_FAILURE;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "MySQL RealTime Configuration Driver",
More information about the asterisk-addons-commits
mailing list