This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | ast_app_option |
| A structure to hold the description of an application 'option'. More... | |
| struct | ast_group_info |
| struct | ast_ivr_menu |
| struct | ast_ivr_option |
Defines | |
| #define | AST_APP_ARG(name) char *name |
| Define an application argument. | |
| #define | AST_APP_OPTION(option, flagno) [option] = { .flag = flagno } |
| Declares an application option that does not accept an argument. | |
| #define | AST_APP_OPTION_ARG(option, flagno, argno) [option] = { .flag = flagno, .arg_index = argno + 1 } |
| Declares an application option that accepts an argument. | |
| #define | AST_APP_OPTIONS(holder, options...) static const struct ast_app_option holder[128] = options |
| Declares an array of options for an application. | |
| #define | AST_DECLARE_APP_ARGS(name, arglist) |
| Declare a structure to hold the application's arguments. | |
| #define | AST_IVR_DECLARE_MENU(holder, title, flags, foo...) |
| #define | AST_IVR_FLAG_AUTORESTART (1 << 0) |
| #define | AST_STANDARD_APP_ARGS(args, parse) args.argc = ast_app_separate_args(parse, '|', args.argv, (sizeof(args) - sizeof(args.argc)) / sizeof(args.argv[0])) |
| Performs the 'standard' argument separation process for an application. | |
Typedefs | |
| typedef int(*) | ast_ivr_callback (struct ast_channel *chan, char *option, void *cbdata) |
| Callback function for IVR. | |
Enumerations | |
| enum | ast_ivr_action { AST_ACTION_UPONE, AST_ACTION_EXIT, AST_ACTION_CALLBACK, AST_ACTION_PLAYBACK, AST_ACTION_BACKGROUND, AST_ACTION_PLAYLIST, AST_ACTION_MENU, AST_ACTION_REPEAT, AST_ACTION_RESTART, AST_ACTION_TRANSFER, AST_ACTION_WAITOPTION, AST_ACTION_NOOP, AST_ACTION_BACKLIST } |
| enum | AST_LOCK_RESULT { AST_LOCK_SUCCESS = 0, AST_LOCK_TIMEOUT = -1, AST_LOCK_PATH_NOT_FOUND = -2, AST_LOCK_FAILURE = -3 } |
Functions | |
| int | ast_app_dtget (struct ast_channel *chan, const char *context, char *collect, size_t size, int maxlen, int timeout) |
| Present a dialtone and collect a certain length extension. | |
| int | ast_app_getdata (struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout) |
| Plays a stream and gets DTMF data from a channel. | |
| int | ast_app_getdata_full (struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd) |
| Full version with audiofd and controlfd. NOTE: returns '2' on ctrlfd available, not '1' like other full functions. | |
| int | ast_app_getvoice (struct ast_channel *c, char *dest, char *dstfmt, char *prompt, int silence, int maxsec) |
| int | ast_app_group_discard (struct ast_channel *chan) |
| int | ast_app_group_get_count (char *group, char *category) |
| ast_group_info * | ast_app_group_list_head (void) |
| int | ast_app_group_list_lock (void) |
| int | ast_app_group_list_unlock (void) |
| int | ast_app_group_match_get_count (char *groupmatch, char *category) |
| int | ast_app_group_set_channel (struct ast_channel *chan, char *data) |
| int | ast_app_group_split_group (char *data, char *group, int group_max, char *category, int category_max) |
| int | ast_app_group_update (struct ast_channel *oldchan, struct ast_channel *newchan) |
| int | ast_app_has_voicemail (const char *mailbox, const char *folder) |
| int | ast_app_messagecount (const char *mailbox, int *newmsgs, int *oldmsgs) |
| int | ast_app_parse_options (const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr) |
| Parses a string containing application options and sets flags/arguments. | |
| unsigned int | ast_app_separate_args (char *buf, char delim, char **array, int arraylen) |
| Separate a string into arguments in an array. | |
| int | ast_control_streamfile (struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *pause, const char *restart, int skipms) |
| int | ast_dtmf_stream (struct ast_channel *chan, struct ast_channel *peer, char *digits, int between) |
| void | ast_install_vm_functions (int(*has_voicemail_func)(const char *mailbox, const char *folder), int(*messagecount_func)(const char *mailbox, int *newmsgs, int *oldmsgs)) |
| int | ast_ivr_menu_run (struct ast_channel *c, struct ast_ivr_menu *menu, void *cbdata) |
| Runs an IVR menu. | |
| int | ast_linear_stream (struct ast_channel *chan, const char *filename, int fd, int allowoverride) |
| enum AST_LOCK_RESULT | ast_lock_path (const char *path) |
| Lock a filesystem path. | |
| int | ast_play_and_prepend (struct ast_channel *chan, char *playfile, char *recordfile, int maxtime_sec, char *fmt, int *duration, int beep, int silencethreshold, int maxsilence_ms) |
| int | ast_play_and_record (struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime_sec, const char *fmt, int *duration, int silencethreshold, int maxsilence_ms, const char *path) |
| int | ast_play_and_record_full (struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime_sec, const char *fmt, int *duration, int silencethreshold, int maxsilence_ms, const char *path, const char *acceptdtmf, const char *canceldtmf) |
| int | ast_play_and_wait (struct ast_channel *chan, const char *fn) |
| char * | ast_read_textfile (const char *file) |
| int | ast_record_review (struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path) |
| int | ast_safe_system (const char *s) |
| void | ast_uninstall_vm_functions (void) |
| int | ast_unlock_path (const char *path) |
Definition in file app.h.
Define an application argument.
| name | The name of the argument |
Definition at line 207 of file app.h.
Referenced by __login_exec(), aqm_exec(), dial_exec_full(), disa_exec(), enumlookup_exec(), group_check_exec(), hasvoicemail_exec(), md5check_exec(), misdn_check_l2l1(), mixmonitor_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), playback_exec(), pqm_exec(), privacy_exec(), record_exec(), rqm_exec(), sendimage_exec(), sendtext_exec(), transfer_exec(), txtcidname_exec(), upqm_exec(), and vm_box_exists().
| #define AST_APP_OPTION | ( | option, | |||
| flagno | ) | [option] = { .flag = flagno } |
Declares an application option that does not accept an argument.
| option | The single character representing the option | |
| flagno | The flag index to be set if this option is present |
| #define AST_APP_OPTION_ARG | ( | option, | |||
| flagno, | |||||
| argno | ) | [option] = { .flag = flagno, .arg_index = argno + 1 } |
Declares an application option that accepts an argument.
| option | The single character representing the option | |
| flagno | The flag index to be set if this option is present | |
| argno | The index into the argument array where the argument should be placed |
| #define AST_APP_OPTIONS | ( | holder, | |||
| options... | ) | static const struct ast_app_option holder[128] = options |
Declares an array of options for an application.
| holder | The name of the array to be created | |
| options | The actual options to be placed into the array |
struct ast_option elements to hold the list of available options for an application. Each option must be declared using either the AST_APP_OPTION() or AST_APP_OPTION_ARG() macros.Example usage:
enum { OPT_JUMP = (1 << 0), OPT_BLAH = (1 << 1), OPT_BLORT = (1 << 2), } my_app_option_flags; enum { OPT_ARG_BLAH = 0, OPT_ARG_BLORT, !! this entry tells how many possible arguments there are, and must be the last entry in the list OPT_ARG_ARRAY_SIZE, } my_app_option_args; AST_APP_OPTIONS(my_app_options, { AST_APP_OPTION('j', OPT_JUMP), AST_APP_OPTION_ARG('b', OPT_BLAH, OPT_ARG_BLAH), AST_APP_OPTION_BLORT('B', OPT_BLORT, OPT_ARG_BLORT), }); static int my_app_exec(struct ast_channel *chan, void *data) { char *options; struct ast_flags opts = { 0, }; char *opt_args[OPT_ARG_ARRAY_SIZE]; ... do any argument parsing here ... if (ast_parseoptions(my_app_options, &opts, opt_args, options)) { LOCAL_USER_REMOVE(u); return -1; } }
| #define AST_DECLARE_APP_ARGS | ( | name, | |||
| arglist | ) |
Value:
struct { \ unsigned int argc; \ char *argv[0]; \ arglist \ } name
| name | The name of the structure | |
| arglist | The list of arguments, defined using AST_APP_ARG |
Definition at line 224 of file app.h.
Referenced by __login_exec(), aqm_exec(), dial_exec_full(), disa_exec(), enumlookup_exec(), group_check_exec(), hasvoicemail_exec(), md5check_exec(), misdn_check_l2l1(), mixmonitor_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), playback_exec(), pqm_exec(), privacy_exec(), record_exec(), rqm_exec(), sendimage_exec(), sendtext_exec(), transfer_exec(), txtcidname_exec(), upqm_exec(), and vm_box_exists().
| #define AST_IVR_DECLARE_MENU | ( | holder, | |||
| title, | |||||
| flags, | |||||
| foo... | ) |
Value:
static struct ast_ivr_option __options_##holder[] = foo;\ static struct ast_ivr_menu holder = { title, flags, __options_##holder }
| #define AST_STANDARD_APP_ARGS | ( | args, | |||
| parse | ) | args.argc = ast_app_separate_args(parse, '|', args.argv, (sizeof(args) - sizeof(args.argc)) / sizeof(args.argv[0])) |
Performs the 'standard' argument separation process for an application.
| args | An argument structure defined using AST_DECLARE_APP_ARGS | |
| parse | A modifiable buffer containing the input to be parsed |
Definition at line 240 of file app.h.
Referenced by __login_exec(), aqm_exec(), dial_exec_full(), disa_exec(), enumlookup_exec(), group_check_exec(), hasvoicemail_exec(), md5check_exec(), misdn_check_l2l1(), mixmonitor_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), playback_exec(), pqm_exec(), privacy_exec(), rqm_exec(), sendimage_exec(), sendtext_exec(), transfer_exec(), txtcidname_exec(), upqm_exec(), and vm_box_exists().
| typedef int(*) ast_ivr_callback(struct ast_channel *chan, char *option, void *cbdata) |
| enum ast_ivr_action |
| AST_ACTION_UPONE | adata is unused |
| AST_ACTION_EXIT | adata is the return value for ast_ivr_menu_run if channel was not hungup |
| AST_ACTION_CALLBACK | adata is an ast_ivr_callback |
| AST_ACTION_PLAYBACK | adata is file to play |
| AST_ACTION_BACKGROUND | adata is file to play |
| AST_ACTION_PLAYLIST | adata is list of files, separated by ; to play |
| AST_ACTION_MENU | adata is a pointer to an ast_ivr_menu |
| AST_ACTION_REPEAT | adata is max # of repeats, cast to a pointer |
| AST_ACTION_RESTART | adata is like repeat, but resets repeats to 0 |
| AST_ACTION_TRANSFER | adata is a string with exten[] |
| AST_ACTION_WAITOPTION | adata is a timeout, or 0 for defaults |
| AST_ACTION_NOOP | adata is unused |
| AST_ACTION_BACKLIST | adata is list of files separated by ; allows interruption |
Definition at line 37 of file app.h.
00037 { 00038 AST_ACTION_UPONE, /*!< adata is unused */ 00039 AST_ACTION_EXIT, /*!< adata is the return value for ast_ivr_menu_run if channel was not hungup */ 00040 AST_ACTION_CALLBACK, /*!< adata is an ast_ivr_callback */ 00041 AST_ACTION_PLAYBACK, /*!< adata is file to play */ 00042 AST_ACTION_BACKGROUND, /*!< adata is file to play */ 00043 AST_ACTION_PLAYLIST, /*!< adata is list of files, separated by ; to play */ 00044 AST_ACTION_MENU, /*!< adata is a pointer to an ast_ivr_menu */ 00045 AST_ACTION_REPEAT, /*!< adata is max # of repeats, cast to a pointer */ 00046 AST_ACTION_RESTART, /*!< adata is like repeat, but resets repeats to 0 */ 00047 AST_ACTION_TRANSFER, /*!< adata is a string with exten[@context] */ 00048 AST_ACTION_WAITOPTION, /*!< adata is a timeout, or 0 for defaults */ 00049 AST_ACTION_NOOP, /*!< adata is unused */ 00050 AST_ACTION_BACKLIST, /*!< adata is list of files separated by ; allows interruption */ 00051 } ast_ivr_action;
| enum AST_LOCK_RESULT |
Definition at line 149 of file app.h.
00149 { 00150 AST_LOCK_SUCCESS = 0, 00151 AST_LOCK_TIMEOUT = -1, 00152 AST_LOCK_PATH_NOT_FOUND = -2, 00153 AST_LOCK_FAILURE = -3, 00154 };
| int ast_app_dtget | ( | struct ast_channel * | chan, | |
| const char * | context, | |||
| char * | collect, | |||
| size_t | size, | |||
| int | maxlen, | |||
| int | timeout | |||
| ) |
Present a dialtone and collect a certain length extension.
Definition at line 64 of file app.c.
References ast_exists_extension(), ast_get_indication_tone(), ast_ignore_pattern(), ast_log(), ast_matchmore_extension(), ast_playtones_start(), ast_playtones_stop(), ast_waitfordigit(), ast_channel::cid, ast_callerid::cid_num, tone_zone_sound::data, ast_pbx::dtimeout, LOG_NOTICE, ast_channel::pbx, and ast_channel::zone.
Referenced by builtin_atxfer(), and builtin_blindtransfer().
00065 { 00066 struct tone_zone_sound *ts; 00067 int res=0, x=0; 00068 00069 if(maxlen > size) 00070 maxlen = size; 00071 00072 if(!timeout && chan->pbx) 00073 timeout = chan->pbx->dtimeout; 00074 else if(!timeout) 00075 timeout = 5; 00076 00077 ts = ast_get_indication_tone(chan->zone,"dial"); 00078 if (ts && ts->data[0]) 00079 res = ast_playtones_start(chan, 0, ts->data, 0); 00080 else 00081 ast_log(LOG_NOTICE,"Huh....? no dial for indications?\n"); 00082 00083 for (x = strlen(collect); strlen(collect) < maxlen; ) { 00084 res = ast_waitfordigit(chan, timeout); 00085 if (!ast_ignore_pattern(context, collect)) 00086 ast_playtones_stop(chan); 00087 if (res < 1) 00088 break; 00089 if (res == '#') 00090 break; 00091 collect[x++] = res; 00092 if (!ast_matchmore_extension(chan, context, collect, 1, chan->cid.cid_num)) 00093 break; 00094 } 00095 if (res >= 0) { 00096 if (ast_exists_extension(chan, context, collect, 1, chan->cid.cid_num)) 00097 res = 1; 00098 else 00099 res = 0; 00100 } 00101 return res; 00102 }
| int ast_app_getdata | ( | struct ast_channel * | c, | |
| char * | prompt, | |||
| char * | s, | |||
| int | maxlen, | |||
| int | timeout | |||
| ) |
Plays a stream and gets DTMF data from a channel.
| timeout | set timeout to 0 for "standard" timeouts. Set timeout to -1 for "ludicrous time" (essentially never times out) |
Definition at line 108 of file app.c.
References ast_readstring(), ast_streamfile(), ast_pbx::dtimeout, ast_channel::language, ast_channel::pbx, and ast_pbx::rtimeout.
Referenced by __login_exec(), auth_exec(), conf_exec(), dictate_exec(), find_conf(), read_exec(), testclient_exec(), testserver_exec(), and vm_exec().
00109 { 00110 int res,to,fto; 00111 /* XXX Merge with full version? XXX */ 00112 if (maxlen) 00113 s[0] = '\0'; 00114 if (prompt) { 00115 res = ast_streamfile(c, prompt, c->language); 00116 if (res < 0) 00117 return res; 00118 } 00119 fto = c->pbx ? c->pbx->rtimeout * 1000 : 6000; 00120 to = c->pbx ? c->pbx->dtimeout * 1000 : 2000; 00121 00122 if (timeout > 0) 00123 fto = to = timeout; 00124 if (timeout < 0) 00125 fto = to = 1000000000; 00126 res = ast_readstring(c, s, maxlen, to, fto, "#"); 00127 return res; 00128 }
| int ast_app_getdata_full | ( | struct ast_channel * | c, | |
| char * | prompt, | |||
| char * | s, | |||
| int | maxlen, | |||
| int | timeout, | |||
| int | audiofd, | |||
| int | ctrlfd | |||
| ) |
Full version with audiofd and controlfd. NOTE: returns '2' on ctrlfd available, not '1' like other full functions.
Definition at line 131 of file app.c.
References ast_readstring_full(), ast_streamfile(), and ast_channel::language.
Referenced by handle_getdata().
00132 { 00133 int res,to,fto; 00134 if (prompt) { 00135 res = ast_streamfile(c, prompt, c->language); 00136 if (res < 0) 00137 return res; 00138 } 00139 fto = 6000; 00140 to = 2000; 00141 if (timeout > 0) 00142 fto = to = timeout; 00143 if (timeout < 0) 00144 fto = to = 1000000000; 00145 res = ast_readstring_full(c, s, maxlen, to, fto, "#", audiofd, ctrlfd); 00146 return res; 00147 }
| int ast_app_getvoice | ( | struct ast_channel * | c, | |
| char * | dest, | |||
| char * | dstfmt, | |||
| char * | prompt, | |||
| int | silence, | |||
| int | maxsec | |||
| ) |
Record voice (after playing prompt if specified), waiting for silence (in ms) up to a given timeout (in s) or '#'
Definition at line 149 of file app.c.
References ast_dsp_free(), ast_dsp_new(), ast_dsp_silence(), AST_FORMAT_SLINEAR, AST_FRAME_DTMF, AST_FRAME_VOICE, ast_frfree(), ast_log(), ast_read(), ast_set_read_format(), ast_streamfile(), ast_waitfor(), ast_waitstream(), ast_writefile(), ast_writestream(), ast_dsp::f, ast_frame::frametype, ast_channel::language, LOG_NOTICE, LOG_WARNING, ast_channel::name, ast_channel::readformat, ast_frame::samples, ast_frame::subclass, and total.
00150 { 00151 int res; 00152 struct ast_filestream *writer; 00153 int rfmt; 00154 int totalms=0, total; 00155 00156 struct ast_frame *f; 00157 struct ast_dsp *sildet; 00158 /* Play prompt if requested */ 00159 if (prompt) { 00160 res = ast_streamfile(c, prompt, c->language); 00161 if (res < 0) 00162 return res; 00163 res = ast_waitstream(c,""); 00164 if (res < 0) 00165 return res; 00166 } 00167 rfmt = c->readformat; 00168 res = ast_set_read_format(c, AST_FORMAT_SLINEAR); 00169 if (res < 0) { 00170 ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n"); 00171 return -1; 00172 } 00173 sildet = ast_dsp_new(); 00174 if (!sildet) { 00175 ast_log(LOG_WARNING, "Unable to create silence detector :(\n"); 00176 return -1; 00177 } 00178 writer = ast_writefile(dest, dstfmt, "Voice file", 0, 0, 0666); 00179 if (!writer) { 00180 ast_log(LOG_WARNING, "Unable to open file '%s' in format '%s' for writing\n", dest, dstfmt); 00181 ast_dsp_free(sildet); 00182 return -1; 00183 } 00184 for(;;) { 00185 if ((res = ast_waitfor(c, 2000)) < 0) { 00186 ast_log(LOG_NOTICE, "Waitfor failed while recording file '%s' format '%s'\n", dest, dstfmt); 00187 break; 00188 } 00189 if (res) { 00190 f = ast_read(c); 00191 if (!f) { 00192 ast_log(LOG_NOTICE, "Hungup while recording file '%s' format '%s'\n", dest, dstfmt); 00193 break; 00194 } 00195 if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) { 00196 /* Ended happily with DTMF */ 00197 ast_frfree(f); 00198 break; 00199 } else if (f->frametype == AST_FRAME_VOICE) { 00200 ast_dsp_silence(sildet, f, &total); 00201 if (total > silence) { 00202 /* Ended happily with silence */ 00203 ast_frfree(f); 00204 break; 00205 } 00206 totalms += f->samples / 8; 00207 if (totalms > maxsec * 1000) { 00208 /* Ended happily with too much stuff */ 00209 ast_log(LOG_NOTICE, "Constraining voice on '%s' to %d seconds\n", c->name, maxsec); 00210 ast_frfree(f); 00211 break; 00212 } 00213 res = ast_writestream(writer, f); 00214 if (res < 0) { 00215 ast_log(LOG_WARNING, "Failed to write to stream at %s!\n", dest); 00216 ast_frfree(f); 00217 break; 00218 } 00219 00220 } 00221 ast_frfree(f); 00222 } 00223 } 00224 res = ast_set_read_format(c, rfmt); 00225 if (res) 00226 ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", c->name); 00227 ast_dsp_free(sildet); 00228 ast_closestream(writer); 00229 return 0; 00230 }
| int ast_app_group_discard | ( | struct ast_channel * | chan | ) |
Discard all group counting for a channel
Definition at line 1134 of file app.c.
References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_group_info::chan, free, and list.
Referenced by ast_channel_free().
01135 { 01136 struct ast_group_info *gi = NULL; 01137 01138 AST_LIST_LOCK(&groups); 01139 AST_LIST_TRAVERSE_SAFE_BEGIN(&groups, gi, list) { 01140 if (gi->chan == chan) { 01141 AST_LIST_REMOVE_CURRENT(&groups, list); 01142 free(gi); 01143 } 01144 } 01145 AST_LIST_TRAVERSE_SAFE_END 01146 AST_LIST_UNLOCK(&groups); 01147 01148 return 0; 01149 }
| int ast_app_group_get_count | ( | char * | group, | |
| char * | category | |||
| ) |
Get the current channel count of the specified group and category.
Definition at line 1077 of file app.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero(), ast_group_info::category, ast_group_info::group, and list.
Referenced by group_check_exec(), group_count_exec(), and group_count_function_read().
01078 { 01079 struct ast_group_info *gi = NULL; 01080 int count = 0; 01081 01082 if (ast_strlen_zero(group)) 01083 return 0; 01084 01085 AST_LIST_LOCK(&groups); 01086 AST_LIST_TRAVERSE(&groups, gi, list) { 01087 if (!strcasecmp(gi->group, group) && (ast_strlen_zero(category) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category)))) 01088 count++; 01089 } 01090 AST_LIST_UNLOCK(&groups); 01091 01092 return count; 01093 }
| struct ast_group_info* ast_app_group_list_head | ( | void | ) |
Get the head of the group count list
Definition at line 1156 of file app.c.
References AST_LIST_FIRST.
Referenced by group_function_read(), group_list_function_read(), and group_show_channels().
01157 { 01158 return AST_LIST_FIRST(&groups); 01159 }
| int ast_app_group_list_lock | ( | void | ) |
Lock the group count list
Definition at line 1151 of file app.c.
References AST_LIST_LOCK.
Referenced by group_function_read(), group_list_function_read(), and group_show_channels().
01152 { 01153 return AST_LIST_LOCK(&groups); 01154 }
| int ast_app_group_list_unlock | ( | void | ) |
Unlock the group count list
Definition at line 1161 of file app.c.
References AST_LIST_UNLOCK.
Referenced by group_function_read(), group_list_function_read(), and group_show_channels().
01162 { 01163 return AST_LIST_UNLOCK(&groups); 01164 }
| int ast_app_group_match_get_count | ( | char * | groupmatch, | |
| char * | category | |||
| ) |
Get the current channel count of all groups that match the specified pattern and category.
Definition at line 1095 of file app.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero(), ast_group_info::category, ast_group_info::group, and list.
Referenced by group_match_count_exec(), and group_match_count_function_read().
01096 { 01097 struct ast_group_info *gi = NULL; 01098 regex_t regexbuf; 01099 int count = 0; 01100 01101 if (ast_strlen_zero(groupmatch)) 01102 return 0; 01103 01104 /* if regex compilation fails, return zero matches */ 01105 if (regcomp(®exbuf, groupmatch, REG_EXTENDED | REG_NOSUB)) 01106 return 0; 01107 01108 AST_LIST_LOCK(&groups); 01109 AST_LIST_TRAVERSE(&groups, gi, list) { 01110 if (!regexec(®exbuf, gi->group, 0, NULL, 0) && (ast_strlen_zero(category) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category)))) 01111 count++; 01112 } 01113 AST_LIST_UNLOCK(&groups); 01114 01115 regfree(®exbuf); 01116 01117 return count; 01118 }
| int ast_app_group_set_channel | ( | struct ast_channel * | chan, | |
| char * | data | |||
| ) |
Set the group for a channel, splitting the provided data into group and category, if specified.
Definition at line 1034 of file app.c.
References ast_app_group_split_group(), AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_strlen_zero(), calloc, ast_group_info::category, ast_group_info::chan, free, ast_group_info::group, group, and list.
Referenced by dial_exec_full(), group_function_write(), and group_set_exec().
01035 { 01036 int res = 0; 01037 char group[80] = "", category[80] = ""; 01038 struct ast_group_info *gi = NULL; 01039 size_t len = 0; 01040 01041 if (ast_app_group_split_group(data, group, sizeof(group), category, sizeof(category))) 01042 return -1; 01043 01044 /* Calculate memory we will need if this is new */ 01045 len = sizeof(*gi) + strlen(group) + 1; 01046 if (!ast_strlen_zero(category)) 01047 len += strlen(category) + 1; 01048 01049 AST_LIST_LOCK(&groups); 01050 AST_LIST_TRAVERSE_SAFE_BEGIN(&groups, gi, list) { 01051 if ((gi->chan == chan) && ((ast_strlen_zero(category) && ast_strlen_zero(gi->category)) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category)))) { 01052 AST_LIST_REMOVE_CURRENT(&groups, list); 01053 free(gi); 01054 break; 01055 } 01056 } 01057 AST_LIST_TRAVERSE_SAFE_END 01058 01059 if ((gi = calloc(1, len))) { 01060 gi->chan = chan; 01061 gi->group = (char *) gi + sizeof(*gi); 01062 strcpy(gi->group, group); 01063 if (!ast_strlen_zero(category)) { 01064 gi->category = (char *) gi + sizeof(*gi) + strlen(group) + 1; 01065 strcpy(gi->category, category); 01066 } 01067 AST_LIST_INSERT_TAIL(&groups, gi, list); 01068 } else { 01069 res = -1; 01070 } 01071 01072 AST_LIST_UNLOCK(&groups); 01073 01074 return res; 01075 }
| int ast_app_group_split_group | ( | char * | data, | |
| char * | group, | |||
| int | group_max, | |||
| char * | category, | |||
| int | category_max | |||
| ) |
Split a group string into group and category, returning a default category if none is provided.
Definition at line 1007 of file app.c.
References ast_strlen_zero().
Referenced by ast_app_group_set_channel(), group_check_exec(), group_count_exec(), group_count_function_read(), group_match_count_exec(), and group_match_count_function_read().
01008 { 01009 int res=0; 01010 char tmp[256]; 01011 char *grp=NULL, *cat=NULL; 01012 01013 if (!ast_strlen_zero(data)) { 01014 ast_copy_string(tmp, data, sizeof(tmp)); 01015 grp = tmp; 01016 cat = strchr(tmp, '@'); 01017 if (cat) { 01018 *cat = '\0'; 01019 cat++; 01020 } 01021 } 01022 01023 if (!ast_strlen_zero(grp)) 01024 ast_copy_string(group, grp, group_max); 01025 else 01026 res = -1; 01027 01028 if (!ast_strlen_zero(cat)) 01029 ast_copy_string(category, cat, category_max); 01030 01031 return res; 01032 }
| int ast_app_group_update | ( | struct ast_channel * | oldchan, | |
| struct ast_channel * | newchan | |||
| ) |
Update all group counting for a channel to a new one
Definition at line 1120 of file app.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_group_info::chan, and list.
01121 { 01122 struct ast_group_info *gi = NULL; 01123 01124 AST_LIST_LOCK(&groups); 01125 AST_LIST_TRAVERSE(&groups, gi, list) { 01126 if (gi->chan == old) 01127 gi->chan = new; 01128 } 01129 AST_LIST_UNLOCK(&groups); 01130 01131 return 0; 01132 }
| int ast_app_has_voicemail | ( | const char * | mailbox, | |
| const char * | folder | |||
| ) |
Determine if a given mailbox has any voicemail
Definition at line 248 of file app.c.
References ast_has_voicemail_func, ast_verbose(), option_verbose, and VERBOSE_PREFIX_3.
Referenced by action_mailboxstatus(), do_monitor(), has_voicemail(), notify_new_message(), play_dialtone(), and update_registry().
00249 { 00250 static int warned = 0; 00251 if (ast_has_voicemail_func) 00252 return ast_has_voicemail_func(mailbox, folder); 00253 00254 if ((option_verbose > 2) && !warned) { 00255 ast_verbose(VERBOSE_PREFIX_3 "Message check requested for mailbox %s/folder %s but voicemail not loaded.\n", mailbox, folder ? folder : "INBOX"); 00256 warned++; 00257 } 00258 return 0; 00259 }
| int ast_app_messagecount | ( | const char * | mailbox, | |
| int * | newmsgs, | |||
| int * | oldmsgs | |||
| ) |
Determine number of new/old messages in a mailbox
Definition at line 262 of file