Application convenience functions, designed to give consistent look and feel to Asterisk apps. More...
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_app_stack_funcs |
Stack applications callback functions. More... | |
struct | ast_ivr_menu |
struct | ast_ivr_option |
Macros | |
#define | AST_APP_ARG(name) char *name |
Define an application argument. More... | |
#define | AST_APP_OPTION(option, flagno) [option] = { .flag = flagno } |
Declares an application option that does not accept an argument. More... | |
#define | AST_APP_OPTION_ARG(option, flagno, argno) [option] = { .flag = flagno, .arg_index = argno + 1 } |
Declares an application option that accepts an argument. More... | |
#define | AST_APP_OPTIONS(holder, options...) static const struct ast_app_option holder[128] = options |
Declares an array of options for an application. More... | |
#define | ast_app_separate_args(a, b, c, d) __ast_app_separate_args(a,b,1,c,d) |
#define | AST_DECLARE_APP_ARGS(name, arglist) AST_DEFINE_APP_ARGS_TYPE(, arglist) name = { 0, } |
Declare a structure to hold an application's arguments. More... | |
#define | AST_DEFINE_APP_ARGS_TYPE(type, arglist) |
Define a structure type to hold an application's arguments. More... | |
#define | AST_IVR_DECLARE_MENU(holder, title, flags, foo...) |
#define | AST_IVR_FLAG_AUTORESTART (1 << 0) |
#define | AST_NONSTANDARD_APP_ARGS(args, parse, sep) args.argc = __ast_app_separate_args(parse, sep, 1, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0]))) |
Performs the 'nonstandard' argument separation process for an application. More... | |
#define | AST_NONSTANDARD_RAW_ARGS(args, parse, sep) args.argc = __ast_app_separate_args(parse, sep, 0, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0]))) |
#define | AST_STANDARD_APP_ARGS(args, parse) args.argc = __ast_app_separate_args(parse, ',', 1, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0]))) |
Performs the 'standard' argument separation process for an application. More... | |
#define | AST_STANDARD_RAW_ARGS(args, parse) args.argc = __ast_app_separate_args(parse, ',', 0, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0]))) |
#define | BEGIN_OPTIONS { |
#define | END_OPTIONS } |
Typedefs | |
typedef int(* | ast_ivr_callback )(struct ast_channel *chan, char *option, void *cbdata) |
Callback function for IVR. More... | |
Enumerations | |
enum | ast_getdata_result { AST_GETDATA_FAILED = -1, AST_GETDATA_COMPLETE = 0, AST_GETDATA_TIMEOUT = 1, AST_GETDATA_INTERRUPTED = 2, AST_GETDATA_EMPTY_END_TERMINATED = 3 } |
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 } |
enum | AST_LOCK_TYPE { AST_LOCK_TYPE_LOCKFILE = 0, AST_LOCK_TYPE_FLOCK = 1 } |
Type of locking to use in ast_lock_path / ast_unlock_path. More... | |
enum | ast_timelen { TIMELEN_HOURS, TIMELEN_MINUTES, TIMELEN_SECONDS, TIMELEN_MILLISECONDS } |
Functions | |
unsigned int | __ast_app_separate_args (char *buf, char delim, int remove_chars, char **array, int arraylen) |
Separate a string into arguments in an array. More... | |
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. More... | |
int | ast_app_exec_macro (struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char *macro_args) |
Run a macro on a channel, placing an optional second channel into autoservice. More... | |
int | ast_app_exec_sub (struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_args, int ignore_hangup) |
Run a subroutine on a channel, placing an optional second channel into autoservice. More... | |
const char * | ast_app_expand_sub_args (struct ast_channel *chan, const char *args) |
Add missing context/exten to subroutine argument string. More... | |
int | ast_app_getdata (struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout) |
Plays a stream and gets DTMF data from a channel. More... | |
int | ast_app_getdata_full (struct ast_channel *c, const 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. More... | |
int | ast_app_group_discard (struct ast_channel *chan) |
Discard all group counting for a channel. More... | |
int | ast_app_group_get_count (const char *group, const char *category) |
Get the current channel count of the specified group and category. More... | |
struct ast_group_info * | ast_app_group_list_head (void) |
Get the head of the group count list. More... | |
int | ast_app_group_list_rdlock (void) |
Read Lock the group count list. More... | |
int | ast_app_group_list_unlock (void) |
Unlock the group count list. More... | |
int | ast_app_group_list_wrlock (void) |
Write Lock the group count list. More... | |
int | ast_app_group_match_get_count (const char *groupmatch, const char *category) |
Get the current channel count of all groups that match the specified pattern and category. More... | |
int | ast_app_group_set_channel (struct ast_channel *chan, const char *data) |
Set the group for a channel, splitting the provided data into group and category, if specified. More... | |
int | ast_app_group_split_group (const 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. More... | |
int | ast_app_group_update (struct ast_channel *oldchan, struct ast_channel *newchan) |
Update all group counting for a channel to a new one. More... | |
int | ast_app_has_voicemail (const char *mailbox, const char *folder) |
Determine if a given mailbox has any voicemail If folder is NULL, defaults to "INBOX". If folder is "INBOX", includes the number of messages in the "Urgent" folder. More... | |
int | ast_app_inboxcount (const char *mailbox, int *newmsgs, int *oldmsgs) |
Determine number of new/old messages in a mailbox. More... | |
int | ast_app_inboxcount2 (const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) |
Determine number of urgent/new/old messages in a mailbox. More... | |
int | ast_app_messagecount (const char *context, const char *mailbox, const char *folder) |
Check number of messages in a given context, mailbox, and folder. More... | |
void | ast_app_options2str64 (const struct ast_app_option *options, struct ast_flags64 *flags, char *buf, size_t len) |
Given a list of options array, return an option string based on passed flags. More... | |
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. More... | |
int | ast_app_parse_options64 (const struct ast_app_option *options, struct ast_flags64 *flags, char **args, char *optstr) |
Parses a string containing application options and sets flags/arguments. More... | |
int | ast_app_parse_timelen (const char *timestr, int *result, enum ast_timelen defunit) |
Common routine to parse time lengths, with optional time unit specifier. More... | |
int | ast_app_run_macro (struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char *macro_name, const char *macro_args) |
Run a macro on a channel, placing an optional second channel into autoservice. More... | |
int | ast_app_run_sub (struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_location, const char *sub_args, int ignore_hangup) |
Run a subroutine on a channel, placing an optional second channel into autoservice. More... | |
int | ast_app_sayname (struct ast_channel *chan, const char *mailbox, const char *context) |
Given a mailbox and context, play that mailbox owner's name to the channel specified. More... | |
void | ast_close_fds_above_n (int n) |
Common routine for child processes, to close all fds prior to exec(2) More... | |
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, long *offsetms) |
Stream a file with fast forward, pause, reverse, restart. More... | |
int | ast_dtmf_stream (struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration) |
Send DTMF to a channel. More... | |
int | ast_get_encoded_char (const char *stream, char *result, size_t *consumed) |
Decode an encoded control or extended ASCII character. More... | |
char * | ast_get_encoded_str (const char *stream, char *result, size_t result_len) |
Decode a stream of encoded control or extended ASCII characters. More... | |
void | ast_install_stack_functions (const struct ast_app_stack_funcs *funcs) |
Set stack application function callbacks. More... | |
void | ast_install_vm_functions (int(*has_voicemail_func)(const char *mailbox, const char *folder), int(*inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs), int(*inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs), int(*messagecount_func)(const char *context, const char *mailbox, const char *folder), int(*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context)) |
Set voicemail function callbacks. More... | |
int | ast_ivr_menu_run (struct ast_channel *c, struct ast_ivr_menu *menu, void *cbdata) |
Runs an IVR menu. More... | |
int | ast_linear_stream (struct ast_channel *chan, const char *filename, int fd, int allowoverride) |
Stream a filename (or file descriptor) as a generator. More... | |
enum AST_LOCK_RESULT | ast_lock_path (const char *path) |
Lock a filesystem path. More... | |
int | ast_play_and_prepend (struct ast_channel *chan, char *playfile, char *recordfile, int maxtime_sec, char *fmt, int *duration, int *sound_duration, int beep, int silencethreshold, int maxsilence_ms) |
Record a file based on input frm a channel. Recording is performed in 'prepend' mode which works a little differently from normal recordings This function will not play a success message due to post-recording control in the application this was added for. More... | |
int | ast_play_and_record (struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime_sec, const char *fmt, int *duration, int *sound_duration, int silencethreshold, int maxsilence_ms, const char *path) |
Record a file based on input from a channel. Use default accept and cancel DTMF. This function will play "auth-thankyou" upon successful recording. More... | |
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 *sound_duration, int silencethreshold, int maxsilence_ms, const char *path, const char *acceptdtmf, const char *canceldtmf) |
Record a file based on input from a channel This function will play "auth-thankyou" upon successful recording. More... | |
int | ast_play_and_wait (struct ast_channel *chan, const char *fn) |
Play a stream and wait for a digit, returning the digit that was pressed. More... | |
char * | ast_read_textfile (const char *file) |
Read a file into asterisk. More... | |
int | ast_record_review (struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path) |
Allow to record message and have a review option. More... | |
void | ast_replace_sigchld (void) |
Replace the SIGCHLD handler. More... | |
int | ast_safe_fork (int stop_reaper) |
Common routine to safely fork without a chance of a signal handler firing badly in the child. More... | |
void | ast_safe_fork_cleanup (void) |
Common routine to cleanup after fork'ed process is complete (if reaping was stopped) More... | |
int | ast_safe_system (const char *s) |
Safely spawn an external program while closing file descriptors. More... | |
void | ast_set_lock_type (enum AST_LOCK_TYPE type) |
Set the type of locks used by ast_lock_path() More... | |
int | ast_str_get_encoded_str (struct ast_str **str, int maxlen, const char *stream) |
Decode a stream of encoded control or extended ASCII characters. More... | |
AST_THREADSTORAGE_EXTERNAL (ast_str_thread_global_buf) | |
void | ast_uninstall_vm_functions (void) |
int | ast_unlock_path (const char *path) |
Unlock a path. More... | |
void | ast_unreplace_sigchld (void) |
Restore the SIGCHLD handler. More... | |
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
Definition in file app.h.
Define an application argument.
name | The name of the argument |
Definition at line 555 of file app.h.
Referenced by acf_curl_helper(), acf_if(), acf_isexten_exec(), acf_jabberreceive_read(), acf_jabberstatus_read(), acf_mailbox_exists(), acf_meetme_info(), acf_odbc_read(), acf_odbc_write(), acf_rand_exec(), acf_sprintf(), acf_strftime(), acf_strptime(), acf_transaction_read(), acf_transaction_write(), acf_version_exec(), acf_vmcount_exec(), action_status(), add_agent(), admin_exec(), aelsub_exec(), aes_helper(), agi_exec_full(), aji_join_exec(), aji_leave_exec(), aji_send_exec(), aji_sendgroup_exec(), aji_status_exec(), app_exec(), aqm_exec(), array(), ast_eivr_senddtmf(), ast_queue_log(), asyncgoto_exec(), auth_exec(), background_detect_exec(), bridge_exec(), calendar_query_exec(), calendar_query_result_exec(), calendar_write_exec(), callerid_read(), cdr_read(), cdr_write(), celgenuserevent_exec(), chanavail_exec(), channel_admin_exec(), chanspy_exec(), cli_odbc_read(), cli_odbc_write(), conf_exec(), confbridge_exec(), config_function_read(), controlplayback_exec(), count_exec(), create_addr(), cut_internal(), dahdi_accept_r2_call_exec(), dahdi_send_callrerouting_facility_exec(), determine_starting_point(), dial_exec_full(), dialgroup_write(), dictate_exec(), directory_exec(), disa_exec(), dundi_query_read(), dundi_result_read(), dundifunc_read(), enable_jack_hook(), enum_query_read(), enum_result_read(), execif_exec(), extenspy_exec(), festival_exec(), file_count_line(), file_read(), file_write(), filter(), find_conf(), find_realtime_gw(), find_table_cb(), forkcdr_exec(), func_header_read(), function_agent(), function_db_delete(), function_db_exists(), function_db_read(), function_db_write(), function_enum(), function_fieldnum_helper(), function_fieldqty_helper(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), function_txtcidname(), gosub_exec(), gosubif_exec(), hash_read(), hash_write(), hint_read(), iconv_read(), import_helper(), init_acf_query(), isAnsweringMachine(), isexten_function_read(), listfilter(), load_values_config(), log_exec(), login_exec(), man_do_variable_value(), math(), misdn_call(), misdn_check_l2l1(), misdn_facility_exec(), misdn_request(), mixmonitor_exec(), my_pri_make_cc_dialstring(), originate_exec(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_call(), oss_request(), page_exec(), parkandannounce_exec(), parked_call_exec(), pbx_builtin_answer(), pbx_builtin_background(), pbx_builtin_saydate(), pbx_builtin_saytime(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), peek_read(), pickupchan_exec(), play_moh_exec(), playback_exec(), pqm_exec(), privacy_exec(), process_applicationmap_line(), ql_exec(), queue_exec(), queue_function_memberpenalty_read(), queue_function_memberpenalty_write(), queue_function_queuememberpaused(), queue_function_queuememberstatus(), rcvfax_exec(), read_exec(), readexten_exec(), realtimefield_read(), receivefax_exec(), record_exec(), reg_source_db(), regex(), reload_single_member(), replace(), retrydial_exec(), rqm_exec(), saycountedadj_exec(), saycountednoun_exec(), sayunixtime_exec(), senddtmf_exec(), sendfax_exec(), sendurl_exec(), shared_read(), shared_write(), shift_pop(), sig_pri_call(), sig_pri_extract_called_num_subaddr(), sip_acf_channel_read(), sip_parse_register_line(), sip_request_call(), sla_trunk_exec(), smdi_msg_read(), smdi_msg_retrieve_read(), sms_exec(), sndfax_exec(), softhangup_exec(), speech_background(), speech_load(), srv_result_read(), stackpeek_read(), start_moh_exec(), start_monitor_exec(), transfer_exec(), unshift_push(), upqm_exec(), userevent_exec(), verbose_exec(), vm_box_exists(), vm_check_password_shell(), vm_exec(), vm_execmain(), volume_write(), and zapateller_exec().
#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 |
This macro declares a 'static const' array of 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:
#define ast_app_separate_args | ( | a, | |
b, | |||
c, | |||
d | |||
) | __ast_app_separate_args(a,b,1,c,d) |
#define AST_DECLARE_APP_ARGS | ( | name, | |
arglist | |||
) | AST_DEFINE_APP_ARGS_TYPE(, arglist) name = { 0, } |
Declare a structure to hold an application's arguments.
name | The name of the structure |
arglist | The list of arguments, defined using AST_APP_ARG |
This macro declares a structure intended to be used in a call to ast_app_separate_args(). The structure includes all the arguments specified, plus an argv array that overlays them and an argc argument counter. The arguments must be declared using AST_APP_ARG, and they will all be character pointers (strings).
Definition at line 572 of file app.h.
Referenced by acf_curl_helper(), acf_if(), acf_isexten_exec(), acf_jabberreceive_read(), acf_jabberstatus_read(), acf_mailbox_exists(), acf_meetme_info(), acf_odbc_read(), acf_odbc_write(), acf_rand_exec(), acf_sprintf(), acf_strftime(), acf_strptime(), acf_transaction_read(), acf_transaction_write(), acf_version_exec(), acf_vmcount_exec(), action_status(), add_agent(), admin_exec(), aelsub_exec(), aes_helper(), agi_exec_full(), aji_join_exec(), aji_leave_exec(), aji_send_exec(), aji_sendgroup_exec(), aji_status_exec(), app_exec(), aqm_exec(), array(), ast_eivr_senddtmf(), ast_queue_log(), asyncgoto_exec(), auth_exec(), background_detect_exec(), bridge_exec(), calendar_query_exec(), calendar_query_result_exec(), calendar_write_exec(), callerid_read(), cdr_read(), cdr_write(), celgenuserevent_exec(), chanavail_exec(), channel_admin_exec(), chanspy_exec(), cli_odbc_read(), cli_odbc_write(), conf_exec(), confbridge_exec(), config_function_read(), controlplayback_exec(), count_exec(), create_addr(), cut_internal(), dahdi_accept_r2_call_exec(), dahdi_send_callrerouting_facility_exec(), determine_starting_point(), dial_exec_full(), dialgroup_write(), dictate_exec(), directory_exec(), disa_exec(), dundi_query_read(), dundi_result_read(), dundifunc_read(), enable_jack_hook(), enum_query_read(), enum_result_read(), execif_exec(), extenspy_exec(), festival_exec(), file_count_line(), file_read(), file_write(), filter(), find_conf(), find_realtime_gw(), find_table_cb(), forkcdr_exec(), func_header_read(), function_agent(), function_db_delete(), function_db_exists(), function_db_read(), function_db_write(), function_enum(), function_fieldnum_helper(), function_fieldqty_helper(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), function_txtcidname(), gosub_exec(), gosubif_exec(), hash_read(), hash_write(), hint_read(), iconv_read(), import_helper(), init_acf_query(), isAnsweringMachine(), isexten_function_read(), listfilter(), load_values_config(), log_exec(), login_exec(), man_do_variable_value(), math(), misdn_call(), misdn_check_l2l1(), misdn_facility_exec(), misdn_request(), mixmonitor_exec(), my_pri_make_cc_dialstring(), originate_exec(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_call(), oss_request(), page_exec(), parkandannounce_exec(), parked_call_exec(), pbx_builtin_answer(), pbx_builtin_background(), pbx_builtin_saydate(), pbx_builtin_saytime(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), peek_read(), pickupchan_exec(), play_moh_exec(), playback_exec(), pqm_exec(), privacy_exec(), process_applicationmap_line(), ql_exec(), queue_exec(), queue_function_memberpenalty_read(), queue_function_memberpenalty_write(), queue_function_queuememberpaused(), queue_function_queuememberstatus(), rcvfax_exec(), read_exec(), readexten_exec(), realtimefield_read(), receivefax_exec(), record_exec(), reg_source_db(), regex(), reload_single_member(), replace(), retrydial_exec(), rqm_exec(), saycountedadj_exec(), saycountednoun_exec(), sayunixtime_exec(), senddtmf_exec(), sendfax_exec(), sendurl_exec(), shared_read(), shared_write(), shift_pop(), sig_pri_call(), sig_pri_extract_called_num_subaddr(), sip_acf_channel_read(), sip_parse_register_line(), sip_request_call(), sla_trunk_exec(), smdi_msg_read(), smdi_msg_retrieve_read(), sms_exec(), sndfax_exec(), softhangup_exec(), speech_background(), speech_load(), srv_result_read(), stackpeek_read(), start_moh_exec(), start_monitor_exec(), transfer_exec(), unshift_push(), upqm_exec(), userevent_exec(), verbose_exec(), vm_box_exists(), vm_check_password_shell(), vm_exec(), vm_execmain(), volume_write(), and zapateller_exec().
#define AST_DEFINE_APP_ARGS_TYPE | ( | type, | |
arglist | |||
) |
Define a structure type to hold an application's arguments.
type | The name of the structure type |
arglist | The list of arguments, defined using AST_APP_ARG |
This macro defines a structure type intended to be used in a call to ast_app_separate_args(). The structure includes all the arguments specified, plus an argv array that overlays them and an argc argument counter. The arguments must be declared using AST_APP_ARG, and they will all be character pointers (strings).
#define AST_IVR_DECLARE_MENU | ( | holder, | |
title, | |||
flags, | |||
foo... | |||
) |
#define AST_NONSTANDARD_APP_ARGS | ( | args, | |
parse, | |||
sep | |||
) | args.argc = __ast_app_separate_args(parse, sep, 1, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0]))) |
Performs the 'nonstandard' 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 |
sep | A nonstandard separator character |
This function will separate the input string using the nonstandard argument separator character and fill in the provided structure, including the argc argument counter field.
Definition at line 619 of file app.h.
Referenced by acf_if(), acf_jabberreceive_read(), acf_jabberstatus_read(), acf_mailbox_exists(), aji_status_exec(), ast_queue_log(), callerid_read(), callerid_write(), connectedline_read(), connectedline_write(), determine_starting_point(), dialgroup_write(), function_agent(), function_db_delete(), function_db_exists(), function_db_read(), function_db_write(), misdn_call(), misdn_request(), my_pri_make_cc_dialstring(), oss_call(), oss_request(), pbx_builtin_setvar_multiple(), record_exec(), redirecting_read(), redirecting_write(), regex(), sig_pri_call(), sig_pri_extract_called_num_subaddr(), sip_request_call(), and vm_check_password_shell().
#define AST_NONSTANDARD_RAW_ARGS | ( | args, | |
parse, | |||
sep | |||
) | args.argc = __ast_app_separate_args(parse, sep, 0, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0]))) |
Definition at line 621 of file app.h.
Referenced by create_addr(), execif_exec(), gosubif_exec(), reg_source_db(), and sip_parse_register_line().
#define AST_STANDARD_APP_ARGS | ( | args, | |
parse | |||
) | args.argc = __ast_app_separate_args(parse, ',', 1, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / 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 |
This function will separate the input string using the standard argument separator character ',' and fill in the provided structure, including the argc argument counter field.
Definition at line 604 of file app.h.
Referenced by acf_curl_helper(), acf_isexten_exec(), acf_jabberreceive_read(), acf_jabberstatus_read(), acf_meetme_info(), acf_odbc_read(), acf_odbc_write(), acf_rand_exec(), acf_sprintf(), acf_strftime(), acf_strptime(), acf_transaction_read(), acf_transaction_write(), acf_version_exec(), acf_vmcount_exec(), action_status(), add_agent(), admin_exec(), aes_helper(), agi_exec_full(), aji_join_exec(), aji_leave_exec(), aji_send_exec(), aji_sendgroup_exec(), aji_status_exec(), app_exec(), aqm_exec(), array(), ast_eivr_senddtmf(), ast_masq_park_call_exten(), ast_park_call_exten(), asyncgoto_exec(), auth_exec(), background_detect_exec(), bridge_exec(), calendar_query_exec(), calendar_query_result_exec(), calendar_write_exec(), callerid_read(), callerid_write(), cdr_read(), cdr_write(), celgenuserevent_exec(), chanavail_exec(), channel_admin_exec(), chanspy_exec(), cli_odbc_read(), cli_odbc_write(), conf_exec(), confbridge_exec(), config_function_read(), connectedline_write(), controlplayback_exec(), count_exec(), cut_internal(), dahdi_accept_r2_call_exec(), dahdi_send_callrerouting_facility_exec(), dial_exec_full(), dialgroup_write(), dictate_exec(), directory_exec(), disa_exec(), dundi_query_read(), dundi_result_read(), dundifunc_read(), enable_jack_hook(), enum_query_read(), enum_result_read(), execif_exec(), extenspy_exec(), festival_exec(), file_count_line(), file_read(), file_write(), find_conf(), find_realtime_gw(), find_table_cb(), forkcdr_exec(), func_header_read(), function_enum(), function_fieldnum_helper(), function_fieldqty_helper(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), function_txtcidname(), hash_read(), hash_write(), hint_read(), iconv_read(), import_helper(), init_acf_query(), isAnsweringMachine(), isexten_function_read(), listfilter(), log_exec(), login_exec(), man_do_variable_value(), math(), misdn_check_l2l1(), misdn_facility_exec(), mixmonitor_exec(), originate_exec(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), page_exec(), park_call_exec(), parkandannounce_exec(), parked_call_exec(), pbx_builtin_answer(), pbx_builtin_background(), pbx_builtin_saydate(), pbx_builtin_saytime(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), pickupchan_exec(), play_moh_exec(), playback_exec(), pqm_exec(), privacy_exec(), process_applicationmap_line(), ql_exec(), queue_exec(), queue_function_memberpenalty_read(), queue_function_memberpenalty_write(), queue_function_queuememberpaused(), queue_function_queuememberstatus(), rcvfax_exec(), read_exec(), readexten_exec(), realtimefield_read(), receivefax_exec(), record_exec(), redirecting_write(), reload_single_member(), replace(), retrydial_exec(), rqm_exec(), saycountedadj_exec(), saycountednoun_exec(), sayunixtime_exec(), senddtmf_exec(), sendfax_exec(), sendurl_exec(), shared_read(), shared_write(), shift_pop(), sip_acf_channel_read(), sla_trunk_exec(), smdi_msg_read(), smdi_msg_retrieve_read(), sms_exec(), sndfax_exec(), softhangup_exec(), speech_background(), speech_load(), srv_result_read(), stackpeek_read(), start_moh_exec(), start_monitor_exec(), transfer_exec(), unshift_push(), upqm_exec(), userevent_exec(), verbose_exec(), vm_box_exists(), vm_exec(), vm_execmain(), volume_write(), xfer_park_call_helper(), and zapateller_exec().
#define AST_STANDARD_RAW_ARGS | ( | args, | |
parse | |||
) | args.argc = __ast_app_separate_args(parse, ',', 0, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0]))) |
Definition at line 606 of file app.h.
Referenced by aelsub_exec(), filter(), gosub_exec(), load_values_config(), and peek_read().
typedef int(* ast_ivr_callback)(struct ast_channel *chan, char *option, void *cbdata) |
enum ast_getdata_result |
enum ast_ivr_action |
Enumerator | |
---|---|
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 [@context] |
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 44 of file app.h.
enum AST_LOCK_RESULT |
enum AST_LOCK_TYPE |
enum ast_timelen |
unsigned int __ast_app_separate_args | ( | char * | buf, |
char | delim, | ||
int | remove_chars, | ||
char ** | array, | ||
int | arraylen | ||
) |
Separate a string into arguments in an array.
buf | The string to be parsed (this must be a writable copy, as it will be modified) |
delim | The character to be used to delimit arguments |
remove_chars | Remove backslashes and quote characters, while parsing |
array | An array of 'char *' to be filled in with pointers to the found arguments |
arraylen | The number of elements in the array (i.e. the number of arguments you will accept) |
Note: if there are more arguments in the string than the array will hold, the last element of the array will contain the remaining arguments, not separated.
The array will be completely zeroed by this function before it populates any entries.
Definition at line 1388 of file app.c.
References paren, and quote().
Referenced by ast_app_separate_args().
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.
\return Returns 1 on valid extension entered, -1 on hangup, or 0 on invalid extension.
Present a dialtone and collect a certain length extension.
chan | struct. |
context | |
collect | |
size | |
maxlen | |
timeout | timeout in milliseconds |
Definition at line 120 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_tone_zone_sound_unref(), ast_waitfordigit(), ast_channel::caller, ast_tone_zone_sound::data, ast_pbx::dtimeoutms, ast_party_caller::id, LOG_NOTICE, ast_party_id::number, ast_channel::pbx, S_COR, ast_party_number::str, ast_party_number::valid, and ast_channel::zone.
Referenced by builtin_atxfer(), builtin_blindtransfer(), and grab_transfer().
int ast_app_exec_macro | ( | struct ast_channel * | autoservice_chan, |
struct ast_channel * | macro_chan, | ||
const char * | macro_args | ||
) |
Run a macro on a channel, placing an optional second channel into autoservice.
This is a shorthand method that makes it very easy to run a macro on any given channel. It is perfectly reasonable to supply a NULL autoservice_chan here in case there is no channel to place into autoservice.
autoservice_chan | A channel to place into autoservice while the macro is run |
macro_chan | Channel to execute macro on. |
macro_args | Macro application argument string. |
0 | success |
-1 | on error |
Definition at line 254 of file app.c.
References ast_autoservice_start(), ast_autoservice_stop(), ast_debug, ast_log(), ast_channel::context, ast_channel::exten, LOG_WARNING, ast_channel::name, pbx_exec(), pbx_findapp(), and ast_channel::priority.
Referenced by ast_app_run_macro(), and feature_exec_app().
int ast_app_exec_sub | ( | struct ast_channel * | autoservice_chan, |
struct ast_channel * | sub_chan, | ||
const char * | sub_args, | ||
int | ignore_hangup | ||
) |
Run a subroutine on a channel, placing an optional second channel into autoservice.
This is a shorthand method that makes it very easy to run a subroutine on any given channel. It is perfectly reasonable to supply a NULL autoservice_chan here in case there is no channel to place into autoservice.
autoservice_chan | A channel to place into autoservice while the subroutine is run |
sub_chan | Channel to execute subroutine on. |
sub_args | Gosub application argument string. |
ignore_hangup | TRUE if a hangup does not stop execution of the routine. |
0 | success |
-1 | on error |
Definition at line 343 of file app.c.
References app_stack_callbacks, ast_autoservice_start(), ast_autoservice_stop(), ast_log(), ast_module_ref(), ast_module_unref(), LOG_WARNING, ast_app_stack_funcs::module, and ast_app_stack_funcs::run_sub.
Referenced by ast_app_run_sub(), and feature_exec_app().
const char* ast_app_expand_sub_args | ( | struct ast_channel * | chan, |
const char * | args | ||
) |
Add missing context/exten to subroutine argument string.
chan | Channel to obtain context/exten. |
args | Gosub application argument string. |
Fills in the optional context and exten from the given channel.
New-args | Gosub argument string on success. Must be freed. |
NULL | on error. |
Definition at line 324 of file app.c.
References app_stack_callbacks, ast_log(), ast_module_ref(), ast_module_unref(), ast_app_stack_funcs::expand_sub_args, LOG_WARNING, and ast_app_stack_funcs::module.
int ast_app_getdata | ( | struct ast_channel * | c, |
const char * | prompt, | ||
char * | s, | ||
int | maxlen, | ||
int | timeout | ||
) |
Plays a stream and gets DTMF data from a channel.
c | Which channel one is interacting with |
prompt | File to pass to ast_streamfile (the one that you wish to play). It is also valid for this to be multiple files concatenated by "&". For example, "file1&file2&file3". |
s | The location where the DTMF data will be stored |
maxlen | Max Length of the data |
timeout | Timeout length waiting for data(in milliseconds). Set to 0 for standard timeout(six seconds), or -1 for no time out. |
This function was designed for application programmers for situations where they need to play a message and then get some DTMF data in response to the message. If a digit is pressed during playback, it will immediately break out of the message and continue execution of your code.
Plays a stream and gets DTMF data from a channel.
c | The channel to read from |
prompt | The file to stream to the channel |
s | The string to read in to. Must be at least the size of your length |
maxlen | How many digits to read (maximum) |
timeout | set timeout to 0 for "standard" timeouts. Set timeout to -1 for "ludicrous time" (essentially never times out) |
Definition at line 178 of file app.c.
References AST_GETDATA_EMPTY_END_TERMINATED, ast_readstring(), ast_strdupa, ast_streamfile(), ast_strlen_zero(), ast_pbx::dtimeoutms, ast_channel::language, ast_channel::pbx, ast_pbx::rtimeoutms, and strsep().
Referenced by auth_exec(), conf_exec(), dictate_exec(), find_conf(), login_exec(), read_exec(), testclient_exec(), testserver_exec(), and vm_exec().
int ast_app_getdata_full | ( | struct ast_channel * | c, |
const 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 231 of file app.c.
References ast_readstring_full(), ast_streamfile(), ast_strlen_zero(), and ast_channel::language.
Referenced by handle_getdata().
int ast_app_group_discard | ( | struct ast_channel * | chan | ) |
Discard all group counting for a channel.
Definition at line 1348 of file app.c.
References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_group_info::chan, and ast_group_info::group_list.
Referenced by ast_channel_destructor().
int ast_app_group_get_count | ( | const char * | group, |
const char * | category | ||
) |
Get the current channel count of the specified group and category.
Definition at line 1269 of file app.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strlen_zero(), ast_group_info::category, ast_group_info::group, and ast_group_info::group_list.
Referenced by group_count_function_read().
struct ast_group_info* ast_app_group_list_head | ( | void | ) |
Get the head of the group count list.
Definition at line 1375 of file app.c.
References AST_RWLIST_FIRST.
Referenced by group_count_function_read(), group_function_read(), group_list_function_read(), and group_show_channels().
int ast_app_group_list_rdlock | ( | void | ) |
Read Lock the group count list.
Definition at line 1370 of file app.c.
References AST_RWLIST_RDLOCK.
Referenced by group_count_function_read(), group_function_read(), group_list_function_read(), and group_show_channels().
int ast_app_group_list_unlock | ( | void | ) |
Unlock the group count list.
Definition at line 1380 of file app.c.
References AST_RWLIST_UNLOCK.
Referenced by group_count_function_read(), group_function_read(), group_list_function_read(), and group_show_channels().
int ast_app_group_list_wrlock | ( | void | ) |
Write Lock the group count list.
Definition at line 1365 of file app.c.
References AST_RWLIST_WRLOCK.
int ast_app_group_match_get_count | ( | const char * | groupmatch, |
const char * | category | ||
) |
Get the current channel count of all groups that match the specified pattern and category.
Definition at line 1289 of file app.c.
References ast_log(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strlen_zero(), ast_group_info::category, ast_group_info::group, ast_group_info::group_list, LOG_ERROR, and LOG_NOTICE.
Referenced by group_match_count_function_read().
int ast_app_group_set_channel | ( | struct ast_channel * | chan, |
const char * | data | ||
) |
Set the group for a channel, splitting the provided data into group and category, if specified.
Definition at line 1222 of file app.c.
References ast_app_group_split_group(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), calloc, ast_group_info::category, ast_group_info::chan, free, ast_group_info::group, ast_group_info::group_list, and len().
Referenced by dial_exec_full(), and group_function_write().
int ast_app_group_split_group | ( | const 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 1195 of file app.c.
References ast_copy_string(), and ast_strlen_zero().
Referenced by ast_app_group_set_channel(), group_count_function_read(), and group_match_count_function_read().
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 1329 of file app.c.
References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_group_info::chan, and ast_group_info::group_list.
Referenced by ast_do_masquerade(), and check_bridge().
int ast_app_has_voicemail | ( | const char * | mailbox, |
const char * | folder | ||
) |
Determine if a given mailbox has any voicemail If folder is NULL, defaults to "INBOX". If folder is "INBOX", includes the number of messages in the "Urgent" folder.
1 | Mailbox has voicemail |
0 | No new voicemail in specified mailbox |
-1 | Failure |
Definition at line 421 of file app.c.
References ast_has_voicemail_func, and ast_verb.
Referenced by action_mailboxstatus(), has_voicemail(), notify_new_message(), play_dialtone(), poll_mailbox(), run_externnotify(), skinny_register(), and unistim_send_mwi_to_peer().
int ast_app_inboxcount | ( | const char * | mailbox, |
int * | newmsgs, | ||
int * | oldmsgs | ||
) |
Determine number of new/old messages in a mailbox.
[in] | mailbox | Mailbox specification in the format mbox[][&mbox2[]][...] |
[out] | newmsgs | Number of messages in the "INBOX" folder. Includes number of messages in the "Urgent" folder, if any. |
[out] | oldmsgs | Number of messages in the "Old" folder. |
0 | Success |
-1 | Failure |
Definition at line 435 of file app.c.
References ast_inboxcount_func, and ast_verb.
Referenced by sip_send_mwi_to_peer(), and update_registry().
int ast_app_inboxcount2 | ( | const char * | mailbox, |
int * | urgentmsgs, | ||
int * | newmsgs, | ||
int * | oldmsgs | ||
) |
Determine number of urgent/new/old messages in a mailbox.
[in] | mailbox | the mailbox context to use |
[out] | urgentmsgs | the urgent message count |
[out] | newmsgs | the new message count |
[out] | oldmsgs | the old message count |
Definition at line 455 of file app.c.
References ast_inboxcount2_func, and ast_verb.
Referenced by action_mailboxcount(), notify_new_message(), and vm_execmain().
int ast_app_messagecount | ( | const char * | context, |
const char * | mailbox, | ||
const char * | folder | ||
) |
Check number of messages in a given context, mailbox, and folder.
[in] | context | Mailbox context |
[in] | mailbox | Mailbox number |
[in] | folder | Mailbox folder |
Definition at line 486 of file app.c.
References ast_messagecount_func, and ast_verb.
Referenced by acf_vmcount_exec().
void ast_app_options2str64 | ( | const struct ast_app_option * | options, |
struct ast_flags64 * | flags, | ||
char * | buf, | ||
size_t | len | ||
) |
Given a list of options array, return an option string based on passed flags.
options | The array of possible options declared with AST_APP_OPTIONS |
flags | The flags of the options that you wish to populate the buffer with |
buf | The buffer to fill with the string of options |
len | The maximum length of buf |
Definition at line 2111 of file app.c.
References ast_test_flag64, and len().
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.
options | The array of possible options declared with AST_APP_OPTIONS |
flags | The flag structure to have option flags set |
args | The array of argument pointers to hold arguments found |
optstr | The string containing the options to be parsed |
Definition at line 2101 of file app.c.
References parse_options().
Referenced by app_exec(), auth_exec(), bridge_exec(), cdr_read(), cdr_write(), chanspy_exec(), confbridge_exec(), connectedline_write(), controlplayback_exec(), directory_exec(), disa_exec(), dundi_query_read(), dundifunc_read(), extenspy_exec(), forkcdr_exec(), handle_options(), hint_read(), minivm_accmess_exec(), minivm_greet_exec(), minivm_record_exec(), mixmonitor_exec(), page_exec(), park_call_exec(), pbx_builtin_background(), pbx_builtin_resetcdr(), pbx_builtin_waitexten(), read_exec(), readexten_exec(), realtime_common(), receivefax_exec(), record_exec(), redirecting_write(), sendfax_exec(), sendurl_exec(), sig_pri_call(), sla_trunk_exec(), smdi_msg_retrieve_read(), sms_exec(), softhangup_exec(), speech_background(), vm_exec(), vm_execmain(), and volume_write().
int ast_app_parse_options64 | ( | const struct ast_app_option * | options, |
struct ast_flags64 * | flags, | ||
char ** | args, | ||
char * | optstr | ||
) |
Parses a string containing application options and sets flags/arguments.
options | The array of possible options declared with AST_APP_OPTIONS |
flags | The 64-bit flag structure to have option flags set |
args | The array of argument pointers to hold arguments found |
optstr | The string containing the options to be parsed |
Definition at line 2106 of file app.c.
References parse_options().
Referenced by conf_exec(), dial_exec_full(), and find_conf_realtime().
int ast_app_parse_timelen | ( | const char * | timestr, |
int * | result, | ||
enum ast_timelen | defunit | ||
) |
Common routine to parse time lengths, with optional time unit specifier.
[in] | timestr | String to parse |
[in] | defunit | Default unit type |
[out] | result | Resulting value, specified in milliseconds |
0 | Success |
-1 | Failure |
Definition at line 2311 of file app.c.
References FMT, TIMELEN_HOURS, TIMELEN_MILLISECONDS, TIMELEN_MINUTES, and TIMELEN_SECONDS.
Referenced by ast_eivr_senddtmf(), pbx_builtin_wait(), pbx_builtin_waitexten(), and senddtmf_exec().
int ast_app_run_macro | ( | struct ast_channel * | autoservice_chan, |
struct ast_channel * | macro_chan, | ||
const char * | macro_name, | ||
const char * | macro_args | ||
) |
Run a macro on a channel, placing an optional second channel into autoservice.
This is a shorthand method that makes it very easy to run a macro on any given channel. It is perfectly reasonable to supply a NULL autoservice_chan here in case there is no channel to place into autoservice.
autoservice_chan | A channel to place into autoservice while the macro is run |
macro_chan | Channel to execute macro on. |
macro_name | The name of the macro to run. |
macro_args | The arguments to pass to the macro. |
0 | success |
-1 | on error |
Definition at line 294 of file app.c.
References ast_app_exec_macro(), ast_free, ast_malloc, and ast_strlen_zero().
Referenced by ast_channel_connected_line_macro(), ast_channel_redirecting_macro(), and generic_recall().
int ast_app_run_sub | ( | struct ast_channel * | autoservice_chan, |
struct ast_channel * | sub_chan, | ||
const char * | sub_location, | ||
const char * | sub_args, | ||
int | ignore_hangup | ||
) |
Run a subroutine on a channel, placing an optional second channel into autoservice.
This is a shorthand method that makes it very easy to run a subroutine on any given channel. It is perfectly reasonable to supply a NULL autoservice_chan here in case there is no channel to place into autoservice.
autoservice_chan | A channel to place into autoservice while the subroutine is run |
sub_chan | Channel to execute subroutine on. |
sub_location | The location of the subroutine to run. |
sub_args | The arguments to pass to the subroutine. |
ignore_hangup | TRUE if a hangup does not stop execution of the routine. |
0 | success |
-1 | on error |
Definition at line 370 of file app.c.
References ast_app_exec_sub(), ast_free, ast_malloc, and ast_strlen_zero().
int ast_app_sayname | ( | struct ast_channel * | chan, |
const char * | mailbox, | ||
const char * | context | ||
) |
Given a mailbox and context, play that mailbox owner's name to the channel specified.
[in] | chan | Channel on which to play the name |
[in] | mailbox | Mailbox number from which to retrieve the recording |
[in] | context | Mailbox context from which to locate the mailbox number |
0 | Name played without interruption |
dtmf | ASCII value of the DTMF which interrupted playback. |
-1 | Unable to locate mailbox or hangup occurred. |
Definition at line 478 of file app.c.
References ast_sayname_func.
Referenced by common_exec(), and play_mailbox_owner().
void ast_close_fds_above_n | ( | int | n | ) |
Common routine for child processes, to close all fds prior to exec(2)
[in] | n | starting file descriptor number for closing all higher file descriptors |
Definition at line 2237 of file app.c.
References closefrom().
Referenced by app_exec(), ast_safe_system(), icesencode(), launch_script(), main(), mp3play(), NBScatplay(), send_waveform_to_fd(), spawn_mp3(), spawn_ras(), and vm_check_password_shell().
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, | ||
long * | offsetms | ||
) |
Stream a file with fast forward, pause, reverse, restart.
chan | |
file | filename |
fwd,rev,stop,pause,restart,skipms,offsetms | Before calling this function, set this to be the number of ms to start from the beginning of the file. When the function returns, it will be the number of ms from the beginning where the playback stopped. Pass NULL if you don't care. |
Definition at line 683 of file app.c.
References ast_channel::_state, ast_alloca, ast_answer(), ast_debug, ast_seekstream(), AST_STATE_UP, ast_stopstream(), ast_streamfile(), ast_tellstream(), ast_verb, ast_waitfordigit(), ast_waitstream_fr(), ast_channel::language, and ast_channel::stream.
Referenced by controlplayback_exec(), handle_controlstreamfile(), and wait_file().
int ast_dtmf_stream | ( | struct ast_channel * | chan, |
struct ast_channel * | peer, | ||
const char * | digits, | ||
int | between, | ||
unsigned int | duration | ||
) |
Send DTMF to a channel.
chan | The channel that will receive the DTMF frames |
peer | (optional) Peer channel that will be autoserviced while the primary channel is receiving DTMF |
digits | This is a string of characters representing the DTMF digits to be sent to the channel. Valid characters are "0123456789*#abcdABCD". Note: You can pass arguments 'f' or 'F', if you want to Flash the channel (if supported by the channel), or 'w' to add a 500 millisecond pause to the DTMF sequence. |
between | This is the number of milliseconds to wait in between each DTMF digit. If zero milliseconds is specified, then the default value of 100 will be used. |
duration | This is the duration that each DTMF digit should have. |
Definition at line 501 of file app.c.
References ast_autoservice_start(), ast_autoservice_stop(), ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), AST_CONTROL_FLASH, ast_indicate(), ast_log(), ast_opt_transmit_silence, ast_safe_sleep(), ast_senddigit(), ast_waitfor(), and LOG_WARNING.
Referenced by ast_bridge_call(), ast_eivr_senddtmf(), bridge_channel_dtmf_stream(), dial_exec_full(), handle_cli_misdn_send_digit(), senddtmf_exec(), testclient_exec(), testserver_exec(), and wait_for_answer().
int ast_get_encoded_char | ( | const char * | stream, |
char * | result, | ||
size_t * | consumed | ||
) |
Decode an encoded control or extended ASCII character.
[in] | stream | String to decode |
[out] | result | Decoded character |
[out] | consumed | Number of characters used in stream to encode the character |
-1 | Stream is of zero length |
0 | Success |
Definition at line 2122 of file app.c.
References ast_debug, ast_log(), ast_strlen_zero(), and LOG_ERROR.
Referenced by ast_get_encoded_str(), ast_str_get_encoded_str(), cut_internal(), filter(), function_fieldnum_helper(), function_fieldqty_helper(), replace(), shift_pop(), and unshift_push().
char* ast_get_encoded_str | ( | const char * | stream, |
char * | result, | ||
size_t | result_len | ||
) |
Decode a stream of encoded control or extended ASCII characters.
[in] | stream | Encoded string |
[out] | result | Decoded string |
[in] | result_len | Maximum size of the result buffer |
Definition at line 2197 of file app.c.
References ast_get_encoded_char().
Referenced by listfilter(), mgcp_new(), replace(), sip_addheader(), and sip_new().
void ast_install_stack_functions | ( | const struct ast_app_stack_funcs * | funcs | ) |
Set stack application function callbacks.
funcs | Stack applications callback functions. |
Definition at line 319 of file app.c.
References app_stack_callbacks.
Referenced by load_module(), and unload_module().
void ast_install_vm_functions | ( | int(*)(const char *mailbox, const char *folder) | has_voicemail_func, |
int(*)(const char *mailbox, int *newmsgs, int *oldmsgs) | inboxcount_func, | ||
int(*)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) | inboxcount2_func, | ||
int(*)(const char *context, const char *mailbox, const char *folder) | messagecount_func, | ||
int(*)(struct ast_channel *chan, const char *mailbox, const char *context) | sayname_func | ||
) |
Set voicemail function callbacks.
[in] | has_voicemail_func | set function pointer |
[in] | inboxcount2_func | set function pointer |
[in] | sayname_func | set function pointer |
[in] | inboxcount_func | set function pointer |
[in] | messagecount_func | set function pointer |
Definition at line 399 of file app.c.
References ast_has_voicemail_func, ast_inboxcount2_func, ast_inboxcount_func, ast_messagecount_func, and ast_sayname_func.
Referenced by load_module().
int ast_ivr_menu_run | ( | struct ast_channel * | c, |
struct ast_ivr_menu * | menu, | ||
void * | cbdata | ||
) |
Runs an IVR menu.
Definition at line 1980 of file app.c.
References ast_ivr_menu_run_internal().
Referenced by skel_exec().
int ast_linear_stream | ( | struct ast_channel * | chan, |
const char * | filename, | ||
int | fd, | ||
int | allowoverride | ||
) |
Stream a filename (or file descriptor) as a generator.
Definition at line 653 of file app.c.
References linear_state::allowoverride, ast_activate_generator(), ast_calloc, ast_config_AST_DATA_DIR, ast_copy_string(), ast_log(), ast_strlen_zero(), linear_state::autoclose, errno, linear_state::fd, linearstream, and LOG_WARNING.
enum AST_LOCK_RESULT ast_lock_path | ( | const char * | path | ) |
Lock a filesystem path.
path | the path to be locked |
Definition at line 1652 of file app.c.
References AST_LOCK_FAILURE, ast_lock_path_flock(), ast_lock_path_lockfile(), ast_lock_type, AST_LOCK_TYPE_FLOCK, and AST_LOCK_TYPE_LOCKFILE.
Referenced by ast_module_reload(), and vm_lock_path().
int ast_play_and_prepend | ( | struct ast_channel * | chan, |
char * | playfile, | ||
char * | recordfile, | ||
int | maxtime_sec, | ||
char * | fmt, | ||
int * | duration, | ||
int * | sound_duration, | ||
int | beep, | ||
int | silencethreshold, | ||
int | maxsilence_ms | ||
) |
Record a file based on input frm a channel. Recording is performed in 'prepend' mode which works a little differently from normal recordings This function will not play a success message due to post-recording control in the application this was added for.
chan | the channel being recorded |
playfile | Filename of sound to play before recording begins |
recordfile | Filename to save the recording |
maxtime_sec | Longest possible message length in seconds |
fmt | string containing all formats to be recorded delimited by '|' |
duration | pointer to integer for storing length of the recording |
sound_duration | pointer to integer for storing length of the recording minus all silence |
beep | whether to play a beep to prompt the recording |
silencethreshold | tolerance of noise levels that can be considered silence for the purpose of silence timeout, -1 for default |
maxsilence_ms | length of time in milliseconds which will trigger a timeout from silence, -1 for default. |
-1 | failure or hangup |
'S' | Recording ended from silence timeout |
't' | Recording either exceeded maximum duration or the call was ended via DTMF |
Definition at line 1188 of file app.c.
References __ast_play_and_record(), default_acceptdtmf, and default_canceldtmf.
Referenced by vm_forwardoptions().
int ast_play_and_record | ( | struct ast_channel * | chan, |
const char * | playfile, | ||
const char * | recordfile, | ||
int | maxtime_sec, | ||
const char * | fmt, | ||
int * | duration, | ||
int * | sound_duration, | ||
int | silencethreshold, | ||
int | maxsilence_ms, | ||
const char * | path | ||
) |
Record a file based on input from a channel. Use default accept and cancel DTMF. This function will play "auth-thankyou" upon successful recording.
chan | the channel being recorded |
playfile | Filename of sound to play before recording begins |
recordfile | Filename to save the recording |
maxtime_sec | Longest possible message length in seconds |
fmt | string containing all formats to be recorded delimited by '|' |
duration | pointer to integer for storing length of the recording |
sound_duration | pointer to integer for storing length of the recording minus all silence |
silencethreshold | tolerance of noise levels that can be considered silence for the purpose of silence timeout, -1 for default |
maxsilence_ms | length of time in milliseconds which will trigger a timeout from silence, -1 for default |
path | Optional filesystem path to unlock |
-1 | failure or hangup |
'S' | Recording ended from silence timeout |
't' | Recording ended from the message exceeding the maximum duration |
dtmfchar | Recording ended via the return value's DTMF character for either cancel or accept. |
Definition at line 1183 of file app.c.
References __ast_play_and_record(), default_acceptdtmf, and default_canceldtmf.
Referenced by app_exec(), ast_record_review(), conf_run(), and setup_privacy_args().
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 * | sound_duration, | ||
int | silencethreshold, | ||
int | maxsilence_ms, | ||
const char * | path, | ||
const char * | acceptdtmf, | ||
const char * | canceldtmf | ||
) |
Record a file based on input from a channel This function will play "auth-thankyou" upon successful recording.
chan | the channel being recorded |
playfile | Filename of sound to play before recording begins |
recordfile | Filename to save the recording |
maxtime_sec | Longest possible message length in seconds |
fmt | string containing all formats to be recorded delimited by '|' |
duration | pointer to integer for storing length of the recording |
sound_duration | pointer to integer for storing length of the recording minus all silence |
silencethreshold | tolerance of noise levels that can be considered silence for the purpose of silence timeout, -1 for default |
maxsilence_ms | Length of time in milliseconds which will trigger a timeout from silence, -1 for default |
path | Optional filesystem path to unlock |
acceptdtmf | Character of DTMF to end and accept the recording |
canceldtmf | Character of DTMF to end and cancel the recording |
-1 | failure or hangup |
'S' | Recording ended from silence timeout |
't' | Recording ended from the message exceeding the maximum duration |
dtmfchar | Recording ended via the return value's DTMF character for either cancel or accept. |
Definition at line 1178 of file app.c.
References __ast_play_and_record(), default_acceptdtmf, default_canceldtmf, and S_OR.
Referenced by play_record_review().
int ast_play_and_wait | ( | struct ast_channel * | chan, |
const char * | fn | ||
) |
Play a stream and wait for a digit, returning the digit that was pressed.
Definition at line 822 of file app.c.
References AST_DIGIT_ANY, ast_stopstream(), ast_streamfile(), ast_waitstream(), and ast_channel::language.
Referenced by __ast_play_and_record(), advanced_options(), ast_record_review(), ast_say_counted_adjective(), ast_say_counted_noun(), dialout(), forward_message(), get_folder(), get_folder2(), leave_voicemail(), minivm_greet_exec(), play_message_category(), play_message_duration(), play_record_review(), vm_authenticate(), vm_browse_messages_en(), vm_browse_messages_he(), vm_browse_messages_latin(), vm_browse_messages_vi(), vm_browse_messages_zh(), vm_exec(), vm_execmain(), vm_forwardoptions(), vm_instructions_en(), vm_instructions_zh(), vm_intro(), vm_intro_cs(), vm_intro_de(), vm_intro_en(), vm_intro_es(), vm_intro_fr(), vm_intro_gr(), vm_intro_he(), vm_intro_it(), vm_intro_multilang(), vm_intro_nl(), vm_intro_no(), vm_intro_pl(), vm_intro_pt(), vm_intro_pt_BR(), vm_intro_se(), vm_intro_vi(), vm_intro_zh(), vm_newuser(), vm_options(), vm_play_folder_name(), vm_play_folder_name_gr(), vm_play_folder_name_pl(), vm_play_folder_name_ua(), vm_tempgreeting(), and vmauthenticate().
char* ast_read_textfile | ( | const char * | file | ) |
Read a file into asterisk.
Definition at line 1987 of file app.c.
References ast_free, ast_log(), ast_malloc, errno, and LOG_WARNING.
Referenced by readfile_exec().
int ast_record_review | ( | struct ast_channel * | chan, |
const char * | playfile, | ||
const char * | recordfile, | ||
int | maxtime, | ||
const char * | fmt, | ||
int * | duration, | ||
const char * | path | ||
) |
Allow to record message and have a review option.
Definition at line 1684 of file app.c.
References AST_DIGIT_ANY, ast_dsp_get_threshold_from_settings(), ast_log(), ast_play_and_record(), ast_play_and_wait(), ast_stream_and_wait(), ast_verb, ast_waitfordigit(), LOG_WARNING, maxsilence, silencethreshold, and THRESHOLD_SILENCE.
Referenced by conf_run().
void ast_replace_sigchld | ( | void | ) |
Replace the SIGCHLD handler.
Normally, Asterisk has a SIGCHLD handler that is cleaning up all zombie processes from forking elsewhere in Asterisk. However, if you want to wait*() on the process to retrieve information about it's exit status, then this signal handler needs to be temporarily replaced.
Code that executes this function must call ast_unreplace_sigchld() after it is finished doing the wait*().
Definition at line 1047 of file asterisk.c.
References ast_mutex_lock, ast_mutex_unlock, null_sig_handler, safe_system_level, safe_system_lock, and safe_system_prev_handler.
Referenced by ast_safe_fork(), and ast_safe_system().
int ast_safe_fork | ( | int | stop_reaper | ) |
Common routine to safely fork without a chance of a signal handler firing badly in the child.
[in] | stop_reaper | flag to determine if sigchld handler is replaced or not |
Definition at line 2242 of file app.c.
References ast_calloc, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log(), ast_pthread_create_background, AST_PTHREADT_NULL, ast_replace_sigchld(), errno, zombie::list, LOG_ERROR, LOG_WARNING, zombie::pid, and shaun_of_the_dead().
Referenced by app_exec(), filestream_destructor(), icesencode(), launch_script(), mp3play(), NBScatplay(), send_waveform_to_fd(), spawn_mp3(), spawn_ras(), and vm_check_password_shell().
void ast_safe_fork_cleanup | ( | void | ) |
Common routine to cleanup after fork'ed process is complete (if reaping was stopped)
Definition at line 2306 of file app.c.
References ast_unreplace_sigchld().
Referenced by agi_exec_full(), and run_ras().
int ast_safe_system | ( | const char * | s | ) |
Safely spawn an external program while closing file descriptors.
Definition at line 1077 of file asterisk.c.
References ast_close_fds_above_n(), ast_log(), ast_opt_high_priority, ast_replace_sigchld(), ast_set_priority(), ast_unreplace_sigchld(), errno, LOG_WARNING, status, WEXITSTATUS, and WIFEXITED.
Referenced by add_email_attachment(), alarmreceiver_exec(), ast_monitor_stop(), consolehandler(), mixmonitor_thread(), notify_message(), process_text_line(), remoteconsolehandler(), rotate_file(), run_externnotify(), sendmail(), sendpage(), system_exec_helper(), and vm_change_password_shell().
void ast_set_lock_type | ( | enum AST_LOCK_TYPE | type | ) |
Set the type of locks used by ast_lock_path()
type | the locking type to use |
Definition at line 1647 of file app.c.
References ast_lock_type, and type.
Referenced by ast_readconfig().
int ast_str_get_encoded_str | ( | struct ast_str ** | str, |
int | maxlen, | ||
const char * | stream | ||
) |
Decode a stream of encoded control or extended ASCII characters.
Definition at line 2210 of file app.c.
References ast_get_encoded_char(), ast_str_buffer(), ast_str_make_space(), ast_str_set(), ast_str_size(), ast_str_update(), and zombie::next.
Referenced by sendtext_exec(), and system_exec_helper().
AST_THREADSTORAGE_EXTERNAL | ( | ast_str_thread_global_buf | ) |
void ast_uninstall_vm_functions | ( | void | ) |
Definition at line 412 of file app.c.
References ast_has_voicemail_func, ast_inboxcount2_func, ast_inboxcount_func, ast_messagecount_func, and ast_sayname_func.
Referenced by unload_module().
int ast_unlock_path | ( | const char * | path | ) |
Unlock a path.
Definition at line 1668 of file app.c.
References ast_lock_type, AST_LOCK_TYPE_FLOCK, AST_LOCK_TYPE_LOCKFILE, ast_unlock_path_flock(), and ast_unlock_path_lockfile().
Referenced by __ast_play_and_record(), access_counter_file(), ast_module_reload(), close_mailbox(), copy_message(), count_messages(), leave_voicemail(), open_mailbox(), resequence_mailbox(), and save_to_folder().
void ast_unreplace_sigchld | ( | void | ) |
Restore the SIGCHLD handler.
This function is called after a call to ast_replace_sigchld. It restores the SIGCHLD handler that cleans up any zombie processes.
Definition at line 1062 of file asterisk.c.
References ast_mutex_lock, ast_mutex_unlock, safe_system_level, safe_system_lock, and safe_system_prev_handler.
Referenced by ast_safe_fork_cleanup(), and ast_safe_system().