Wed Oct 28 15:48:41 2009

Asterisk developer's documentation


cli.c File Reference

Standard Command Line Interface. More...

#include <unistd.h>
#include <stdlib.h>
#include <sys/signal.h>
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <ctype.h>
#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/cli.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/channel.h"
#include "asterisk/manager.h"
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "editline/readline/readline.h"
#include "asterisk/version.h"

Include dependency graph for cli.c:

Go to the source code of this file.

Defines

#define CONCISE_FORMAT_STRING   "%s:%s:%s:%d:%s:%s:%s:%s:%s:%d:%s:%s\n"
#define DAY   (HOUR*24)
#define DEBUGCHAN_FLAG   0x80000000
#define ESS(x)   ((x == 1) ? "" : "s")
#define FORMAT_STRING   "%-20.20s %-20.20s %-7.7s %-30.30s\n"
#define FORMAT_STRING2   "%-20.20s %-20.20s %-7.7s %-30.30s\n"
#define HOUR   (MINUTE*60)
#define MINUTE   (SECOND*60)
#define MODLIST_FORMAT   "%-30s %-40.40s %-10d\n"
#define MODLIST_FORMAT2   "%-30s %-40.40s %-10s\n"
#define SECOND   (1)
#define VERBOSE_FORMAT_STRING   "%-20.20s %-20.20s %-16.16s %4d %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-20.20s\n"
#define VERBOSE_FORMAT_STRING2   "%-20.20s %-20.20s %-16.16s %-4.4s %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-20.20s\n"
#define WEEK   (DAY*7)
#define YEAR   (DAY*365)

Functions

static char * __ast_cli_generator (char *text, char *word, int state, int lock)
void ast_cli (int fd, char *fmt,...)
int ast_cli_command (int fd, char *s)
 Interprets a command Interpret a command s, sending output to fd Returns 0 on succes, -1 on failure.
char ** ast_cli_completion_matches (char *text, char *word)
char * ast_cli_generator (char *text, char *word, int state)
 Readline madness Useful for readline, that's about it Returns 0 on success, -1 on failure.
int ast_cli_generatornummatches (char *text, char *word)
int ast_cli_register (struct ast_cli_entry *e)
 Registers a command or an array of commands.
void ast_cli_register_multiple (struct ast_cli_entry *e, int len)
 Register multiple commands.
int ast_cli_unregister (struct ast_cli_entry *e)
 Unregisters a command or an array of commands.
void ast_cli_unregister_multiple (struct ast_cli_entry *e, int len)
 Unregister multiple commands.
 AST_MUTEX_DEFINE_STATIC (climodentrylock)
 AST_MUTEX_DEFINE_STATIC (clilock)
static char * complete_ch_3 (char *line, char *word, int pos, int state)
static char * complete_ch_4 (char *line, char *word, int pos, int state)
static char * complete_ch_helper (char *line, char *word, int pos, int state, int rpos)
static char * complete_fn (char *line, char *word, int pos, int state)
static char * complete_mod_2 (char *line, char *word, int pos, int state)
static char * complete_mod_4 (char *line, char *word, int pos, int state)
static char * complete_show_channels (char *line, char *word, int pos, int state)
static char * find_best (char *argv[])
static struct ast_cli_entryfind_cli (char *cmds[], int exact)
static char * format_uptimestr (time_t timeval)
static int handle_chanlist (int fd, int argc, char *argv[])
static int handle_commandcomplete (int fd, int argc, char *argv[])
static int handle_commandmatchesarray (int fd, int argc, char *argv[])
static int handle_commandnummatches (int fd, int argc, char *argv[])
static int handle_debugchan (int fd, int argc, char *argv[])
static int handle_debuglevel (int fd, int argc, char *argv[])
static int handle_help (int fd, int argc, char *argv[])
static int handle_load (int fd, int argc, char *argv[])
static int handle_modlist (int fd, int argc, char *argv[])
static int handle_nodebugchan (int fd, int argc, char *argv[])
static int handle_reload (int fd, int argc, char *argv[])
static int handle_set_debug (int fd, int argc, char *argv[])
static int handle_set_verbose (int fd, int argc, char *argv[])
static int handle_showchan (int fd, int argc, char *argv[])
static int handle_showuptime (int fd, int argc, char *argv[])
static int handle_softhangup (int fd, int argc, char *argv[])
static int handle_unload (int fd, int argc, char *argv[])
static int handle_version (int fd, int argc, char *argv[])
static int help_workhorse (int fd, char *match[])
static void join (char *dest, size_t destsize, char *w[], int tws)
static void join2 (char *dest, size_t destsize, char *w[])
static int modlist_modentry (const char *module, const char *description, int usecnt, const char *like)
static char * parse_args (char *s, int *argc, char *argv[], int max, int *trailingwhitespace)

Variables

const char * ast_build_date
const char * ast_build_hostname
const char * ast_build_kernel
const char * ast_build_machine
const char * ast_build_os
const char * ast_build_user
static struct ast_cli_entry builtins []
static char chanlist_help []
static int climodentryfd = -1
static char commandcomplete_help []
static char commandmatchesarray_help []
static char commandnummatches_help []
static char debugchan_help []
static char debuglevel_help []
unsigned long global_fin
unsigned long global_fout
static char help_help []
struct ast_cli_entryhelpers = NULL
static char load_help []
static char modlist_help []
static char nodebugchan_help []
static char reload_help []
static char set_debug_help []
static char set_verbose_help []
static char showchan_help []
static char softhangup_help []
static char unload_help []
static char uptime_help []
static char version_help []


Detailed Description

Standard Command Line Interface.

Definition in file cli.c.


Define Documentation

#define CONCISE_FORMAT_STRING   "%s:%s:%s:%d:%s:%s:%s:%s:%s:%d:%s:%s\n"

Referenced by handle_chanlist().

#define DAY   (HOUR*24)

Referenced by format_uptimestr().

#define DEBUGCHAN_FLAG   0x80000000

Definition at line 659 of file cli.c.

Referenced by handle_debugchan(), and handle_nodebugchan().

#define ESS (  )     ((x == 1) ? "" : "s")

Referenced by format_uptimestr().

#define FORMAT_STRING   "%-20.20s %-20.20s %-7.7s %-30.30s\n"

#define FORMAT_STRING2   "%-20.20s %-20.20s %-7.7s %-30.30s\n"

Referenced by handle_chanlist().

#define HOUR   (MINUTE*60)

Referenced by format_uptimestr().

#define MINUTE   (SECOND*60)

Referenced by format_uptimestr().

#define MODLIST_FORMAT   "%-30s %-40.40s %-10d\n"

Definition at line 243 of file cli.c.

Referenced by modlist_modentry().

#define MODLIST_FORMAT2   "%-30s %-40.40s %-10s\n"

Definition at line 244 of file cli.c.

Referenced by handle_modlist().

#define SECOND   (1)

#define VERBOSE_FORMAT_STRING   "%-20.20s %-20.20s %-16.16s %4d %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-20.20s\n"

Referenced by handle_chanlist().

#define VERBOSE_FORMAT_STRING2   "%-20.20s %-20.20s %-16.16s %-4.4s %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-20.20s\n"

Referenced by handle_chanlist().

#define WEEK   (DAY*7)

Referenced by format_uptimestr().

#define YEAR   (DAY*365)

Referenced by format_uptimestr().


Function Documentation

static char * __ast_cli_generator ( char *  text,
char *  word,
int  state,
int  lock 
) [static]

Definition at line 1266 of file cli.c.

References AST_MAX_ARGS, ast_mutex_lock(), ast_mutex_unlock(), ast_strlen_zero(), ast_cli_entry::cmda, free, ast_cli_entry::generator, join(), ast_cli_entry::next, parse_args(), and strdup.

Referenced by ast_cli_generator(), and handle_commandcomplete().

01267 {
01268    char *argv[AST_MAX_ARGS];
01269    struct ast_cli_entry *e, *e1, *e2;
01270    int x;
01271    int matchnum=0;
01272    char *dup, *res;
01273    char fullcmd1[80] = "";
01274    char fullcmd2[80] = "";
01275    char matchstr[80] = "";
01276    char *fullcmd = NULL;
01277    int tws;
01278 
01279    if ((dup = parse_args(text, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws))) {
01280       join(matchstr, sizeof(matchstr), argv, tws);
01281       if (lock)
01282          ast_mutex_lock(&clilock);
01283       e1 = builtins;
01284       e2 = helpers;
01285       while(e1->cmda[0] || e2) {
01286          if (e2)
01287             join(fullcmd2, sizeof(fullcmd2), e2->cmda, tws);
01288          if (e1->cmda[0])
01289             join(fullcmd1, sizeof(fullcmd1), e1->cmda, tws);
01290          if (!e1->cmda[0] || 
01291                (e2 && (strcmp(fullcmd2, fullcmd1) < 0))) {
01292             /* Use e2 */
01293             e = e2;
01294             fullcmd = fullcmd2;
01295             /* Increment by going to next */
01296             e2 = e2->next;
01297          } else {
01298             /* Use e1 */
01299             e = e1;
01300             fullcmd = fullcmd1;
01301             e1++;
01302          }
01303          if ((fullcmd[0] != '_') && !strncasecmp(matchstr, fullcmd, strlen(matchstr))) {
01304             /* We contain the first part of one or more commands */
01305             /* Now, what we're supposed to return is the next word... */
01306             if (!ast_strlen_zero(word) && x>0) {
01307                res = e->cmda[x-1];
01308             } else {
01309                res = e->cmda[x];
01310             }
01311             if (res) {
01312                matchnum++;
01313                if (matchnum > state) {
01314                   if (lock)
01315                      ast_mutex_unlock(&clilock);
01316                   free(dup);
01317                   return strdup(res);
01318                }
01319             }
01320          }
01321          if (e->generator && !strncasecmp(matchstr, fullcmd, strlen(fullcmd)) &&
01322             (matchstr[strlen(fullcmd)] < 33)) {
01323             /* We have a command in its entirity within us -- theoretically only one
01324                command can have this occur */
01325             fullcmd = e->generator(matchstr, word, (!ast_strlen_zero(word) ? (x - 1) : (x)), state);
01326             if (fullcmd) {
01327                if (lock)
01328                   ast_mutex_unlock(&clilock);
01329                free(dup);
01330                return fullcmd;
01331             }
01332          }
01333          
01334       }
01335       if (lock)
01336          ast_mutex_unlock(&clilock);
01337       free(dup);
01338    }
01339    return NULL;
01340 }

void ast_cli ( int  fd,
char *  fmt,
  ... 
)

Definition at line 60 of file cli.c.

References ast_carefulwrite(), ast_log(), free, LOG_ERROR, and vasprintf.

Referenced by __iax2_show_peers(), __queues_show(), __sip_show_channels(), _sip_show_peer(), _sip_show_peers(), action_agents(), action_command(), action_extensionstate(), action_getvar(), action_listcommands(), action_mailboxcount(), action_mailboxstatus(), action_status(), action_zapshowchannels(), agent_logoff_cmd(), agents_show(), agi_do_debug(), agi_no_debug(), ast_cli_command(), ast_cli_netstats(), astman_send_error(), astman_send_response(), cli_files_show(), cli_load_realtime(), cli_update_realtime(), conf_cmd(), config_command(), confs_show(), console_active(), console_answer(), console_autoanswer(), console_dial(), console_flash(), console_hangup(), console_sendtext(), console_transfer(), database_del(), database_deltree(), database_get(), database_put(), database_show(), database_showkey(), dundi_do_debug(), dundi_do_lookup(), dundi_do_precache(), dundi_do_query(), dundi_do_store_history(), dundi_flush(), dundi_no_debug(), dundi_no_store_history(), dundi_show_entityid(), dundi_show_mappings(), dundi_show_peer(), dundi_show_peers(), dundi_show_precache(), dundi_show_requests(), dundi_show_trans(), features_show(), group_show_channels(), h323_do_debug(), h323_do_trace(), h323_no_debug(), h323_no_trace(), handle_add_queue_member(), handle_chanlist(), handle_cli_status(), handle_cli_submit(), handle_commandcomplete(), handle_commandmatchesarray(), handle_commandnummatches(), handle_context_add_extension(), handle_context_add_ignorepat(), handle_context_add_include(), handle_context_dont_include(), handle_context_remove_extension(), handle_context_remove_ignorepat(), handle_debugchan(), handle_debuglevel(), handle_dumpagihtml(), handle_help(), handle_load(), handle_logger_reload(), handle_logger_rotate(), handle_logger_show_channels(), handle_modlist(), handle_nodebugchan(), handle_parkedcalls(), handle_reload(), handle_remove_queue_member(), handle_save_dialplan(), handle_set_debug(), handle_set_verbose(), handle_show_application(), handle_show_applications(), handle_show_dialplan(), handle_show_function(), handle_show_functions(), handle_show_hints(), handle_show_indications(), handle_show_switches(), handle_show_version_files(), handle_show_voicemail_users(), handle_show_voicemail_zones(), handle_showagi(), handle_showchan(), handle_showfeatures(), handle_showmancmd(), handle_showmancmds(), handle_showmanconn(), handle_showuptime(), handle_softhangup(), handle_unload(), handle_version(), handle_zap_show_cadences(), help_workhorse(), iax2_do_debug(), iax2_do_jb_debug(), iax2_do_trunk_debug(), iax2_no_debug(), iax2_no_jb_debug(), iax2_no_trunk_debug(), iax2_prov_cmd(), iax2_prune_realtime(), iax2_set_jitter(), iax2_show_cache(), iax2_show_callnumber_usage(), iax2_show_channels(), iax2_show_firmware(), iax2_show_netstats(), iax2_show_peer(), iax2_show_registry(), iax2_show_stats(), iax2_show_users(), iax_show_provisioning(), locals_show(), manager_dbget(), manager_iax2_show_netstats(), manager_iax2_show_peers(), manager_parking_status(), manager_queues_show(), manager_queues_status(), manager_sip_show_peer(), manager_sip_show_peers(), mgcp_audit_endpoint(), mgcp_do_debug(), mgcp_no_debug(), mgcp_show_endpoints(), misdn_reload(), misdn_send_cd(), misdn_send_digit(), misdn_send_display(), misdn_set_debug(), misdn_show_cls(), misdn_show_config(), misdn_show_port(), misdn_show_stacks(), misdn_toggle_echocancel(), mixmonitor_cli(), modlist_modentry(), moh_classes_show(), moh_cli(), odbc_connect_usage(), odbc_disconnect_usage(), odbc_dump_fd(), print_bc_info(), print_codec_to_cli(), print_group(), process_message(), rpt_do_debug(), rtp_do_debug(), rtp_do_debug_ip(), rtp_no_debug(), session_do(), show_channeltypes(), show_codec_n(), show_codecs(), show_dialplan_helper(), show_file_formats(), show_image_formats(), show_keys(), show_license(), show_osp(), show_transcoder(), show_translation(), show_warranty(), sip_do_debug(), sip_do_debug_ip(), sip_do_debug_peer(), sip_do_history(), sip_no_debug(), sip_no_history(), sip_notify(), sip_prune_realtime(), sip_show_channel(), sip_show_domains(), sip_show_history(), sip_show_inuse(), sip_show_objects(), sip_show_registry(), sip_show_settings(), sip_show_user(), sip_show_users(), skinny_do_debug(), skinny_no_debug(), skinny_show_devices(), skinny_show_lines(), zap_show_channel(), zap_show_channels(), and zap_show_status().

00061 {
00062    char *stuff;
00063    int res = 0;
00064    va_list ap;
00065 
00066    va_start(ap, fmt);
00067    res = vasprintf(&stuff, fmt, ap);
00068    va_end(ap);
00069    if (res == -1) {
00070       ast_log(LOG_ERROR, "Out of memory\n");
00071    } else {
00072       ast_carefulwrite(fd, stuff, strlen(stuff), 100);
00073       free(stuff);
00074    }
00075 }

int ast_cli_command ( int  fd,
char *  s 
)

Interprets a command Interpret a command s, sending output to fd Returns 0 on succes, -1 on failure.

Definition at line 1347 of file cli.c.

References ast_cli(), ast_log(), AST_MAX_ARGS, ast_mutex_lock(), ast_mutex_unlock(), find_best(), find_cli(), free, ast_cli_entry::handler, ast_cli_entry::inuse, LOG_WARNING, parse_args(), RESULT_SHOWUSAGE, and ast_cli_entry::usage.

Referenced by action_command(), cli_activate(), consolehandler(), exit_completely(), and netconsole().

01348 {
01349    char *argv[AST_MAX_ARGS];
01350    struct ast_cli_entry *e;
01351    int x;
01352    char *dup;
01353    int tws;
01354 
01355    if ((dup = parse_args(s, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws))) {
01356       /* We need at least one entry, or ignore */
01357       if (x > 0) {
01358          ast_mutex_lock(&clilock);
01359          e = find_cli(argv, 0);
01360          if (e)
01361             e->inuse++;
01362          ast_mutex_unlock(&clilock);
01363          if (e) {
01364             switch(e->handler(fd, x, argv)) {
01365             case RESULT_SHOWUSAGE:
01366                if (e->usage)
01367                   ast_cli(fd, "%s", e->usage);
01368                else
01369                   ast_cli(fd, "%s", "Invalid usage, but no usage information available.\n");
01370                break;
01371             }
01372          } else 
01373             ast_cli(fd, "No such command '%s' (type 'help' for help)\n", find_best(argv));
01374          if (e) {
01375             ast_mutex_lock(&clilock);
01376             e->inuse--;
01377             ast_mutex_unlock(&clilock);
01378          }
01379       }
01380       free(dup);
01381    } else {
01382       ast_log(LOG_WARNING, "Out of memory\n");  
01383       return -1;
01384    }
01385    return 0;
01386 }

char** ast_cli_completion_matches ( char *  text,
char *  word 
)

Definition at line 1227 of file cli.c.

References ast_cli_generator(), malloc, and realloc.

Referenced by cli_complete(), and handle_commandmatchesarray().

01228 {
01229    char **match_list = NULL, *retstr, *prevstr;
01230    size_t match_list_len, max_equal, which, i;
01231    int matches = 0;
01232 
01233    match_list_len = 1;
01234    while ((retstr = ast_cli_generator(text, word, matches)) != NULL) {
01235       if (matches + 1 >= match_list_len) {
01236          match_list_len <<= 1;
01237          match_list = realloc(match_list, match_list_len * sizeof(char *));
01238       }
01239       match_list[++matches] = retstr;
01240    }
01241 
01242    if (!match_list)
01243       return (char **) NULL;
01244 
01245    which = 2;
01246    prevstr = match_list[1];
01247    max_equal = strlen(prevstr);
01248    for (; which <= matches; which++) {
01249       for (i = 0; i < max_equal && toupper(prevstr[i]) == toupper(match_list[which][i]); i++)
01250          continue;
01251       max_equal = i;
01252    }
01253 
01254    retstr = malloc(max_equal + 1);
01255    (void) strncpy(retstr, match_list[1], max_equal);
01256    retstr[max_equal] = '\0';
01257    match_list[0] = retstr;
01258 
01259    if (matches + 1 >= match_list_len)
01260       match_list = realloc(match_list, (match_list_len + 1) * sizeof(char *));
01261    match_list[matches + 1] = (char *) NULL;
01262 
01263    return (match_list);
01264 }

char* ast_cli_generator ( char *  text,
char *  word,
int  state 
)

Readline madness Useful for readline, that's about it Returns 0 on success, -1 on failure.

Definition at line 1342 of file cli.c.

References __ast_cli_generator().

Referenced by ast_cli_completion_matches(), and ast_cli_generatornummatches().

01343 {
01344    return __ast_cli_generator(text, word, state, 1);
01345 }

int ast_cli_generatornummatches ( char *  text,
char *  word 
)

Definition at line 1210 of file cli.c.

References ast_cli_generator(), and free.

Referenced by cli_complete(), and handle_commandnummatches().

01211 {
01212    int matches = 0, i = 0;
01213    char *buf = NULL, *oldbuf = NULL;
01214 
01215    while ( (buf = ast_cli_generator(text, word, i++)) ) {
01216       if (!oldbuf || strcmp(buf,oldbuf))
01217          matches++;
01218       if (oldbuf)
01219          free(oldbuf);
01220       oldbuf = buf;
01221    }
01222    if (oldbuf)
01223       free(oldbuf);
01224    return matches;
01225 }

int ast_cli_register ( struct ast_cli_entry e  ) 

Registers a command or an array of commands.

Parameters:
e which cli entry to register Register your own command Returns 0 on success, -1 on failure

Definition at line 1018 of file cli.c.

References ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_cli_entry::cmda, find_cli(), join2(), LOG_WARNING, and ast_cli_entry::next.

Referenced by ast_cdr_engine_init(), ast_channels_init(), ast_cli_register_multiple(), ast_file_init(), ast_image_init(), ast_register_translator(), ast_rtp_init(), astdb_init(), crypto_init(), dnsmgr_init(), do_reload(), iax_provision_init(), init_logger(), init_manager(), load_module(), register_config_cli(), and unload_module().

01019 {
01020    struct ast_cli_entry *cur, *l=NULL;
01021    char fulle[80] ="", fulltst[80] ="";
01022    static int len;
01023    ast_mutex_lock(&clilock);
01024    join2(fulle, sizeof(fulle), e->cmda);
01025    if (find_cli(e->cmda, -1)) {
01026       ast_mutex_unlock(&clilock);
01027       ast_log(LOG_WARNING, "Command '%s' already registered (or something close enough)\n", fulle);
01028       return -1;
01029    }
01030    cur = helpers;
01031    while(cur) {
01032       join2(fulltst, sizeof(fulltst), cur->cmda);
01033       len = strlen(fulltst);
01034       if (strlen(fulle) < len)
01035          len = strlen(fulle);
01036       if (strncasecmp(fulle, fulltst, len) < 0) {
01037          if (l) {
01038             e->next = l->next;
01039             l->next = e;
01040          } else {
01041             e->next = helpers;
01042             helpers = e;
01043          }
01044          break;
01045       }
01046       l = cur;
01047       cur = cur->next;
01048    }
01049    if (!cur) {
01050       if (l)
01051          l->next = e;
01052       else
01053          helpers = e;
01054       e->next = NULL;
01055    }
01056    ast_mutex_unlock(&clilock);
01057    return 0;
01058 }

void ast_cli_register_multiple ( struct ast_cli_entry e,
int  len 
)

Register multiple commands.

Parameters:
e pointer to first cli entry to register
len number of entries to register

Definition at line 1063 of file cli.c.

References ast_cli_register().

Referenced by astobj2_init(), init_framer(), load_module(), load_pbx(), and main().

01064 {
01065    int i;
01066 
01067    for (i=0; i < len; i++)
01068       ast_cli_register(e + i);
01069 }

int ast_cli_unregister ( struct ast_cli_entry e  ) 

Unregisters a command or an array of commands.

Parameters:
e which cli entry to unregister Unregister your own command. You must pass a completed ast_cli_entry structure Returns 0.

Definition at line 992 of file cli.c.

References ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_cli_entry::inuse, LOG_WARNING, and ast_cli_entry::next.

Referenced by ast_cli_unregister_multiple(), do_reload(), iax_provision_unload(), and unload_module().

00993 {
00994    struct ast_cli_entry *cur, *l=NULL;
00995    ast_mutex_lock(&clilock);
00996    cur = helpers;
00997    while(cur) {
00998       if (e == cur) {
00999          if (e->inuse) {
01000             ast_log(LOG_WARNING, "Can't remove command that is in use\n");
01001          } else {
01002             /* Rewrite */
01003             if (l)
01004                l->next = e->next;
01005             else
01006                helpers = e->next;
01007             e->next = NULL;
01008             break;
01009          }
01010       }
01011       l = cur;
01012       cur = cur->next;
01013    }
01014    ast_mutex_unlock(&clilock);
01015    return 0;
01016 }

void ast_cli_unregister_multiple ( struct ast_cli_entry e,
int  len 
)

Unregister multiple commands.

Parameters:
e pointer to first cli entry to unregister
len number of entries to unregister

Definition at line 1071 of file cli.c.

References ast_cli_unregister().

Referenced by __unload_module(), and unload_module().

01072 {
01073    int i;
01074 
01075    for (i=0; i < len; i++)
01076       ast_cli_unregister(e + i);
01077 }

AST_MUTEX_DEFINE_STATIC ( climodentrylock   ) 

AST_MUTEX_DEFINE_STATIC ( clilock   ) 

static char* complete_ch_3 ( char *  line,
char *  word,
int  pos,
int  state 
) [static]

Definition at line 837 of file cli.c.

References complete_ch_helper().

00838 {
00839    return complete_ch_helper(line, word, pos, state, 2);
00840 }

static char* complete_ch_4 ( char *  line,
char *  word,
int  pos,
int  state 
) [static]

Definition at line 842 of file cli.c.

References complete_ch_helper().

00843 {
00844    return complete_ch_helper(line, word, pos, state, 3);
00845 }

static char* complete_ch_helper ( char *  line,
char *  word,
int  pos,
int  state,
int  rpos 
) [static]

Definition at line 816 of file cli.c.

References ast_channel_walk_locked(), ast_mutex_unlock(), ast_channel::lock, ast_channel::name, and strdup.

Referenced by complete_ch(), complete_ch_3(), and complete_ch_4().

00817 {
00818    struct ast_channel *c = NULL;
00819    int which=0;
00820    char *ret = NULL;
00821 
00822    if (pos != rpos)
00823       return NULL;
00824    while ( (c = ast_channel_walk_locked(c)) != NULL) {
00825       if (!strncasecmp(word, c->name, strlen(word))) {
00826          if (++which > state) {
00827             ret = strdup(c->name);
00828             ast_mutex_unlock(&c->lock);
00829             break;
00830          }
00831       }
00832       ast_mutex_unlock(&c->lock);
00833    }
00834    return ret;
00835 }

static char* complete_fn ( char *  line,
char *  word,
int  pos,
int  state 
) [static]

Definition at line 857 of file cli.c.

References ast_config_AST_MODULE_DIR, and strdup.

00858 {
00859    char *c;
00860    char filename[256];
00861    if (pos != 1)
00862       return NULL;
00863    if (word[0] == '/')
00864       ast_copy_string(filename, word, sizeof(filename));
00865    else
00866       snprintf(filename, sizeof(filename), "%s/%s", (char *)ast_config_AST_MODULE_DIR, word);
00867    c = (char*)filename_completion_function(filename, state);
00868    if (c && word[0] != '/')
00869       c += (strlen((char*)ast_config_AST_MODULE_DIR) + 1);
00870    return c ? strdup(c) : c;
00871 }

static char* complete_mod_2 ( char *  line,
char *  word,
int  pos,
int  state 
) [static]

Definition at line 847 of file cli.c.

References ast_module_helper().

00848 {
00849    return ast_module_helper(line, word, pos, state, 1, 1);
00850 }

static char* complete_mod_4 ( char *  line,
char *  word,
int  pos,
int  state 
) [static]

Definition at line 852 of file cli.c.

References ast_module_helper().

00853 {
00854    return ast_module_helper(line, word, pos, state, 3, 0);
00855 }

static char* complete_show_channels ( char *  line,
char *  word,
int  pos,
int  state 
) [static]

Definition at line 800 of file cli.c.

References match(), and strdup.

00801 {
00802    static char *choices[] = { "concise", "verbose" };
00803    int match = 0;
00804    int x;
00805    if (pos != 2) 
00806       return NULL;
00807    for (x=0;x<sizeof(choices) / sizeof(choices[0]);x++) {
00808       if (!strncasecmp(word, choices[x], strlen(word))) {
00809          match++;
00810          if (match > state) return strdup(choices[x]);
00811       }
00812    }
00813    return NULL;
00814 }

static char* find_best ( char *  argv[]  )  [static]

Definition at line 975 of file cli.c.

References AST_MAX_CMD_LEN, find_cli(), and join().

Referenced by ast_cli_command().

00976 {
00977    static char cmdline[80];
00978    int x;
00979    /* See how close we get, then print the  */
00980    char *myargv[AST_MAX_CMD_LEN];
00981    for (x=0;x<AST_MAX_CMD_LEN;x++)
00982       myargv[x]=NULL;
00983    for (x=0;argv[x];x++) {
00984       myargv[x] = argv[x];
00985       if (!find_cli(myargv, -1))
00986          break;
00987    }
00988    join(cmdline, sizeof(cmdline), myargv, 0);
00989    return cmdline;
00990 }

static struct ast_cli_entry* find_cli ( char *  cmds[],
int  exact 
) [static, read]

Definition at line 899 of file cli.c.

References ast_cli_entry::cmda, match(), and ast_cli_entry::next.

Referenced by ast_cli_command(), ast_cli_register(), find_best(), and handle_help().

00900 {
00901    int x;
00902    int y;
00903    int match;
00904    struct ast_cli_entry *e=NULL;
00905 
00906    for (e=helpers;e;e=e->next) {
00907       match = 1;
00908       for (y=0;match && cmds[y]; y++) {
00909          if (!e->cmda[y] && !exact)
00910             break;
00911          if (!e->cmda[y] || strcasecmp(e->cmda[y], cmds[y]))
00912             match = 0;
00913       }
00914       if ((exact > -1) && e->cmda[y])
00915          match = 0;
00916       if (match)
00917          break;
00918    }
00919    if (e)
00920       return e;
00921    for (x=0;builtins[x].cmda[0];x++) {
00922       /* start optimistic */
00923       match = 1;
00924       for (y=0;match && cmds[y]; y++) {
00925          /* If there are no more words in the candidate command, then we're
00926             there.  */
00927          if (!builtins[x].cmda[y] && !exact)
00928             break;
00929          /* If there are no more words in the command (and we're looking for
00930             an exact match) or there is a difference between the two words,
00931             then this is not a match */
00932          if (!builtins[x].cmda[y] || strcasecmp(builtins[x].cmda[y], cmds[y]))
00933             match = 0;
00934       }
00935       /* If more words are needed to complete the command then this is not
00936          a candidate (unless we're looking for a really inexact answer  */
00937       if ((exact > -1) && builtins[x].cmda[y])
00938          match = 0;
00939       if (match)
00940          return &builtins[x];
00941    }
00942    return NULL;
00943 }

static char* format_uptimestr ( time_t  timeval  )  [static]

Definition at line 272 of file cli.c.

References DAY, days, ESS, HOUR, MINUTE, offset, strdup, WEEK, and YEAR.

Referenced by handle_showuptime().

00273 {
00274    int years = 0, weeks = 0, days = 0, hours = 0, mins = 0, secs = 0;
00275    char timestr[256]="";
00276    int bytes = 0;
00277    int maxbytes = 0;
00278    int offset = 0;
00279 #define SECOND (1)
00280 #define MINUTE (SECOND*60)
00281 #define HOUR (MINUTE*60)
00282 #define DAY (HOUR*24)
00283 #define WEEK (DAY*7)
00284 #define YEAR (DAY*365)
00285 #define ESS(x) ((x == 1) ? "" : "s")
00286 
00287    maxbytes = sizeof(timestr);
00288    if (timeval < 0)
00289       return NULL;
00290    if (timeval > YEAR) {
00291       years = (timeval / YEAR);
00292       timeval -= (years * YEAR);
00293       if (years > 0) {
00294          snprintf(timestr + offset, maxbytes, "%d year%s, ", years, ESS(years));
00295          bytes = strlen(timestr + offset);
00296          offset += bytes;
00297          maxbytes -= bytes;
00298       }
00299    }
00300    if (timeval > WEEK) {
00301       weeks = (timeval / WEEK);
00302       timeval -= (weeks * WEEK);
00303       if (weeks > 0) {
00304          snprintf(timestr + offset, maxbytes, "%d week%s, ", weeks, ESS(weeks));
00305          bytes = strlen(timestr + offset);
00306          offset += bytes;
00307          maxbytes -= bytes;
00308       }
00309    }
00310    if (timeval > DAY) {
00311       days = (timeval / DAY);
00312       timeval -= (days * DAY);
00313       if (days > 0) {
00314          snprintf(timestr + offset, maxbytes, "%d day%s, ", days, ESS(days));
00315          bytes = strlen(timestr + offset);
00316          offset += bytes;
00317          maxbytes -= bytes;
00318       }
00319    }
00320    if (timeval > HOUR) {
00321       hours = (timeval / HOUR);
00322       timeval -= (hours * HOUR);
00323       if (hours > 0) {
00324          snprintf(timestr + offset, maxbytes, "%d hour%s, ", hours, ESS(hours));
00325          bytes = strlen(timestr + offset);
00326          offset += bytes;
00327          maxbytes -= bytes;
00328       }
00329    }
00330    if (timeval > MINUTE) {
00331       mins = (timeval / MINUTE);
00332       timeval -= (mins * MINUTE);
00333       if (mins > 0) {
00334          snprintf(timestr + offset, maxbytes, "%d minute%s, ", mins, ESS(mins));
00335          bytes = strlen(timestr + offset);
00336          offset += bytes;
00337          maxbytes -= bytes;
00338       }
00339    }
00340    secs = timeval;
00341 
00342    if (secs > 0) {
00343       snprintf(timestr + offset, maxbytes, "%d second%s", secs, ESS(secs));
00344    }
00345 
00346    return timestr ? strdup(timestr) : NULL;
00347 }

static int handle_chanlist ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 419 of file cli.c.

References ast_channel::_state, ast_channel::accountcode, ast_channel::amaflags, ast_channel::appl, ast_active_calls(), ast_bridged_channel(), ast_channel_walk_locked(), ast_cli(), ast_mutex_unlock(), ast_state2str(), ast_strlen_zero(), ast_channel::cdr, ast_channel::cid, ast_callerid::cid_num, CONCISE_FORMAT_STRING, ast_channel::context, ast_channel::data, ast_channel::exten, FORMAT_STRING, FORMAT_STRING2, ast_channel::lock, ast_channel::name, option_maxcalls, ast_channel::priority, RESULT_SHOWUSAGE, RESULT_SUCCESS, ast_cdr::start, VERBOSE_FORMAT_STRING, and VERBOSE_FORMAT_STRING2.

00420 {
00421 #define FORMAT_STRING  "%-20.20s %-20.20s %-7.7s %-30.30s\n"
00422 #define FORMAT_STRING2 "%-20.20s %-20.20s %-7.7s %-30.30s\n"
00423 #define CONCISE_FORMAT_STRING  "%s:%s:%s:%d:%s:%s:%s:%s:%s:%d:%s:%s\n"
00424 #define VERBOSE_FORMAT_STRING  "%-20.20s %-20.20s %-16.16s %4d %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-20.20s\n"
00425 #define VERBOSE_FORMAT_STRING2 "%-20.20s %-20.20s %-16.16s %-4.4s %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-20.20s\n"
00426 
00427    struct ast_channel *c = NULL, *bc = NULL;
00428    char durbuf[10] = "-";
00429    char locbuf[40];
00430    char appdata[40];
00431    int duration;
00432    int durh, durm, durs;
00433    int numchans = 0, concise = 0, verbose = 0;
00434 
00435    concise = (argc == 3 && (!strcasecmp(argv[2],"concise")));
00436    verbose = (argc == 3 && (!strcasecmp(argv[2],"verbose")));
00437 
00438    if (argc < 2 || argc > 3 || (argc == 3 && !concise && !verbose))
00439       return RESULT_SHOWUSAGE;
00440 
00441    if (!concise && !verbose)
00442       ast_cli(fd, FORMAT_STRING2, "Channel", "Location", "State", "Application(Data)");
00443    else if (verbose)
00444       ast_cli(fd, VERBOSE_FORMAT_STRING2, "Channel", "Context", "Extension", "Priority", "State", "Application", "Data", 
00445               "CallerID", "Duration", "Accountcode", "BridgedTo");
00446    while ((c = ast_channel_walk_locked(c)) != NULL) {
00447       bc = ast_bridged_channel(c);
00448       if ((concise || verbose)  && c->cdr && !ast_tvzero(c->cdr->start)) {
00449          duration = (int)(ast_tvdiff_ms(ast_tvnow(), c->cdr->start) / 1000);
00450          if (verbose) {
00451             durh = duration / 3600;
00452             durm = (duration % 3600) / 60;
00453             durs = duration % 60;
00454             snprintf(durbuf, sizeof(durbuf), "%02d:%02d:%02d", durh, durm, durs);
00455          } else {
00456             snprintf(durbuf, sizeof(durbuf), "%d", duration);
00457          }           
00458       } else {
00459          durbuf[0] = '\0';
00460       }
00461       if (concise) {
00462          ast_cli(fd, CONCISE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
00463                  c->appl ? c->appl : "(None)", c->data ? ( !ast_strlen_zero(c->data) ? c->data : "" ): "",
00464                  (c->cid.cid_num && !ast_strlen_zero(c->cid.cid_num)) ? c->cid.cid_num : "",
00465                  (c->accountcode && !ast_strlen_zero(c->accountcode)) ? c->accountcode : "", c->amaflags, 
00466                  durbuf, bc ? bc->name : "(None)");
00467       } else if (verbose) {
00468          ast_cli(fd, VERBOSE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
00469                  c->appl ? c->appl : "(None)", c->data ? ( !ast_strlen_zero(c->data) ? c->data : "(Empty)" ): "(None)",
00470                  (c->cid.cid_num && !ast_strlen_zero(c->cid.cid_num)) ? c->cid.cid_num : "", durbuf,
00471                  (c->accountcode && !ast_strlen_zero(c->accountcode)) ? c->accountcode : "", bc ? bc->name : "(None)");
00472       } else {
00473          if (!ast_strlen_zero(c->context) && !ast_strlen_zero(c->exten)) 
00474             snprintf(locbuf, sizeof(locbuf), "%s@%s:%d", c->exten, c->context, c->priority);
00475          else
00476             strcpy(locbuf, "(None)");
00477          if (c->appl) {
00478             snprintf(appdata, sizeof(appdata), "%s(%s)", c->appl, c->data ? c->data : "");
00479          } else {
00480             strcpy(appdata, "(None)");
00481          }
00482          ast_cli(fd, FORMAT_STRING, c->name, locbuf, ast_state2str(c->_state), appdata);
00483       }
00484       numchans++;
00485       ast_mutex_unlock(&c->lock);
00486    }
00487    if (!concise) {
00488       ast_cli(fd, "%d active channel%s\n", numchans, (numchans!=1) ? "s" : "");
00489       if (option_maxcalls)
00490          ast_cli(fd, "%d of %d max active call%s (%5.2f%% of capacity)\n", ast_active_calls(), option_maxcalls, (ast_active_calls()!=1) ? "s" : "", ((float)ast_active_calls() / (float)option_maxcalls) * 100.0);
00491       else
00492          ast_cli(fd, "%d active call%s\n", ast_active_calls(), (ast_active_calls()!=1) ? "s" : "");
00493    }
00494    return RESULT_SUCCESS;
00495    
00496 #undef FORMAT_STRING
00497 #undef FORMAT_STRING2
00498 #undef CONCISE_FORMAT_STRING
00499 #undef VERBOSE_FORMAT_STRING
00500 #undef VERBOSE_FORMAT_STRING2
00501 }

static int handle_commandcomplete ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 620 of file cli.c.

References __ast_cli_generator(), ast_cli(), free, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00621 {
00622    char *buf;
00623 #if 0
00624    printf("Search for %d args: '%s', '%s', '%s', '%s'\n", argc, argv[0], argv[1], argv[2], argv[3]);
00625 #endif   
00626    if (argc != 5)
00627       return RESULT_SHOWUSAGE;
00628    buf = __ast_cli_generator(argv[2], argv[3], atoi(argv[4]), 0);
00629 #if 0
00630    printf("Search for '%s' %s %d got '%s'\n", argv[2], argv[3], atoi(argv[4]), buf);
00631 #endif   
00632    if (buf) {
00633       ast_cli(fd, buf);
00634       free(buf);
00635    } else
00636       ast_cli(fd, "NULL\n");
00637    return RESULT_SUCCESS;
00638 }

static int handle_commandmatchesarray ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 552 of file cli.c.

References ast_cli(), AST_CLI_COMPLETE_EOF, ast_cli_completion_matches(), free, malloc, realloc, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00553 {
00554    char *buf, *obuf;
00555    int buflen = 2048;
00556    int len = 0;
00557    char **matches;
00558    int x, matchlen;
00559 
00560    if (argc != 4)
00561       return RESULT_SHOWUSAGE;
00562    buf = malloc(buflen);
00563    if (!buf)
00564       return RESULT_FAILURE;
00565    buf[len] = '\0';
00566    matches = ast_cli_completion_matches(argv[2], argv[3]);
00567    if (matches) {
00568       for (x=0; matches[x]; x++) {
00569 #if 0
00570          printf("command matchesarray for '%s' %s got '%s'\n", argv[2], argv[3], matches[x]);
00571 #endif
00572          matchlen = strlen(matches[x]) + 1;
00573          if (len + matchlen >= buflen) {
00574             buflen += matchlen * 3;
00575             obuf = buf;
00576             buf = realloc(obuf, buflen);
00577             if (!buf) 
00578                /* Out of memory...  Just free old buffer and be done */
00579                free(obuf);
00580          }
00581          if (buf)
00582             len += sprintf( buf + len, "%s ", matches[x]);
00583          free(matches[x]);
00584          matches[x] = NULL;
00585       }
00586       free(matches);
00587    }
00588 #if 0
00589    printf("array for '%s' %s got '%s'\n", argv[2], argv[3], buf);
00590 #endif
00591    
00592    if (buf) {
00593       ast_cli(fd, "%s%s",buf, AST_CLI_COMPLETE_EOF);
00594       free(buf);
00595    } else
00596       ast_cli(fd, "NULL\n");
00597 
00598    return RESULT_SUCCESS;
00599 }

static int handle_commandnummatches ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 603 of file cli.c.

References ast_cli(), ast_cli_generatornummatches(), RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00604 {
00605    int matches = 0;
00606 
00607    if (argc != 4)
00608       return RESULT_SHOWUSAGE;
00609 
00610    matches = ast_cli_generatornummatches(argv[2], argv[3]);
00611 
00612 #if 0
00613    printf("Search for '%s' %s got '%d'\n", argv[2], argv[3], matches);
00614 #endif
00615    ast_cli(fd, "%d", matches);
00616 
00617    return RESULT_SUCCESS;
00618 }

static int handle_debugchan ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 661 of file cli.c.

References ast_channel_walk_locked(), ast_cli(), ast_get_channel_by_name_locked(), ast_mutex_unlock(), DEBUGCHAN_FLAG, ast_channel::fin, ast_channel::fout, ast_channel::lock, ast_channel::name, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00662 {
00663    struct ast_channel *c=NULL;
00664    int is_all;
00665    if (argc != 3)
00666       return RESULT_SHOWUSAGE;
00667 
00668    is_all = !strcasecmp("all", argv[2]);
00669    if (is_all) {
00670       global_fin |= DEBUGCHAN_FLAG;
00671       global_fout |= DEBUGCHAN_FLAG;
00672       c = ast_channel_walk_locked(NULL);
00673    } else {
00674       c = ast_get_channel_by_name_locked(argv[2]);
00675       if (c == NULL)
00676          ast_cli(fd, "No such channel %s\n", argv[2]);
00677    }
00678    while(c) {
00679       if (!(c->fin & DEBUGCHAN_FLAG) || !(c->fout & DEBUGCHAN_FLAG)) {
00680          c->fin |= DEBUGCHAN_FLAG;
00681          c->fout |= DEBUGCHAN_FLAG;
00682          ast_cli(fd, "Debugging enabled on channel %s\n", c->name);
00683       }
00684       ast_mutex_unlock(&c->lock);
00685       if (!is_all)
00686          break;
00687       c = ast_channel_walk_locked(c);
00688    }
00689    ast_cli(fd, "Debugging on new channels is enabled\n");
00690    return RESULT_SUCCESS;
00691 }

static int handle_debuglevel ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 640 of file cli.c.

References ast_cli(), debug_filename, option_debug, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00641 {
00642    int newlevel;
00643    char *filename = "<any>";
00644    if ((argc < 3) || (argc > 4))
00645       return RESULT_SHOWUSAGE;
00646    if (sscanf(argv[2], "%5d", &newlevel) != 1)
00647       return RESULT_SHOWUSAGE;
00648    option_debug = newlevel;
00649    if (argc == 4) {
00650       filename = argv[3];
00651       ast_copy_string(debug_filename, filename, sizeof(debug_filename));
00652    } else {
00653       debug_filename[0] = '\0';
00654    }
00655    ast_cli(fd, "Debugging level set to %d, file '%s'\n", newlevel, filename);
00656    return RESULT_SUCCESS;
00657 }

static int handle_help ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 1121 of file cli.c.

References ast_cli(), find_cli(), help_workhorse(), join(), RESULT_SHOWUSAGE, RESULT_SUCCESS, and ast_cli_entry::usage.

01121                                                        {
01122    struct ast_cli_entry *e;
01123    char fullcmd[80];
01124    if ((argc < 1))
01125       return RESULT_SHOWUSAGE;
01126    if (argc > 1) {
01127       e = find_cli(argv + 1, 1);
01128       if (e) {
01129          if (e->usage)
01130             ast_cli(fd, "%s", e->usage);
01131          else {
01132             join(fullcmd, sizeof(fullcmd), argv+1, 0);
01133             ast_cli(fd, "No help text available for '%s'.\n", fullcmd);
01134          }
01135       } else {
01136          if (find_cli(argv + 1, -1)) {
01137             return help_workhorse(fd, argv + 1);
01138          } else {
01139             join(fullcmd, sizeof(fullcmd), argv+1, 0);
01140             ast_cli(fd, "No such command '%s'.\n", fullcmd);
01141          }
01142       }
01143    } else {
01144       return help_workhorse(fd, NULL);
01145    }
01146    return RESULT_SUCCESS;
01147 }

static int handle_load ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 128 of file cli.c.

References ast_cli(), ast_load_resource(), RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00129 {
00130    if (argc != 2)
00131       return RESULT_SHOWUSAGE;
00132    if (ast_load_resource(argv[1])) {
00133       ast_cli(fd, "Unable to load module %s\n", argv[1]);
00134       return RESULT_FAILURE;
00135    }
00136    return RESULT_SUCCESS;
00137 }

static int handle_modlist ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 387 of file cli.c.

References ast_cli(), ast_mutex_lock(), ast_mutex_unlock(), ast_update_module_list(), MODLIST_FORMAT2, modlist_modentry(), RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00388 {
00389    char *like = "";
00390    if (argc == 3)
00391       return RESULT_SHOWUSAGE;
00392    else if (argc >= 4) {
00393       if (strcmp(argv[2],"like")) 
00394          return RESULT_SHOWUSAGE;
00395       like = argv[3];
00396    }
00397       
00398    ast_mutex_lock(&climodentrylock);
00399    climodentryfd = fd;
00400    ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Use Count");
00401    ast_cli(fd,"%d modules loaded\n", ast_update_module_list(modlist_modentry, like));
00402    climodentryfd = -1;
00403    ast_mutex_unlock(&climodentrylock);
00404    return RESULT_SUCCESS;
00405 }

static int handle_nodebugchan ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 693 of file cli.c.

References ast_channel_walk_locked(), ast_cli(), ast_get_channel_by_name_locked(), ast_mutex_unlock(), DEBUGCHAN_FLAG, ast_channel::fin, ast_channel::fout, ast_channel::lock, ast_channel::name, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00694 {
00695    struct ast_channel *c=NULL;
00696    int is_all;
00697    if (argc != 4)
00698       return RESULT_SHOWUSAGE;
00699    is_all = !strcasecmp("all", argv[3]);
00700    if (is_all) {
00701       global_fin &= ~DEBUGCHAN_FLAG;
00702       global_fout &= ~DEBUGCHAN_FLAG;
00703       c = ast_channel_walk_locked(NULL);
00704    } else {
00705       c = ast_get_channel_by_name_locked(argv[3]);
00706       if (c == NULL)
00707          ast_cli(fd, "No such channel %s\n", argv[3]);
00708     }
00709    while(c) {
00710       if ((c->fin & DEBUGCHAN_FLAG) || (c->fout & DEBUGCHAN_FLAG)) {
00711          c->fin &= ~DEBUGCHAN_FLAG;
00712          c->fout &= ~DEBUGCHAN_FLAG;
00713          ast_cli(fd, "Debugging disabled on channel %s\n", c->name);
00714       }
00715       ast_mutex_unlock(&c->lock);
00716       if (!is_all)
00717          break;
00718       c = ast_channel_walk_locked(c);
00719    }
00720    ast_cli(fd, "Debugging on new channels is disabled\n");
00721    return RESULT_SUCCESS;
00722 }

static int handle_reload ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 139 of file cli.c.

References ast_cli(), ast_module_reload(), RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00140 {
00141    int x;
00142    int res;
00143    if (argc < 1)
00144       return RESULT_SHOWUSAGE;
00145    if (argc > 1) { 
00146       for (x=1;x<argc;x++) {
00147          res = ast_module_reload(argv[x]);
00148          switch(res) {
00149          case 0:
00150             ast_cli(fd, "No such module '%s'\n", argv[x]);
00151             break;
00152          case 1:
00153             ast_cli(fd, "Module '%s' does not support reload\n", argv[x]);
00154             break;
00155          }
00156       }
00157    } else
00158       ast_module_reload(NULL);
00159    return RESULT_SUCCESS;
00160 }

static int handle_set_debug ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 189 of file cli.c.

References ast_cli(), option_debug, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00190 {
00191    int val = 0;
00192    int oldval = 0;
00193    /* Has a hidden 'at least' argument */
00194    if ((argc != 3) && (argc != 4))
00195       return RESULT_SHOWUSAGE;
00196    if ((argc == 4) && strcasecmp(argv[2], "atleast"))
00197       return RESULT_SHOWUSAGE;
00198    oldval = option_debug;
00199    if (argc == 3)
00200       option_debug = atoi(argv[2]);
00201    else {
00202       val = atoi(argv[3]);
00203       if (val > option_debug)
00204          option_debug = val;
00205    }
00206    if (oldval != option_debug && option_debug > 0)
00207       ast_cli(fd, "Core debug was %d and is now %d\n", oldval, option_debug);
00208    else if (oldval > 0 && option_debug > 0)
00209       ast_cli(fd, "Core debug is at least %d\n", option_debug);
00210    else if (oldval > 0 && option_debug == 0)
00211       ast_cli(fd, "Core debug is now OFF\n");
00212    return RESULT_SUCCESS;
00213 }

static int handle_set_verbose ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 162 of file cli.c.

References ast_cli(), option_verbose, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00163 {
00164    int val = 0;
00165    int oldval = 0;
00166 
00167    /* Has a hidden 'at least' argument */
00168    if ((argc != 3) && (argc != 4))
00169       return RESULT_SHOWUSAGE;
00170    if ((argc == 4) && strcasecmp(argv[2], "atleast"))
00171       return RESULT_SHOWUSAGE;
00172    oldval = option_verbose;
00173    if (argc == 3)
00174       option_verbose = atoi(argv[2]);
00175    else {
00176       val = atoi(argv[3]);
00177       if (val > option_verbose)
00178          option_verbose = val;
00179    }
00180    if (oldval != option_verbose && option_verbose > 0)
00181       ast_cli(fd, "Verbosity was %d and is now %d\n", oldval, option_verbose);
00182    else if (oldval > 0 && option_verbose > 0)
00183       ast_cli(fd, "Verbosity is at least %d\n", option_verbose);
00184    else if (oldval > 0 && option_verbose == 0)
00185       ast_cli(fd, "Verbosity is now OFF\n");
00186    return RESULT_SUCCESS;
00187 }

static int handle_showchan ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 726 of file cli.c.

References ast_channel::_bridge, ast_channel::_state, ast_channel::appl, ast_bridged_channel(), ast_cdr_serialize_variables(), ast_cli(), AST_FLAG_BLOCKING, ast_get_channel_by_name_locked(), ast_mutex_unlock(), ast_state2str(), ast_strlen_zero(), ast_test_flag, ast_channel::blockproc, ast_channel::callgroup, ast_channel::cdr, ast_channel::cid, ast_callerid::cid_dnid, ast_callerid::cid_name, ast_callerid::cid_num, ast_channel::context, ast_channel::data, ast_channel::exten, ast_channel::fds, ast_channel::fin, ast_channel::fout, ast_channel::lock, name, ast_channel::name, ast_channel::nativeformats, pbx_builtin_serialize_variables(), ast_channel::pickupgroup, ast_channel::priority, ast_channel::readformat, RESULT_SHOWUSAGE, RESULT_SUCCESS, ast_channel::rings, ast_cdr::start, ast_channel::type, ast_channel::uniqueid, ast_channel::whentohangup, and ast_channel::writeformat.

00727 {
00728    struct ast_channel *c=NULL;
00729    struct timeval now;
00730    char buf[2048];
00731    char cdrtime[256];
00732    long elapsed_seconds=0;
00733    int hour=0, min=0, sec=0;
00734    
00735    if (argc != 3)
00736       return RESULT_SHOWUSAGE;
00737    now = ast_tvnow();
00738    c = ast_get_channel_by_name_locked(argv[2]);
00739    if (!c) {
00740       ast_cli(fd, "%s is not a known channel\n", argv[2]);
00741       return RESULT_SUCCESS;
00742    }
00743    if(c->cdr) {
00744       elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec;
00745       hour = elapsed_seconds / 3600;
00746       min = (elapsed_seconds % 3600) / 60;
00747       sec = elapsed_seconds % 60;
00748       snprintf(cdrtime, sizeof(cdrtime), "%dh%dm%ds", hour, min, sec);
00749    } else
00750       strcpy(cdrtime, "N/A");
00751    ast_cli(fd, 
00752       " -- General --\n"
00753       "           Name: %s\n"
00754       "           Type: %s\n"
00755       "       UniqueID: %s\n"
00756       "      Caller ID: %s\n"
00757       " Caller ID Name: %s\n"
00758       "    DNID Digits: %s\n"
00759       "          State: %s (%d)\n"
00760       "          Rings: %d\n"
00761       "   NativeFormat: %d\n"
00762       "    WriteFormat: %d\n"
00763       "     ReadFormat: %d\n"
00764       "1st File Descriptor: %d\n"
00765       "      Frames in: %d%s\n"
00766       "     Frames out: %d%s\n"
00767       " Time to Hangup: %ld\n"
00768       "   Elapsed Time: %s\n"
00769       "  Direct Bridge: %s\n"
00770       "Indirect Bridge: %s\n"
00771       " --   PBX   --\n"
00772       "        Context: %s\n"
00773       "      Extension: %s\n"
00774       "       Priority: %d\n"
00775       "     Call Group: %llu\n"
00776       "   Pickup Group: %llu\n"
00777       "    Application: %s\n"
00778       "           Data: %s\n"
00779       "    Blocking in: %s\n",
00780       c->name, c->type, c->uniqueid,
00781       (c->cid.cid_num ? c->cid.cid_num : "(N/A)"),
00782       (c->cid.cid_name ? c->cid.cid_name : "(N/A)"),
00783       (c->cid.cid_dnid ? c->cid.cid_dnid : "(N/A)" ), ast_state2str(c->_state), c->_state, c->rings, c->nativeformats, c->writeformat, c->readformat,
00784       c->fds[0], c->fin & 0x7fffffff, (c->fin & 0x80000000) ? " (DEBUGGED)" : "",
00785       c->fout & 0x7fffffff, (c->fout & 0x80000000) ? " (DEBUGGED)" : "", (long)c->whentohangup,
00786       cdrtime, c->_bridge ? c->_bridge->name : "<none>", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 
00787       c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
00788       ( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"),
00789       (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));
00790    
00791    if(pbx_builtin_serialize_variables(c,buf,sizeof(buf)))
00792       ast_cli(fd,"      Variables:\n%s\n",buf);
00793    if(c->cdr && ast_cdr_serialize_variables(c->cdr,buf, sizeof(buf), '=', '\n', 1))
00794       ast_cli(fd,"  CDR Variables:\n%s\n",buf);
00795    
00796    ast_mutex_unlock(&c->lock);
00797    return RESULT_SUCCESS;
00798 }

static int handle_showuptime ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 349 of file cli.c.

References ast_cli(), ast_lastreloadtime, ast_startuptime, format_uptimestr(), free, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00350 {
00351    time_t curtime, tmptime;
00352    char *timestr;
00353    int printsec;
00354 
00355    printsec = ((argc == 3) && (!strcasecmp(argv[2],"seconds")));
00356    if ((argc != 2) && (!printsec))
00357       return RESULT_SHOWUSAGE;
00358 
00359    time(&curtime);
00360    if (ast_startuptime) {
00361       tmptime = curtime - ast_startuptime;
00362       if (printsec) {
00363          ast_cli(fd, "System uptime: %lu\n",(u_long)tmptime);
00364       } else {
00365          timestr = format_uptimestr(tmptime);
00366          if (timestr) {
00367             ast_cli(fd, "System uptime: %s\n", timestr);
00368             free(timestr);
00369          }
00370       }
00371    }     
00372    if (ast_lastreloadtime) {
00373       tmptime = curtime - ast_lastreloadtime;
00374       if (printsec) {
00375          ast_cli(fd, "Last reload: %lu\n", (u_long) tmptime);
00376       } else {
00377          timestr = format_uptimestr(tmptime);
00378          if ((timestr) && (!printsec)) {
00379             ast_cli(fd, "Last reload: %s\n", timestr);
00380             free(timestr);
00381          } 
00382       }
00383    }
00384    return RESULT_SUCCESS;
00385 }

static int handle_softhangup ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 535 of file cli.c.

References ast_cli(), ast_get_channel_by_name_locked(), ast_mutex_unlock(), ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, ast_channel::lock, ast_channel::name, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00536 {
00537    struct ast_channel *c=NULL;
00538    if (argc != 3)
00539       return RESULT_SHOWUSAGE;
00540    c = ast_get_channel_by_name_locked(argv[2]);
00541    if (c) {
00542       ast_cli(fd, "Requested Hangup on channel '%s'\n", c->name);
00543       ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
00544       ast_mutex_unlock(&c->lock);
00545    } else
00546       ast_cli(fd, "%s is not a known channel\n", argv[2]);
00547    return RESULT_SUCCESS;
00548 }

static int handle_unload ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 215 of file cli.c.

References ast_cli(), AST_FORCE_FIRM, AST_FORCE_HARD, AST_FORCE_SOFT, ast_unload_resource(), RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00216 {
00217    int x;
00218    int force=AST_FORCE_SOFT;
00219    if (argc < 2)
00220       return RESULT_SHOWUSAGE;
00221    for (x=1;x<argc;x++) {
00222       if (argv[x][0] == '-') {
00223          switch(argv[x][1]) {
00224          case 'f':
00225             force = AST_FORCE_FIRM;
00226             break;
00227          case 'h':
00228             force = AST_FORCE_HARD;
00229             break;
00230          default:
00231             return RESULT_SHOWUSAGE;
00232          }
00233       } else if (x !=  argc - 1) 
00234          return RESULT_SHOWUSAGE;
00235       else if (ast_unload_resource(argv[x], force)) {
00236          ast_cli(fd, "Unable to unload resource %s\n", argv[x]);
00237          return RESULT_FAILURE;
00238       }
00239    }
00240    return RESULT_SUCCESS;
00241 }

static int handle_version ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 409 of file cli.c.

References ast_cli(), RESULT_SHOWUSAGE, and RESULT_SUCCESS.

00410 {
00411    if (argc != 2)
00412       return RESULT_SHOWUSAGE;
00413    ast_cli(fd, "Asterisk %s built by %s @ %s on a %s running %s on %s\n",
00414       ASTERISK_VERSION, ast_build_user, ast_build_hostname,
00415       ast_build_machine, ast_build_os, ast_build_date);
00416    return RESULT_SUCCESS;
00417 }

static int help_workhorse ( int  fd,
char *  match[] 
) [static]

Definition at line 1079 of file cli.c.

References ast_cli(), ast_cli_entry::cmda, join(), ast_cli_entry::next, and ast_cli_entry::summary.

Referenced by handle_help(), and handle_showagi().

01080 {
01081    char fullcmd1[80] = "";
01082    char fullcmd2[80] = "";
01083    char matchstr[80];
01084    char *fullcmd = NULL;
01085    struct ast_cli_entry *e, *e1, *e2;
01086    e1 = builtins;
01087    e2 = helpers;
01088    if (match)
01089       join(matchstr, sizeof(matchstr), match, 0);
01090    while(e1->cmda[0] || e2) {
01091       if (e2)
01092          join(fullcmd2, sizeof(fullcmd2), e2->cmda, 0);
01093       if (e1->cmda[0])
01094          join(fullcmd1, sizeof(fullcmd1), e1->cmda, 0);
01095       if (!e1->cmda[0] || 
01096             (e2 && (strcmp(fullcmd2, fullcmd1) < 0))) {
01097          /* Use e2 */
01098          e = e2;
01099          fullcmd = fullcmd2;
01100          /* Increment by going to next */
01101          e2 = e2->next;
01102       } else {
01103          /* Use e1 */
01104          e = e1;
01105          fullcmd = fullcmd1;
01106          e1++;
01107       }
01108       /* Hide commands that start with '_' */
01109       if (fullcmd[0] == '_')
01110          continue;
01111       if (match) {
01112          if (strncasecmp(matchstr, fullcmd, strlen(matchstr))) {
01113             continue;
01114          }
01115       }
01116       ast_cli(fd, "%25.25s  %s\n", fullcmd, e->summary);
01117    }
01118    return 0;
01119 }

static void join ( char *  dest,
size_t  destsize,
char *  w[],
int  tws 
) [static]

Definition at line 945 of file cli.c.

References ast_strlen_zero().

Referenced by __ast_cli_generator(), find_best(), handle_dumpagihtml(), handle_help(), handle_showagi(), and help_workhorse().

00946 {
00947    int x;
00948    /* Join words into a string */
00949    if (!dest || destsize < 1) {
00950       return;
00951    }
00952    dest[0] = '\0';
00953    for (x=0;w[x];x++) {
00954       if (x)
00955          strncat(dest, " ", destsize - strlen(dest) - 1);
00956       strncat(dest, w[x], destsize - strlen(dest) - 1);
00957    }
00958    if (tws && !ast_strlen_zero(dest))
00959       strncat(dest, " ", destsize - strlen(dest) - 1);
00960 }

static void join2 ( char *  dest,
size_t  destsize,
char *  w[] 
) [static]

Definition at line 962 of file cli.c.

Referenced by ast_cli_register().

00963 {
00964    int x;
00965    /* Join words into a string */
00966    if (!dest || destsize < 1) {
00967       return;
00968    }
00969    dest[0] = '\0';
00970    for (x=0;w[x];x++) {
00971       strncat(dest, w[x], destsize - strlen(dest) - 1);
00972    }
00973 }

static int modlist_modentry ( const char *  module,
const char *  description,
int  usecnt,
const char *  like 
) [static]

Definition at line 249 of file cli.c.

References ast_cli(), MODLIST_FORMAT, and strcasestr().

Referenced by handle_modlist().

00250 {
00251    /* Comparing the like with the module */
00252    if (strcasestr(module, like) ) {
00253       ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt);
00254       return 1;
00255    } 
00256    return 0;
00257 }

static char* parse_args ( char *  s,
int *  argc,
char *  argv[],
int  max,
int *  trailingwhitespace 
) [static]

Definition at line 1149 of file cli.c.

References ast_log(), LOG_WARNING, and strdup.

Referenced by __ast_cli_generator(), agi_handle_command(), and ast_cli_command().

01150 {
01151    char *dup, *cur;
01152    int x = 0;
01153    int quoted = 0;
01154    int escaped = 0;
01155    int whitespace = 1;
01156 
01157    *trailingwhitespace = 0;
01158    if (!(dup = strdup(s)))
01159       return NULL;
01160 
01161    cur = dup;
01162    while (*s) {
01163       if ((*s == '"') && !escaped) {
01164          quoted = !quoted;
01165          if (quoted & whitespace) {
01166             /* If we're starting a quoted string, coming off white space, start a new argument */
01167             if (x >= (max - 1)) {
01168                ast_log(LOG_WARNING, "Too many arguments, truncating\n");
01169                break;
01170             }
01171             argv[x++] = cur;
01172             whitespace = 0;
01173          }
01174          escaped = 0;
01175       } else if (((*s == ' ') || (*s == '\t')) && !(quoted || escaped)) {
01176          /* If we are not already in whitespace, and not in a quoted string or
01177             processing an escape sequence, and just entered whitespace, then
01178             finalize the previous argument and remember that we are in whitespace
01179          */
01180          if (!whitespace) {
01181             *(cur++) = '\0';
01182             whitespace = 1;
01183          }
01184       } else if ((*s == '\\') && !escaped) {
01185          escaped = 1;
01186       } else {
01187          if (whitespace) {
01188             /* If we are coming out of whitespace, start a new argument */
01189             if (x >= (max - 1)) {
01190                ast_log(LOG_WARNING, "Too many arguments, truncating\n");
01191                break;
01192             }
01193             argv[x++] = cur;
01194             whitespace = 0;
01195          }
01196          *(cur++) = *s;
01197          escaped = 0;
01198       }
01199       s++;
01200    }
01201    /* Null terminate */
01202    *(cur++) = '\0';
01203    argv[x] = NULL;
01204    *argc = x;
01205    *trailingwhitespace = whitespace;
01206    return dup;
01207 }


Variable Documentation

const char* ast_build_date

Definition at line 31 of file buildinfo.c.

const char* ast_build_hostname

Definition at line 27 of file buildinfo.c.

const char* ast_build_kernel

Definition at line 28 of file buildinfo.c.

const char* ast_build_machine

Definition at line 29 of file buildinfo.c.

const char* ast_build_os

Definition at line 30 of file buildinfo.c.

const char* ast_build_user

Definition at line 32 of file buildinfo.c.

struct ast_cli_entry builtins[] [static]

Definition at line 875 of file cli.c.

Referenced by load_module(), load_pbx(), and unload_module().

char chanlist_help[] [static]

Definition at line 99 of file cli.c.

int climodentryfd = -1 [static]

Definition at line 247 of file cli.c.

char commandcomplete_help[] [static]

Initial value:

 
"Usage: _command complete \"<line>\" text state\n"
"       This function is used internally to help with command completion and should.\n"
"       never be called by the user directly.\n"

Definition at line 520 of file cli.c.

char commandmatchesarray_help[] [static]

Initial value:

 
"Usage: _command matchesarray \"<line>\" text \n"
"       This function is used internally to help with command completion and should.\n"
"       never be called by the user directly.\n"

Definition at line 530 of file cli.c.

char commandnummatches_help[] [static]

Initial value:

 
"Usage: _command nummatches \"<line>\" text \n"
"       This function is used internally to help with command completion and should.\n"
"       never be called by the user directly.\n"

Definition at line 525 of file cli.c.

char debugchan_help[] [static]

Initial value:

 
"Usage: debug channel <channel>\n"
"       Enables debugging on a specific channel.\n"

Definition at line 507 of file cli.c.

char debuglevel_help[] [static]

Initial value:

 
"Usage: debug level <level> [filename]\n"
"       Set debug to specified level (0 to disable).  If filename\n"
"is specified, debugging will be limited to just that file.\n"

Definition at line 511 of file cli.c.

unsigned long global_fin

Definition at line 100 of file channel.c.

Referenced by ast_channel_alloc().

unsigned long global_fout

Definition at line 100 of file channel.c.

Referenced by ast_channel_alloc().

char help_help[] [static]

Initial value:

"Usage: help [topic]\n"
"       When called with a topic as an argument, displays usage\n"
"       information on the given command. If called without a\n"
"       topic, it provides a list of commands.\n"

Definition at line 93 of file cli.c.

struct ast_cli_entry* helpers = NULL

Definition at line 79 of file cli.c.

char load_help[] [static]

Initial value:

 
"Usage: load <module name>\n"
"       Loads the specified module into Asterisk.\n"

Definition at line 81 of file cli.c.

char modlist_help[] [static]

Initial value:

"Usage: show modules [like keyword]\n"
"       Shows Asterisk modules currently in use, and usage statistics.\n"

Definition at line 259 of file cli.c.

char nodebugchan_help[] [static]

Initial value:

 
"Usage: no debug channel <channel>\n"
"       Disables debugging on a specific channel.\n"

Definition at line 516 of file cli.c.

char reload_help[] [static]

Initial value:

 
"Usage: reload [module ...]\n"
"       Reloads configuration files for all listed modules which support\n"
"       reloading, or for all supported modules if none are listed.\n"

Definition at line 106 of file cli.c.

char set_debug_help[] [static]

Initial value:

 
"Usage: set debug <level>\n"
"       Sets level of core debug messages to be displayed.  0 means\n"
"       no messages should be displayed. Equivalent to -d[d[d...]]\n"
"       on startup.\n"

Definition at line 117 of file cli.c.

char set_verbose_help[] [static]

Initial value:

 
"Usage: set verbose <level>\n"
"       Sets level of verbose messages to be displayed.  0 means\n"
"       no messages should be displayed. Equivalent to -v[v[v...]]\n"
"       on startup\n"

Definition at line 111 of file cli.c.

char showchan_help[] [static]

Initial value:

 
"Usage: show channel <channel>\n"
"       Shows lots of information about the specified channel.\n"

Definition at line 503 of file cli.c.

char softhangup_help[] [static]

Initial value:

"Usage: soft hangup <channel>\n"
"       Request that a channel be hung up. The hangup takes effect\n"
"       the next time the driver reads or writes from the channel\n"

Definition at line 123 of file cli.c.

char unload_help[] [static]

Definition at line 85 of file cli.c.

char uptime_help[] [static]

Initial value:

"Usage: show uptime [seconds]\n"
"       Shows Asterisk uptime information.\n"
"       The seconds word returns the uptime in seconds only.\n"

Definition at line 267 of file cli.c.

char version_help[] [static]

Initial value:

"Usage: show version\n"
"       Shows Asterisk version information.\n"

Definition at line 263 of file cli.c.


Generated on Wed Oct 28 15:48:42 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6