Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Application convenience functions, designed to give consistent look and feel to Asterisk apps. More...
#include "asterisk/stringfields.h"
#include "asterisk/strings.h"
#include "asterisk/threadstorage.h"
#include "asterisk/file.h"
#include "asterisk/linkedlists.h"
#include "asterisk/utils.h"
#include "asterisk/stasis.h"
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 |
struct | ast_vm_functions |
Voicemail function table definition. More... | |
struct | ast_vm_greeter_functions |
Voicemail greeter function table definition. More... | |
struct | ast_vm_mailbox_snapshot |
struct | ast_vm_msg_snapshot |
struct | ast_vm_recording_data |
Structure used for ast_copy_recording_to_vm in order to cleanly supply data needed for making the recording from the recorded file. More... | |
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(argtype_##name, 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 | ast_vm_greeter_register(vm_table) __ast_vm_greeter_register(vm_table, AST_MODULE_SELF) |
See __ast_vm_greeter_register() More... | |
#define | ast_vm_register(vm_table) __ast_vm_register(vm_table, AST_MODULE_SELF) |
See __ast_vm_register() More... | |
#define | BEGIN_OPTIONS { |
#define | END_OPTIONS } |
#define | VM_GREETER_MODULE_VERSION 1 |
#define | VM_MODULE_VERSION 2 |
Typedefs | |
typedef int() | ast_copy_recording_to_vm_fn(struct ast_vm_recording_data *vm_rec_data) |
Creates a voicemail based on a specified file to a mailbox. More... | |
typedef int() | ast_has_voicemail_fn(const char *mailboxes, const char *folder) |
Determines if the given folder has messages. More... | |
typedef int() | ast_inboxcount2_fn(const char *mailboxes, int *urgentmsgs, int *newmsgs, int *oldmsgs) |
Gets the number of messages that exist for the mailbox list. More... | |
typedef int() | ast_inboxcount_fn(const char *mailboxes, int *newmsgs, int *oldmsgs) |
Gets the number of messages that exist for the mailbox list. More... | |
typedef int() | ast_ivr_callback(struct ast_channel *chan, char *option, void *cbdata) |
Callback function for IVR. More... | |
typedef int() | ast_messagecount_fn(const char *mailbox_id, const char *folder) |
Gets the number of messages that exist in a mailbox folder. More... | |
typedef int() | ast_sayname_fn(struct ast_channel *chan, const char *mailbox_id) |
Play a recorded user name for the mailbox to the specified channel. More... | |
typedef const char *() | ast_vm_index_to_foldername_fn(int id) |
Convert the mailbox folder id to a folder name. More... | |
typedef struct ast_vm_mailbox_snapshot *() | ast_vm_mailbox_snapshot_create_fn(const char *user, const char *context, const char *folder, int descending, enum ast_vm_snapshot_sort_val sort_val, int combine_INBOX_and_OLD) |
Create a snapshot of a mailbox which contains information about every msg. More... | |
typedef struct ast_vm_mailbox_snapshot *() | ast_vm_mailbox_snapshot_destroy_fn(struct ast_vm_mailbox_snapshot *mailbox_snapshot) |
destroy a snapshot More... | |
typedef int() | ast_vm_msg_forward_fn(const char *from_mailbox, const char *from_context, const char *from_folder, const char *to_mailbox, const char *to_context, const char *to_folder, size_t num_msgs, const char *msg_ids[], int delete_old) |
forward a message from one mailbox to another. More... | |
typedef int() | ast_vm_msg_move_fn(const char *mailbox, const char *context, size_t num_msgs, const char *oldfolder, const char *old_msg_ids[], const char *newfolder) |
Move messages from one folder to another. More... | |
typedef void() | ast_vm_msg_play_cb(struct ast_channel *chan, const char *playfile, int duration) |
Voicemail playback callback function definition. More... | |
typedef int() | ast_vm_msg_play_fn(struct ast_channel *chan, const char *mailbox, const char *context, const char *folder, const char *msg_num, ast_vm_msg_play_cb *cb) |
Play a voicemail msg back on a channel. More... | |
typedef int() | ast_vm_msg_remove_fn(const char *mailbox, const char *context, size_t num_msgs, const char *folder, const char *msgs[]) |
Remove/delete messages from a mailbox folder. More... | |
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_vm_greeter_register (const struct ast_vm_greeter_functions *vm_table, struct ast_module *module) |
Set voicemail greeter function callbacks. More... | |
int | __ast_vm_register (const struct ast_vm_functions *vm_table, struct ast_module *module) |
Set voicemail function callbacks. More... | |
int | app_init (void) |
Initialize the application core. More... | |
int | ast_app_copy_recording_to_vm (struct ast_vm_recording_data *vm_rec_data) |
param[in] vm_rec_data Contains data needed to make the recording. retval 0 voicemail successfully created from recording. retval -1 Failure 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_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... | |
enum ast_getdata_result | 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... | |
enum ast_getdata_result | ast_app_getdata_terminator (struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout, char *terminator) |
Plays a stream and gets DTMF data from a channel. 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 *mailboxes, 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 *mailboxes, int *newmsgs, int *oldmsgs) |
Determine number of new/old messages in a mailbox. More... | |
int | ast_app_inboxcount2 (const char *mailboxes, int *urgentmsgs, int *newmsgs, int *oldmsgs) |
Determine number of urgent/new/old messages in a mailbox. More... | |
int | ast_app_messagecount (const char *mailbox_id, const char *folder) |
Get the number of messages in a given mailbox 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_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_id) |
Play a recorded user name for the mailbox to the specified channel. 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_control_streamfile_lang (struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *suspend, const char *restart, int skipms, const char *lang, long *offsetms) |
Version of ast_control_streamfile() which allows the language of the media file to be specified. More... | |
int | ast_control_streamfile_w_cb (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, ast_waitstream_fr_cb cb) |
Stream a file with fast forward, pause, reverse, restart. More... | |
int | ast_control_tone (struct ast_channel *chan, const char *tone) |
Controls playback of a tone. More... | |
int | ast_dtmf_stream (struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration) |
Send a string of DTMF digits to a channel. More... | |
void | ast_dtmf_stream_external (struct ast_channel *chan, const char *digits, int between, unsigned int duration) |
Send a string of DTMF digits to a channel from an external thread. 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... | |
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_mf_stream (struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *chan2, const char *digits, int between, unsigned int duration, unsigned int durationkp, unsigned int durationst, int is_external) |
Send a string of MF digits to a channel. 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 beep, int silencethreshold, int maxsilence_ms, const char *path, const char *acceptdtmf, const char *canceldtmf, int skip_confirmation_sound, enum ast_record_if_exists if_exists) |
Record a file based on input from a channel This function will play "auth-thankyou" upon successful recording if skip_confirmation_sound is false. 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... | |
struct stasis_topic * | ast_queue_topic (const char *queuename) |
Get the Stasis Message Bus API topic for queue messages for a particular queue name. More... | |
struct stasis_topic * | ast_queue_topic_all (void) |
Get the Stasis Message Bus API topic for queue messages. 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_execvp (int dualfork, const char *file, char *const argv[]) |
Safely spawn an external program while closing file descriptors. 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 OS shell command 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_sf_stream (struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *chan2, const char *digits, int frequency, int is_external) |
Send a string of SF digits to a channel. 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) | |
int | ast_unlock_path (const char *path) |
Unlock a path. More... | |
void | ast_unreplace_sigchld (void) |
Restore the SIGCHLD handler. More... | |
int | ast_vm_greeter_is_registered (void) |
Determine if a voicemail greeter provider is registered. More... | |
void | ast_vm_greeter_unregister (const char *module_name) |
Unregister the specified voicemail greeter provider. More... | |
const char * | ast_vm_index_to_foldername (int id) |
Return name of folder, given an id. More... | |
int | ast_vm_is_registered (void) |
Determine if a voicemail provider is registered. More... | |
struct ast_vm_mailbox_snapshot * | ast_vm_mailbox_snapshot_create (const char *mailbox, const char *context, const char *folder, int descending, enum ast_vm_snapshot_sort_val sort_val, int combine_INBOX_and_OLD) |
Create a snapshot of a mailbox which contains information about every msg. More... | |
struct ast_vm_mailbox_snapshot * | ast_vm_mailbox_snapshot_destroy (struct ast_vm_mailbox_snapshot *mailbox_snapshot) |
destroy a snapshot More... | |
int | ast_vm_msg_forward (const char *from_mailbox, const char *from_context, const char *from_folder, const char *to_mailbox, const char *to_context, const char *to_folder, size_t num_msgs, const char *msg_ids[], int delete_old) |
forward a message from one mailbox to another. More... | |
int | ast_vm_msg_move (const char *mailbox, const char *context, size_t num_msgs, const char *oldfolder, const char *old_msg_ids[], const char *newfolder) |
Move messages from one folder to another. More... | |
int | ast_vm_msg_play (struct ast_channel *chan, const char *mailbox, const char *context, const char *folder, const char *msg_num, ast_vm_msg_play_cb *cb) |
Play a voicemail msg back on a channel. More... | |
int | ast_vm_msg_remove (const char *mailbox, const char *context, size_t num_msgs, const char *folder, const char *msgs[]) |
Remove/delete messages from a mailbox folder. More... | |
void | ast_vm_unregister (const char *module_name) |
Unregister the specified voicemail provider. More... | |
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
Definition in file include/asterisk/app.h.
Define an application argument.
name | The name of the argument |
Definition at line 1230 of file include/asterisk/app.h.
#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 |
Definition at line 1400 of file include/asterisk/app.h.
#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 |
Definition at line 1411 of file include/asterisk/app.h.
#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:
Definition at line 1391 of file include/asterisk/app.h.
Definition at line 1319 of file include/asterisk/app.h.
#define AST_DECLARE_APP_ARGS | ( | name, | |
arglist | |||
) | AST_DEFINE_APP_ARGS_TYPE(argtype_##name, 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 1247 of file include/asterisk/app.h.
#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).
Definition at line 1264 of file include/asterisk/app.h.
#define AST_IVR_DECLARE_MENU | ( | holder, | |
title, | |||
flags, | |||
foo... | |||
) |
Definition at line 108 of file include/asterisk/app.h.
#define AST_IVR_FLAG_AUTORESTART (1 << 0) |
Definition at line 106 of file include/asterisk/app.h.
#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 1298 of file include/asterisk/app.h.
#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 1300 of file include/asterisk/app.h.
#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 1283 of file include/asterisk/app.h.
#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 1285 of file include/asterisk/app.h.
#define ast_vm_greeter_register | ( | vm_table | ) | __ast_vm_greeter_register(vm_table, AST_MODULE_SELF) |
See __ast_vm_greeter_register()
Definition at line 640 of file include/asterisk/app.h.
#define ast_vm_register | ( | vm_table | ) | __ast_vm_register(vm_table, AST_MODULE_SELF) |
Definition at line 573 of file include/asterisk/app.h.
#define BEGIN_OPTIONS { |
Definition at line 1341 of file include/asterisk/app.h.
#define END_OPTIONS } |
Definition at line 1342 of file include/asterisk/app.h.
#define VM_GREETER_MODULE_VERSION 1 |
Definition at line 598 of file include/asterisk/app.h.
#define VM_MODULE_VERSION 2 |
Definition at line 521 of file include/asterisk/app.h.
typedef int() ast_copy_recording_to_vm_fn(struct ast_vm_recording_data *vm_rec_data) |
Creates a voicemail based on a specified file to a mailbox.
vm_rec_data | A record containing filename and voicemail txt info. |
0 | on success |
-1 | on failure |
Definition at line 399 of file include/asterisk/app.h.
typedef int() ast_has_voicemail_fn(const char *mailboxes, const char *folder) |
Determines if the given folder has messages.
mailboxes | Comma or & delimited list of mailboxes (user@context). If no context is found, uses 'default' for the context. |
folder | The folder to look in. Default is INBOX if not provided. |
1 | if the folder has one or more messages. |
0 | otherwise. |
Definition at line 329 of file include/asterisk/app.h.
typedef int() ast_inboxcount2_fn(const char *mailboxes, int *urgentmsgs, int *newmsgs, int *oldmsgs) |
Gets the number of messages that exist for the mailbox list.
mailboxes | Comma or space delimited list of mailboxes (user@context). If no context is found, uses 'default' for the context. |
urgentmsgs | Where to put the count of urgent messages. (Can be NULL) |
newmsgs | Where to put the count of new messages. (Can be NULL) |
oldmsgs | Where to put the count of old messages. (Can be NULL) |
Simultaneously determines the count of new, old, and urgent messages. The total messages would then be the sum of these three.
0 | on success |
-1 | on failure |
Definition at line 365 of file include/asterisk/app.h.
typedef int() ast_inboxcount_fn(const char *mailboxes, int *newmsgs, int *oldmsgs) |
Gets the number of messages that exist for the mailbox list.
mailboxes | Comma or space delimited list of mailboxes (user@context). If no context is found, uses 'default' for the context. |
newmsgs | Where to put the count of new messages. (Can be NULL) |
oldmsgs | Where to put the count of old messages. (Can be NULL) |
Simultaneously determines the count of new + urgent and old messages. The total messages would then be the sum of these.
0 | on success |
-1 | on failure |
Definition at line 346 of file include/asterisk/app.h.
typedef int() ast_ivr_callback(struct ast_channel *chan, char *option, void *cbdata) |
Callback function for IVR.
0 | on completion. |
-1 | on hangup or digit if interrupted. |
Definition at line 48 of file include/asterisk/app.h.
typedef int() ast_messagecount_fn(const char *mailbox_id, const char *folder) |
Gets the number of messages that exist in a mailbox folder.
mailbox_id | The mailbox name. |
folder | The folder to look in. Default is INBOX if not provided. |
Definition at line 377 of file include/asterisk/app.h.
typedef int() ast_sayname_fn(struct ast_channel *chan, const char *mailbox_id) |
Play a recorded user name for the mailbox to the specified channel.
chan | Where to play the recorded name file. |
mailbox_id | The mailbox name. |
0 | Name played without interruption |
-1 | Unable to locate mailbox or hangup occurred. |
Definition at line 389 of file include/asterisk/app.h.
typedef const char *() ast_vm_index_to_foldername_fn(int id) |
Convert the mailbox folder id to a folder name.
id | Mailbox folder id to convert. |
Definition at line 410 of file include/asterisk/app.h.
typedef struct ast_vm_mailbox_snapshot *() ast_vm_mailbox_snapshot_create_fn(const char *user, const char *context, const char *folder, int descending, enum ast_vm_snapshot_sort_val sort_val, int combine_INBOX_and_OLD) |
Create a snapshot of a mailbox which contains information about every msg.
user | The user part of user@context. |
context | The context part of user@context. Must be explicit. |
folder | When not NULL only msgs from the specified folder will be included. |
descending | list the msgs in descending order rather than ascending order. |
sort_val | What to sort in the snapshot. |
combine_INBOX_and_OLD | When this argument is set, The OLD folder will be represented in the INBOX folder of the snapshot. This allows the snapshot to represent the OLD and INBOX messages in sorted order merged together. |
NULL | on failure |
Definition at line 410 of file include/asterisk/app.h.
typedef struct ast_vm_mailbox_snapshot *() ast_vm_mailbox_snapshot_destroy_fn(struct ast_vm_mailbox_snapshot *mailbox_snapshot) |
destroy a snapshot
mailbox_snapshot | The snapshot to destroy. |
NULL |
Definition at line 410 of file include/asterisk/app.h.
typedef int() ast_vm_msg_forward_fn(const char *from_mailbox, const char *from_context, const char *from_folder, const char *to_mailbox, const char *to_context, const char *to_folder, size_t num_msgs, const char *msg_ids[], int delete_old) |
forward a message from one mailbox to another.
from_mailbox The original mailbox the message is being forwarded from
from_context The voicemail context of the from_mailbox
from_folder The folder from which the message is being forwarded
to_mailbox The mailbox to forward the message to
to_context The voicemail context of the to_mailbox
to_folder The folder to which the message is being forwarded
num_msgs The number of messages being forwarded
msg_ids The message IDs of the messages in from_mailbox to forward
delete_old If non-zero, the forwarded messages are also deleted from from_mailbox. Otherwise, the messages will remain in the from_mailbox.
-1 | Failure |
0 | Success |
Definition at line 499 of file include/asterisk/app.h.
typedef int() ast_vm_msg_move_fn(const char *mailbox, const char *context, size_t num_msgs, const char *oldfolder, const char *old_msg_ids[], const char *newfolder) |
Move messages from one folder to another.
mailbox | The mailbox to which the folders belong |
context | The voicemail context for the mailbox |
num_msgs | The number of messages to move |
oldfolder | The folder from where messages should be moved |
old_msg_ids | The message IDs of the messages to move |
newfolder | The folder to which messages should be moved new folder. This array must be num_msgs sized. |
-1 | Failure |
0 | Success |
Definition at line 460 of file include/asterisk/app.h.
typedef void() ast_vm_msg_play_cb(struct ast_channel *chan, const char *playfile, int duration) |
Voicemail playback callback function definition.
chan | Channel to play the file back on. |
playfile | Location of file on disk |
duration | of file in seconds. This will be zero if msg is very short or has an unknown duration. |
Definition at line 317 of file include/asterisk/app.h.
typedef int() ast_vm_msg_play_fn(struct ast_channel *chan, const char *mailbox, const char *context, const char *folder, const char *msg_num, ast_vm_msg_play_cb *cb) |
Play a voicemail msg back on a channel.
chan | |
mailbox | msg is in. |
context | of mailbox. |
folder | voicemail folder to look in. |
msg_num | message number in the voicemailbox to playback to the channel. |
cb |
0 | success |
-1 | failure |
Definition at line 518 of file include/asterisk/app.h.
typedef int() ast_vm_msg_remove_fn(const char *mailbox, const char *context, size_t num_msgs, const char *folder, const char *msgs[]) |
Remove/delete messages from a mailbox folder.
mailbox | The mailbox from which to delete messages |
context | The voicemail context for the mailbox |
num_msgs | The number of messages to delete |
folder | The folder from which to remove messages |
msgs | The message IDs of the messages to delete |
-1 | Failure |
0 | Success |
Definition at line 477 of file include/asterisk/app.h.
enum ast_getdata_result |
Definition at line 126 of file include/asterisk/app.h.
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 50 of file include/asterisk/app.h.
enum AST_LOCK_RESULT |
Enumerator | |
---|---|
AST_LOCK_SUCCESS | |
AST_LOCK_TIMEOUT | |
AST_LOCK_PATH_NOT_FOUND | |
AST_LOCK_FAILURE |
Definition at line 1162 of file include/asterisk/app.h.
enum AST_LOCK_TYPE |
Type of locking to use in ast_lock_path / ast_unlock_path.
Enumerator | |
---|---|
AST_LOCK_TYPE_LOCKFILE | |
AST_LOCK_TYPE_FLOCK |
Definition at line 1170 of file include/asterisk/app.h.
enum ast_record_if_exists |
Possible actions to take if a recording already exists
Definition at line 1080 of file include/asterisk/app.h.
enum ast_timelen |
Enumerator | |
---|---|
TIMELEN_HOURS | |
TIMELEN_MINUTES | |
TIMELEN_SECONDS | |
TIMELEN_MILLISECONDS |
Definition at line 112 of file include/asterisk/app.h.
Enumerator | |
---|---|
AST_VM_SNAPSHOT_SORT_BY_ID | |
AST_VM_SNAPSHOT_SORT_BY_TIME |
Definition at line 280 of file include/asterisk/app.h.
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 2356 of file main/app.c.
int __ast_vm_greeter_register | ( | const struct ast_vm_greeter_functions * | vm_table, |
struct ast_module * | module | ||
) |
Set voicemail greeter function callbacks.
vm_table | Voicemail greeter function table to install. |
module | Pointer to the module implementing the interface |
0 | on success. |
-1 | on error. |
AST_MODULE_LOAD_DECLINE | if there's already another greeter registered. |
Definition at line 479 of file main/app.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_global_obj_ref, ao2_global_obj_replace_unref, ast_log, AST_MODULE_LOAD_DECLINE, LOG_ERROR, LOG_WARNING, ast_vm_greeter_functions::module, ast_vm_functions::module_name, ast_vm_functions::module_version, NULL, RAII_VAR, table, VM_GREETER_MODULE_VERSION, and vm_table.
int __ast_vm_register | ( | const struct ast_vm_functions * | vm_table, |
struct ast_module * | module | ||
) |
Set voicemail function callbacks.
vm_table | Voicemail function table to install. |
module | Pointer to the module implementing the interface |
0 | on success. |
-1 | on error. |
AST_MODULE_LOAD_DECLINE | if there's already another provider registered. |
Definition at line 368 of file main/app.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_global_obj_ref, ao2_global_obj_replace_unref, ast_log, AST_MODULE_LOAD_DECLINE, LOG_ERROR, LOG_WARNING, ast_vm_functions::module, ast_vm_functions::module_name, ast_vm_functions::module_version, NULL, RAII_VAR, table, VM_MODULE_VERSION, and vm_table.
int app_init | ( | void | ) |
Initialize the application core.
0 | Success |
-1 | Failure |
Definition at line 3365 of file main/app.c.
References app_cleanup(), ast_register_cleanup(), queue_topic_all, queue_topic_pool, stasis_topic_create(), and stasis_topic_pool_create().
Referenced by asterisk_daemon().
int ast_app_copy_recording_to_vm | ( | struct ast_vm_recording_data * | vm_rec_data | ) |
param[in] vm_rec_data Contains data needed to make the recording. retval 0 voicemail successfully created from recording. retval -1 Failure
Definition at line 596 of file main/app.c.
References VM_API_CALL.
Referenced by copy_to_voicemail().
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.
1 | if extension exists |
0 | if extension does not exist |
-1 | on hangup |
Present a dialtone and collect a certain length extension.
chan | struct. |
context | |
collect | |
size | |
maxlen | |
timeout | timeout in milliseconds |
Definition at line 138 of file main/app.c.
References ast_channel_caller(), ast_channel_pbx(), ast_channel_zone(), 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(), voicemailpwcheck::context, ast_tone_zone_sound::data, ast_pbx::dtimeoutms, LOG_NOTICE, NULL, and S_COR.
Referenced by grab_transfer().
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 297 of file main/app.c.
References app_stack_callbacks, ast_autoservice_start(), ast_autoservice_stop(), ast_check_hangup_locked(), ast_log, ast_module_running_ref, ast_module_unref, ast_queue_hangup(), ignore_hangup, LOG_WARNING, ast_app_stack_funcs::module, and ast_app_stack_funcs::run_sub.
Referenced by app_exec(), ast_app_run_sub(), ast_pbx_hangup_handler_run(), ast_pre_call(), dial_exec_full(), eval_sub_read(), generic_recall(), originate_exec(), page_exec(), queue_exec(), run_app_helper(), and try_calling().
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.
NULL | on error. |
Definition at line 278 of file main/app.c.
References app_stack_callbacks, args, ast_log, ast_module_running_ref, ast_module_unref, ast_app_stack_funcs::expand_sub_args, LOG_WARNING, ast_app_stack_funcs::module, and NULL.
Referenced by app_exec(), ast_pbx_hangup_handler_push(), dial_exec_full(), and page_exec().
enum ast_getdata_result 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.
Definition at line 188 of file main/app.c.
References ast_app_getdata_terminator(), c, NULL, and prompt.
Referenced by auth_exec(), conf_exec(), conf_get_pin(), dictate_exec(), find_conf(), 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 247 of file main/app.c.
References ast_channel_language(), ast_readstring_full(), ast_streamfile(), ast_strlen_zero(), c, and prompt.
Referenced by handle_getdata().
enum ast_getdata_result ast_app_getdata_terminator | ( | struct ast_channel * | c, |
const char * | prompt, | ||
char * | s, | ||
int | maxlen, | ||
int | timeout, | ||
char * | terminator | ||
) |
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. |
terminator | A string of characters that may be used as terminators to end input. If NULL, "#" will be used. |
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.
Definition at line 193 of file main/app.c.
References ast_channel_language(), ast_channel_pbx(), AST_GETDATA_EMPTY_END_TERMINATED, ast_readstring(), ast_strdupa, ast_streamfile(), ast_strlen_zero(), ast_strsep(), AST_STRSEP_STRIP, AST_STRSEP_TRIM, c, ast_pbx::dtimeoutms, prompt, and ast_pbx::rtimeoutms.
Referenced by ast_app_getdata(), and read_exec().
int ast_app_group_discard | ( | struct ast_channel * | chan | ) |
Discard all group counting for a channel.
Definition at line 2319 of file main/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, ast_group_info::group_list, and NULL.
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 2240 of file main/app.c.
References 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, and NULL.
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 2346 of file main/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 2341 of file main/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 2351 of file main/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 2336 of file main/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 2260 of file main/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, LOG_NOTICE, and NULL.
Referenced by AST_TEST_DEFINE(), and 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 2193 of file main/app.c.
References ast_app_group_split_group(), ast_calloc, ast_free, 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(), ast_group_info::category, ast_group_info::chan, ast_group_info::group, ast_group_info::group_list, len(), and NULL.
Referenced by AST_TEST_DEFINE(), 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 2166 of file main/app.c.
References ast_copy_string(), ast_strlen_zero(), ast_frame::data, NULL, and tmp().
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 2300 of file main/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, ast_group_info::group_list, and NULL.
Referenced by channel_do_masquerade().
int ast_app_has_voicemail | ( | const char * | mailboxes, |
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 582 of file main/app.c.
References has_voicemail(), mailboxes, and VM_API_CALL.
Referenced by action_mailboxstatus(), has_voicemail(), mwi_update_cb(), notify_new_message(), play_dialtone(), poll_mailbox(), run_externnotify(), and unistim_send_mwi_to_peer().
int ast_app_inboxcount | ( | const char * | mailboxes, |
int * | newmsgs, | ||
int * | oldmsgs | ||
) |
Determine number of new/old messages in a mailbox.
[in] | mailboxes | Mailbox specification in the format /code mbox[@context][&mbox2[@context2]][...] /code |
[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 604 of file main/app.c.
References inboxcount(), mailboxes, and VM_API_CALL.
Referenced by update_registry().
int ast_app_inboxcount2 | ( | const char * | mailboxes, |
int * | urgentmsgs, | ||
int * | newmsgs, | ||
int * | oldmsgs | ||
) |
Determine number of urgent/new/old messages in a mailbox.
[in] | mailboxes | the mailbox context to use |
[out] | urgentmsgs | the urgent message count |
[out] | newmsgs | the new message count |
[out] | oldmsgs | the old message count |
0 | for success |
negative | upon error |
Definition at line 619 of file main/app.c.
References inboxcount2(), mailboxes, and VM_API_CALL.
Referenced by action_mailboxcount(), mwi_retrieve_then_create_state(), notify_new_message(), notify_new_state(), and vm_execmain().
int ast_app_messagecount | ( | const char * | mailbox_id, |
const char * | folder | ||
) |
Get the number of messages in a given mailbox folder.
[in] | mailbox_id | Mailbox name |
[in] | folder | The folder to look in. Default is INBOX if not provided. |
Definition at line 645 of file main/app.c.
References messagecount(), and VM_API_CALL.
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 3076 of file main/app.c.
References ast_test_flag64, buf, ast_flags64::flags, len(), and options.
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 |
zero | for success |
non-zero | if an error occurs |
Definition at line 3066 of file main/app.c.
References args, ast_flags64::flags, options, and parse_options().
Referenced by agent_login_exec(), app_exec(), aqm_exec(), ast_multicast_rtp_create_options(), AST_TEST_DEFINE(), audiosocket_request(), auth_exec(), bridge_exec(), bridgewait_exec(), broadcast_exec(), cdr_read_callback(), cdr_write_callback(), chanspy_exec(), connectedline_write(), controlplayback_exec(), detect_write(), directory_exec(), disa_exec(), dundi_query_read(), dundifunc_read(), extenspy_exec(), forkcdr_exec(), geoloc_profile_read(), geoloc_profile_write(), handle_options(), hint_read(), json_decode_read(), manager_mixmonitor(), minivm_accmess_exec(), minivm_greet_exec(), minivm_record_exec(), mixmonitor_exec(), page_exec(), park_app_parse_data(), pbx_builtin_background(), pbx_builtin_waitexten(), pickupchan_exec(), queue_exec(), read_exec(), read_mf_exec(), read_sf_exec(), readexten_exec(), realtime_common(), receivefax_exec(), record_exec(), redirecting_write(), resetcdr_exec(), senddtmf_exec(), sendfax_exec(), sla_trunk_exec(), smdi_msg_retrieve_read(), sms_exec(), softhangup_exec(), speech_background(), unicast_rtp_request(), vm_exec(), vm_execmain(), volume_write(), and wait_exec().
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 |
zero | for success |
non-zero | if an error occurs |
Definition at line 3071 of file main/app.c.
References args, ast_flags64::flags, options, and parse_options().
Referenced by AST_TEST_DEFINE(), conf_exec(), dial_exec_full(), find_conf_realtime(), originate_exec(), and sayunixtime_exec().
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 3273 of file main/app.c.
References FMT, result, TIMELEN_HOURS, TIMELEN_MILLISECONDS, TIMELEN_MINUTES, and TIMELEN_SECONDS.
Referenced by ast_eivr_senddtmf(), ast_parse_arg(), new_realtime_sqlite3_db(), pbx_builtin_wait(), pbx_builtin_waitdigit(), pbx_builtin_waitexten(), senddtmf_exec(), and sendmf_exec().
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 328 of file main/app.c.
References ast_app_exec_sub(), ast_free, ast_malloc, ast_strlen_zero(), and ignore_hangup.
Referenced by ast_channel_connected_line_sub(), and ast_channel_redirecting_sub().
int ast_app_sayname | ( | struct ast_channel * | chan, |
const char * | mailbox_id | ||
) |
Play a recorded user name for the mailbox to the specified channel.
chan | Where to play the recorded name file. |
mailbox_id | The mailbox name. |
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 637 of file main/app.c.
References sayname(), and VM_GREETER_API_CALL.
Referenced by play_mailbox_owner(), and spy_sayname().
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 3202 of file main/app.c.
References closefrom().
Referenced by app_exec(), asterisk_daemon(), launch_script(), mp3play(), safe_exec_prep(), send_waveform_to_fd(), spawn_mp3(), 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 | Channel |
file | File to play. |
fwd,rev,stop,pause,restart | DTMF keys for media control |
skipms | Number of milliseconds to skip for fwd/rev. |
offsetms | Number of milliseconds to skip when starting the media. |
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.
0 | on success |
Non-zero | on failure |
Definition at line 1465 of file main/app.c.
References control_streamfile(), make_ari_stubs::file, NULL, skipms, stop, and suspend().
Referenced by controlplayback_exec(), handle_controlstreamfile(), and wait_file().
int ast_control_streamfile_lang | ( | struct ast_channel * | chan, |
const char * | file, | ||
const char * | fwd, | ||
const char * | rev, | ||
const char * | stop, | ||
const char * | suspend, | ||
const char * | restart, | ||
int | skipms, | ||
const char * | lang, | ||
long * | offsetms | ||
) |
Version of ast_control_streamfile() which allows the language of the media file to be specified.
0 | on success |
Non-zero | on failure |
Definition at line 1473 of file main/app.c.
References control_streamfile(), make_ari_stubs::file, NULL, skipms, stop, and suspend().
Referenced by play_on_channel().
int ast_control_streamfile_w_cb | ( | 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, | ||
ast_waitstream_fr_cb | cb | ||
) |
Stream a file with fast forward, pause, reverse, restart.
chan | |
file | filename |
fwd,rev,stop,pause,restart,skipms,offsetms | |
cb | waitstream callback to invoke when fastforward or rewind occurs. |
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 1451 of file main/app.c.
References control_streamfile(), make_ari_stubs::file, NULL, skipms, stop, and suspend().
int ast_control_tone | ( | struct ast_channel * | chan, |
const char * | tone | ||
) |
Controls playback of a tone.
0 | on success |
Non-zero | on failure |
Definition at line 1545 of file main/app.c.
References ast_channel_zone(), AST_FRAME_CONTROL, ast_get_indication_tone(), ast_get_indication_zone(), ast_playtones_start(), ast_read_noaudio(), ast_strdupa, ast_strlen_zero(), ast_tone_zone_sound_unref(), ast_tone_zone_unref(), ast_waitfor(), control_tone_frame_response(), CONTROL_TONE_RESPONSE_FAILED, CONTROL_TONE_RESPONSE_FINISHED, ast_tone_zone_sound::data, ast_frame::frametype, NULL, parse_tone_uri(), and ast_frame::ts.
Referenced by play_on_channel().
int ast_dtmf_stream | ( | struct ast_channel * | chan, |
struct ast_channel * | peer, | ||
const char * | digits, | ||
int | between, | ||
unsigned int | duration | ||
) |
Send a string of DTMF digits 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. |
0 | on success. |
-1 | on failure or a channel hung up. |
Definition at line 1127 of file main/app.c.
References ast_autoservice_start(), ast_autoservice_stop(), and dtmf_stream().
Referenced by ast_eivr_senddtmf(), bridge_channel_dtmf_stream(), dial_exec_full(), dtmf_no_bridge(), senddtmf_exec(), testclient_exec(), testserver_exec(), and wait_for_answer().
void ast_dtmf_stream_external | ( | struct ast_channel * | chan, |
const char * | digits, | ||
int | between, | ||
unsigned int | duration | ||
) |
Send a string of DTMF digits to a channel from an external thread.
chan | The channel that will receive the DTMF frames |
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 1142 of file main/app.c.
References dtmf_stream().
Referenced by dtmf_in_bridge().
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 3087 of file main/app.c.
References ast_debug, ast_log, ast_strlen_zero(), LOG_ERROR, and result.
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 3162 of file main/app.c.
References ast_get_encoded_char(), and result.
Referenced by chan_pjsip_new(), listfilter(), and replace().
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 273 of file main/app.c.
References app_stack_callbacks.
Referenced by load_module(), and unload_module().
int ast_ivr_menu_run | ( | struct ast_channel * | c, |
struct ast_ivr_menu * | menu, | ||
void * | cbdata | ||
) |
Runs an IVR menu.
0 | on successful completion. |
-1 | on hangup. |
-2 | on user error in menu. |
Definition at line 2942 of file main/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 1235 of file main/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 2614 of file main/app.c.
References AST_LOCK_FAILURE, ast_lock_path_flock(), ast_lock_path_lockfile(), AST_LOCK_TYPE_FLOCK, AST_LOCK_TYPE_LOCKFILE, and path_lock::path.
Referenced by ast_module_reload(), test_vm_api_create_voicemail_files(), and vm_lock_path().
int ast_mf_stream | ( | struct ast_channel * | chan, |
struct ast_channel * | peer, | ||
struct ast_channel * | chan2, | ||
const char * | digits, | ||
int | between, | ||
unsigned int | duration, | ||
unsigned int | durationkp, | ||
unsigned int | durationst, | ||
int | is_external | ||
) |
Send a string of MF digits to a channel.
chan | The channel that will receive the MF digits. |
peer | (optional) Peer channel that will be autoserviced while the primary channel is receiving MF |
chan2 | A second channel that will simultaneously receive MF digits. This option may only be used if is_external is 0. |
digits | This is a string of characters representing the MF 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' or 'W' to add a wink (if supported by the channel). |
between | This is the number of milliseconds to wait in between each MF digit. If zero milliseconds is specified, then the default value of 50 will be used. |
duration | This is the duration that each numeric MF digit should have. Default value is 55. |
durationkp | This is the duration that each KP digit should have. Default is 120. |
durationst | This is the duration that each ST, STP, ST2P, or ST3P digit should have. Default is 65. |
is_external | 1 if called by a thread that is not the channel's media handler thread, 0 if called by the channel's media handler thread. |
0 | on success. |
-1 | on failure or a channel hung up. |
Definition at line 1113 of file main/app.c.
References ast_autoservice_start(), ast_autoservice_stop(), and mf_stream().
Referenced by manager_play_mf(), sendmf_exec(), and wait_for_answer().
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 2159 of file main/app.c.
References __ast_play_and_record(), AST_RECORD_IF_EXISTS_OVERWRITE, default_acceptdtmf, default_canceldtmf, maxsilence, NULL, and silencethreshold.
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 2154 of file main/app.c.
References __ast_play_and_record(), AST_RECORD_IF_EXISTS_OVERWRITE, default_acceptdtmf, default_canceldtmf, maxsilence, and silencethreshold.
Referenced by app_exec(), ast_record_review(), conf_rec_name(), 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 | beep, | ||
int | silencethreshold, | ||
int | maxsilence_ms, | ||
const char * | path, | ||
const char * | acceptdtmf, | ||
const char * | canceldtmf, | ||
int | skip_confirmation_sound, | ||
enum ast_record_if_exists | if_exists | ||
) |
Record a file based on input from a channel This function will play "auth-thankyou" upon successful recording if skip_confirmation_sound is false.
chan | the channel being recorded |
playfile | Filename of sound to play before recording begins. A beep is also played when playfile completes, before the 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 |
beep | If true, play a beep before recording begins (and doesn't play playfile) |
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 |
skip_confirmation_sound | If true, don't play auth-thankyou at end. Nice for custom recording prompts in apps. |
if_exists | Action to take if recording already exists. |
-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 2149 of file main/app.c.
References __ast_play_and_record(), default_canceldtmf, maxsilence, S_OR, and silencethreshold.
Referenced by play_record_review(), and record_file().
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 1616 of file main/app.c.
References ast_channel_language(), AST_DIGIT_ANY, ast_stopstream(), ast_streamfile(), ast_waitstream(), and d.
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(), get_folder_ja(), leave_voicemail(), minivm_greet_exec(), play_message_category(), play_message_duration(), play_record_review(), vm_authenticate(), vm_browse_messages_en(), vm_browse_messages_es(), vm_browse_messages_gr(), vm_browse_messages_he(), vm_browse_messages_it(), vm_browse_messages_ja(), vm_browse_messages_pt(), vm_browse_messages_vi(), vm_browse_messages_zh(), vm_exec(), vm_execmain(), vm_forwardoptions(), vm_instructions_en(), vm_instructions_ja(), vm_instructions_zh(), vm_intro(), vm_intro_cs(), vm_intro_da(), vm_intro_de(), vm_intro_en(), vm_intro_es(), vm_intro_fr(), vm_intro_gr(), vm_intro_he(), vm_intro_is(), vm_intro_it(), vm_intro_ja(), 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_setup(), vm_options(), vm_play_folder_name(), vm_play_folder_name_gr(), vm_play_folder_name_ja(), vm_play_folder_name_pl(), vm_play_folder_name_ua(), vm_tempgreeting(), and vmauthenticate().
struct stasis_topic * ast_queue_topic | ( | const char * | queuename | ) |
Get the Stasis Message Bus API topic for queue messages for a particular queue name.
queuename | The name for which to get the topic |
NULL | if it failed to be found or allocated |
Definition at line 3349 of file main/app.c.
References queue_topic_pool, and stasis_topic_pool_get_topic().
Referenced by send_agent_complete().
struct stasis_topic * ast_queue_topic_all | ( | void | ) |
Get the Stasis Message Bus API topic for queue messages.
NULL | if it has not been allocated |
Definition at line 3344 of file main/app.c.
References queue_topic_all.
Referenced by load_module().
char * ast_read_textfile | ( | const char * | file | ) |
Read a file into asterisk.
Definition at line 2949 of file main/app.c.
References ast_free, ast_log, ast_malloc, errno, LOG_WARNING, and NULL.
Referenced by ast_tcptls_server_start().
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 2646 of file main/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, NULL, path_lock::path, silencethreshold, and THRESHOLD_SILENCE.
Referenced by conf_rec_name(), and 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 801 of file extconf.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(), ast_safe_system(), handle_include_exec(), and safe_exec_prep().
int ast_safe_execvp | ( | int | dualfork, |
const char * | file, | ||
char *const | argv[] | ||
) |
Safely spawn an external program while closing file descriptors.
dualfork | Non-zero to simulate running the program in the background by forking twice. The option provides similar functionality to the '&' in the OS shell command "cmd &". The option allows Asterisk to run a reaper loop to watch the first fork which immediately exits after spaning the second fork. The actual program is run in the second fork. |
file | execvp(file, argv) file parameter |
argv | execvp(file, argv) argv parameter |
Definition at line 1223 of file asterisk.c.
References make_ari_stubs::file, safe_exec_prep(), and safe_exec_wait().
Referenced by run_externnotify().
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 3207 of file main/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, NULL, zombie::pid, shaun_of_the_dead(), and shaun_of_the_dead_thread.
Referenced by app_exec(), filestream_destructor(), launch_script(), mp3play(), send_waveform_to_fd(), spawn_mp3(), 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 3268 of file main/app.c.
References ast_unreplace_sigchld().
Referenced by agi_exec_full().
int ast_safe_system | ( | const char * | s | ) |
Safely spawn an OS shell command while closing file descriptors.
s | - OS shell command string to execute. |
Definition at line 829 of file extconf.c.
References ast_log(), ast_replace_sigchld(), ast_unreplace_sigchld(), errno, LOG_WARNING, NULL, safe_exec_prep(), safe_exec_wait(), status, WEXITSTATUS, and WIFEXITED.
Referenced by add_email_attachment(), alarmreceiver_exec(), AST_TEST_DEFINE(), consolehandler(), convert_bdb_to_sqlite3(), 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 2609 of file main/app.c.
References type.
Referenced by load_asterisk_conf().
int ast_sf_stream | ( | struct ast_channel * | chan, |
struct ast_channel * | peer, | ||
struct ast_channel * | chan2, | ||
const char * | digits, | ||
int | frequency, | ||
int | is_external | ||
) |
Send a string of SF digits to a channel.
chan | The channel that will receive the SF digits |
peer | (optional) Peer channel that will be autoserviced while the primary channel is receiving SF |
chan2 | A second channel that will simultaneously receive SF digits. This option may only be used if is_external is 0. |
digits | This is a string of characters representing the SF digits to be sent to the channel. Valid characters are "0123456789". Note: You can pass arguments 'f' or 'F', if you want to Flash the channel (if supported by the channel), or 'w' or 'W' to add a wink (if supported by the channel). |
frequency | The frequency to use for signaling. 0 can be specified for the default, which is 2600 Hz. |
is_external | 1 if called by a thread that is not the channel's media handler thread, 0 if called by the channel's media handler thread. |
0 | on success. |
-1 | on failure or a channel hung up. |
Definition at line 1097 of file main/app.c.
References ast_autoservice_start(), ast_autoservice_stop(), and sf_stream().
Referenced by sendsf_exec(), and wait_for_answer().
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 3175 of file main/app.c.
References ast_get_encoded_char(), ast_str_buffer(), ast_str_make_space, ast_str_set(), ast_str_size(), ast_str_update(), buf, and str.
Referenced by sendtext_exec(), and system_exec_helper().
AST_THREADSTORAGE_EXTERNAL | ( | ast_str_thread_global_buf | ) |
int ast_unlock_path | ( | const char * | path | ) |
Unlock a path.
Definition at line 2630 of file main/app.c.
References AST_LOCK_TYPE_FLOCK, AST_LOCK_TYPE_LOCKFILE, ast_unlock_path_flock(), ast_unlock_path_lockfile(), and path_lock::path.
Referenced by __ast_play_and_record(), access_counter_file(), ast_module_reload(), close_mailbox(), copy_message(), count_messages(), leave_voicemail(), msg_create_from_file(), open_mailbox(), resequence_mailbox(), save_to_folder(), and test_vm_api_create_voicemail_files().
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 815 of file extconf.c.
References ast_assert, ast_mutex_lock, ast_mutex_unlock, NULL, safe_system_level, safe_system_lock, and safe_system_prev_handler.
Referenced by ast_safe_fork_cleanup(), ast_safe_system(), handle_include_exec(), and safe_exec_wait().
int ast_vm_greeter_is_registered | ( | void | ) |
Determine if a voicemail greeter provider is registered.
0 | if no provider registered. |
1 | if a provider is registered. |
Definition at line 468 of file main/app.c.
References ao2_cleanup, ao2_global_obj_ref, and table.
void ast_vm_greeter_unregister | ( | const char * | module_name | ) |
Unregister the specified voicemail greeter provider.
module_name | The module name of the provider to unregister |
Definition at line 511 of file main/app.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_global_obj_release, ast_vm_greeter_functions::module_name, and table.
Referenced by unload_module().
const char * ast_vm_index_to_foldername | ( | int | id | ) |
Return name of folder, given an id.
[in] | id | Folder id |
Definition at line 653 of file main/app.c.
References NULL, and VM_API_CALL.
int ast_vm_is_registered | ( | void | ) |
Determine if a voicemail provider is registered.
0 | if no provider registered. |
1 | if a provider is registered. |
Definition at line 357 of file main/app.c.
References ao2_cleanup, ao2_global_obj_ref, and table.
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_create | ( | const char * | mailbox, |
const char * | context, | ||
const char * | folder, | ||
int | descending, | ||
enum ast_vm_snapshot_sort_val | sort_val, | ||
int | combine_INBOX_and_OLD | ||
) |
Create a snapshot of a mailbox which contains information about every msg.
mailbox | the mailbox to look for |
context | the context to look for the mailbox in |
folder | OPTIONAL. When not NULL only msgs from the specified folder will be included. |
descending | list the msgs in descending order rather than ascending order. |
sort_val | What to sort in the snapshot. |
combine_INBOX_and_OLD | When this argument is set, The OLD folder will be represented in the INBOX folder of the snapshot. This allows the snapshot to represent the OLD and INBOX messages in sorted order merged together. |
NULL | on failure |
Definition at line 661 of file main/app.c.
References voicemailpwcheck::context, voicemailpwcheck::mailbox, NULL, and VM_API_CALL.
Referenced by append_vmbox_info_astman(), complete_voicemail_move_message(), show_mailbox_snapshot(), and test_vm_api_remove_all_messages().
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_destroy | ( | struct ast_vm_mailbox_snapshot * | mailbox_snapshot | ) |
destroy a snapshot
mailbox_snapshot | The snapshot to destroy. |
NULL |
Definition at line 675 of file main/app.c.
References NULL, and VM_API_CALL.
Referenced by append_vmbox_info_astman(), AST_TEST_DEFINE(), complete_voicemail_move_message(), show_mailbox_snapshot(), and test_vm_api_remove_all_messages().
int ast_vm_msg_forward | ( | const char * | from_mailbox, |
const char * | from_context, | ||
const char * | from_folder, | ||
const char * | to_mailbox, | ||
const char * | to_context, | ||
const char * | to_folder, | ||
size_t | num_msgs, | ||
const char * | msg_ids[], | ||
int | delete_old | ||
) |
forward a message from one mailbox to another.
from_mailbox The original mailbox the message is being forwarded from
from_context The voicemail context of the from_mailbox
from_folder The folder from which the message is being forwarded
to_mailbox The mailbox to forward the message to
to_context The voicemail context of the to_mailbox
to_folder The folder to which the message is being forwarded
num_msgs The number of messages being forwarded
msg_ids The message IDs of the messages in from_mailbox to forward
delete_old If non-zero, the forwarded messages are also deleted from from_mailbox. Otherwise, the messages will remain in the from_mailbox.
-1 | Failure |
0 | Success |
Definition at line 709 of file main/app.c.
References sip_to_pjsip::from_mailbox(), and VM_API_CALL.
int ast_vm_msg_move | ( | const char * | mailbox, |
const char * | context, | ||
size_t | num_msgs, | ||
const char * | oldfolder, | ||
const char * | old_msg_ids[], | ||
const char * | newfolder | ||
) |
Move messages from one folder to another.
mailbox | The mailbox to which the folders belong |
context | The voicemail context for the mailbox |
num_msgs | The number of messages to move |
oldfolder | The folder from where messages should be moved |
old_msg_ids | The message IDs of the messages to move |
newfolder | The folder to which messages should be moved new folder. This array must be num_msgs sized. |
-1 | Failure |
0 | Success |
Definition at line 683 of file main/app.c.
References voicemailpwcheck::context, voicemailpwcheck::mailbox, and VM_API_CALL.
int ast_vm_msg_play | ( | struct ast_channel * | chan, |
const char * | mailbox, | ||
const char * | context, | ||
const char * | folder, | ||
const char * | msg_num, | ||
ast_vm_msg_play_cb * | cb | ||
) |
Play a voicemail msg back on a channel.
chan | |
mailbox | msg is in. |
context | of mailbox. |
folder | voicemail folder to look in. |
msg_num | message number in the voicemailbox to playback to the channel. |
cb |
0 | success |
-1 | failure |
Definition at line 726 of file main/app.c.
References voicemailpwcheck::context, voicemailpwcheck::mailbox, and VM_API_CALL.
int ast_vm_msg_remove | ( | const char * | mailbox, |
const char * | context, | ||
size_t | num_msgs, | ||
const char * | folder, | ||
const char * | msgs[] | ||
) |
Remove/delete messages from a mailbox folder.
mailbox | The mailbox from which to delete messages |
context | The voicemail context for the mailbox |
num_msgs | The number of messages to delete |
folder | The folder from which to remove messages |
msgs | The message IDs of the messages to delete |
-1 | Failure |
0 | Success |
Definition at line 697 of file main/app.c.
References voicemailpwcheck::context, voicemailpwcheck::mailbox, and VM_API_CALL.
void ast_vm_unregister | ( | const char * | module_name | ) |
Unregister the specified voicemail provider.
module_name | The module name of the provider to unregister |
Definition at line 400 of file main/app.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_global_obj_release, ast_vm_functions::module_name, and table.
Referenced by unload_module().