23#ifndef _ASTERISK_APP_H
24#define _ASTERISK_APP_H
36#if defined(__cplusplus) || defined(c_plusplus)
106#define AST_IVR_FLAG_AUTORESTART (1 << 0)
108#define AST_IVR_DECLARE_MENU(holder, title, flags, foo...) \
109 static struct ast_ivr_option __options_##holder[] = foo;\
110 static struct ast_ivr_menu holder = { title, flags, __options_##holder }
430 const char *
context,
const char *folder,
int descending,
461 const char *oldfolder,
const char *old_msg_ids[],
const char *newfolder);
478 const char *folder,
const char *msgs[]);
500 const char *from_folder,
const char *to_mailbox,
const char *to_context,
501 const char *to_folder,
size_t num_msgs,
const char *msg_ids[],
int delete_old);
521#define VM_MODULE_VERSION 2
573#define ast_vm_register(vm_table) __ast_vm_register(vm_table, AST_MODULE_SELF)
595void ast_vm_test_swap_table_out(
void);
598#define VM_GREETER_MODULE_VERSION 1
640#define ast_vm_greeter_register(vm_table) __ast_vm_greeter_register(vm_table, AST_MODULE_SELF)
651typedef int (ast_vm_test_create_user_fn)(
const char *
context,
const char *
user);
652typedef int (ast_vm_test_destroy_user_fn)(
const char *
context,
const char *
user);
654void ast_install_vm_test_functions(ast_vm_test_create_user_fn *vm_test_create_user_func,
655 ast_vm_test_destroy_user_fn *vm_test_destroy_user_func);
657void ast_uninstall_vm_test_functions(
void);
756 int combine_INBOX_and_OLD);
783 const char *oldfolder,
784 const char *old_msg_ids[],
785 const char *newfolder);
823 const char *from_context,
824 const char *from_folder,
825 const char *to_mailbox,
826 const char *to_context,
827 const char *to_folder,
829 const char *msg_ids[],
853int ast_vm_test_destroy_user(
const char *
context,
const char *
mailbox);
854int ast_vm_test_create_user(
const char *
context,
const char *
mailbox);
964 int between,
unsigned int duration,
unsigned int durationkp,
unsigned int durationst,
int is_external);
1039 const char *fwd,
const char *rev,
const char *
stop,
const char *
suspend,
1040 const char *restart,
int skipms,
const char *lang,
long *offsetms);
1068 const char *restart,
1117int 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);
1230#define AST_APP_ARG(name) char *name
1247#define AST_DECLARE_APP_ARGS(name, arglist) AST_DEFINE_APP_ARGS_TYPE(argtype_##name, arglist) name = { 0, }
1264#define AST_DEFINE_APP_ARGS_TYPE(type, arglist) \
1265 struct __subtype_##type { arglist }; \
1267 unsigned int argc; \
1269 char *argv[sizeof(struct __subtype_##type) / sizeof(char*)]; \
1270 struct { arglist }; \
1283#define AST_STANDARD_APP_ARGS(args, parse) \
1284 args.argc = __ast_app_separate_args(parse, ',', 1, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0])))
1285#define AST_STANDARD_RAW_ARGS(args, parse) \
1286 args.argc = __ast_app_separate_args(parse, ',', 0, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0])))
1298#define AST_NONSTANDARD_APP_ARGS(args, parse, sep) \
1299 args.argc = __ast_app_separate_args(parse, sep, 1, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0])))
1300#define AST_NONSTANDARD_RAW_ARGS(args, parse, sep) \
1301 args.argc = __ast_app_separate_args(parse, sep, 0, args.argv, ((sizeof(args) - offsetof(typeof(args), argv)) / sizeof(args.argv[0])))
1319#define ast_app_separate_args(a,b,c,d) __ast_app_separate_args(a,b,1,c,d)
1341#define BEGIN_OPTIONS {
1342#define END_OPTIONS }
1391#define AST_APP_OPTIONS(holder, options...) \
1392 static const struct ast_app_option holder[128] = options
1400#define AST_APP_OPTION(option, flagno) \
1401 [option] = { .flag = flagno }
1411#define AST_APP_OPTION_ARG(option, flagno, argno) \
1412 [option] = { .flag = flagno, .arg_index = argno + 1 }
1454int ast_record_review(
struct ast_channel *chan,
const char *playfile,
const char *recordfile,
int maxtime,
const char *fmt,
int *duration,
const char *path);
1538#if defined(__cplusplus) || defined(c_plusplus)
static const struct ast_vm_functions vm_table
static int silencethreshold
static struct ast_str * prompt
static void suspend(struct cc_core_instance *core_instance)
Generic File Format Support. Should be included by clients of the file handling routines....
void() ast_waitstream_fr_cb(struct ast_channel *chan, long ms, enum ast_waitstream_fr_cb_values val)
callback used during dtmf controlled file playback to indicate location of playback in a file after r...
static int array(struct ast_channel *chan, const char *cmd, char *var, const char *value)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
const char * ast_app_expand_sub_args(struct ast_channel *chan, const char *args)
Add missing context/exten to subroutine argument string.
int ast_app_group_get_count(const char *group, const char *category)
Get the current channel count of the specified group and category.
int __ast_vm_greeter_register(const struct ast_vm_greeter_functions *vm_table, struct ast_module *module)
Set voicemail greeter function callbacks.
AST_THREADSTORAGE_EXTERNAL(ast_str_thread_global_buf)
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.
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 fu...
void ast_safe_fork_cleanup(void)
Common routine to cleanup after fork'ed process is complete (if reaping was stopped)
@ AST_GETDATA_INTERRUPTED
@ AST_GETDATA_EMPTY_END_TERMINATED
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 r...
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.
int ast_app_messagecount(const char *mailbox_id, const char *folder)
Get the number of messages in a given mailbox folder.
int __ast_vm_register(const struct ast_vm_functions *vm_table, struct ast_module *module)
Set voicemail function callbacks.
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.
int() ast_inboxcount_fn(const char *mailboxes, int *newmsgs, int *oldmsgs)
Gets the number of messages that exist for the mailbox list.
int ast_get_encoded_char(const char *stream, char *result, size_t *consumed)
Decode an encoded control or extended ASCII character.
struct ast_vm_mailbox_snapshot *() ast_vm_mailbox_snapshot_destroy_fn(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
destroy a snapshot
int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, int allowoverride)
Stream a filename (or file descriptor) as a generator.
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.
int app_init(void)
Initialize the application core.
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.
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.
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.
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.
@ AST_LOCK_PATH_NOT_FOUND
struct stasis_topic * ast_queue_topic(const char *queuename)
Get the Stasis Message Bus API topic for queue messages for a particular queue name.
int ast_safe_execvp(int dualfork, const char *file, char *const argv[])
Safely spawn an external program while closing file descriptors.
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.
void ast_vm_greeter_unregister(const char *module_name)
Unregister the specified voicemail greeter provider.
int ast_control_tone(struct ast_channel *chan, const char *tone)
Controls playback of a tone.
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.
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.
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.
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 p...
@ AST_VM_SNAPSHOT_SORT_BY_ID
@ AST_VM_SNAPSHOT_SORT_BY_TIME
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.
int ast_app_group_update(struct ast_channel *oldchan, struct ast_channel *newchan)
Update all group counting for a channel to a new one.
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.
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 li...
int ast_app_group_list_wrlock(void)
Write Lock the group count list.
void ast_replace_sigchld(void)
Replace the SIGCHLD handler.
enum AST_LOCK_RESULT ast_lock_path(const char *path)
Lock a filesystem path.
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"....
int ast_safe_fork(int stop_reaper)
Common routine to safely fork without a chance of a signal handler firing badly in the child.
void ast_install_stack_functions(const struct ast_app_stack_funcs *funcs)
Set stack application function callbacks.
int ast_ivr_menu_run(struct ast_channel *c, struct ast_ivr_menu *menu, void *cbdata)
Runs an IVR menu.
AST_LOCK_TYPE
Type of locking to use in ast_lock_path / ast_unlock_path.
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.
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.
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_destroy(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
destroy a snapshot
int() ast_inboxcount2_fn(const char *mailboxes, int *urgentmsgs, int *newmsgs, int *oldmsgs)
Gets the number of messages that exist for the mailbox list.
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.
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 cre...
int ast_safe_system(const char *s)
Safely spawn an OS shell command while closing file descriptors.
int ast_vm_greeter_is_registered(void)
Determine if a voicemail greeter provider is registered.
int ast_app_group_list_unlock(void)
Unlock the group count list.
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.
char * ast_get_encoded_str(const char *stream, char *result, size_t result_len)
Decode a stream of encoded control or extended ASCII characters.
void ast_vm_unregister(const char *module_name)
Unregister the specified voicemail provider.
void ast_set_lock_type(enum AST_LOCK_TYPE type)
Set the type of locks used by ast_lock_path()
int ast_app_inboxcount(const char *mailboxes, int *newmsgs, int *oldmsgs)
Determine number of new/old messages in a mailbox.
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.
int() ast_messagecount_fn(const char *mailbox_id, const char *folder)
Gets the number of messages that exist in a mailbox folder.
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.
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.
void() ast_vm_msg_play_cb(struct ast_channel *chan, const char *playfile, int duration)
Voicemail playback callback function definition.
int ast_app_sayname(struct ast_channel *chan, const char *mailbox_id)
Play a recorded user name for the mailbox to the specified channel.
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.
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.
@ AST_RECORD_IF_EXISTS_FAIL
@ AST_RECORD_IF_EXISTS_APPEND
@ AST_RECORD_IF_EXISTS_OVERWRITE
@ AST_RECORD_IF_EXISTS_ERROR
const char *() ast_vm_index_to_foldername_fn(int id)
Convert the mailbox folder id to a folder name.
const char * ast_vm_index_to_foldername(int id)
Return name of folder, given an id.
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.
int ast_app_inboxcount2(const char *mailboxes, int *urgentmsgs, int *newmsgs, int *oldmsgs)
Determine number of urgent/new/old messages in a mailbox.
int() ast_ivr_callback(struct ast_channel *chan, char *option, void *cbdata)
Callback function for IVR.
char * ast_read_textfile(const char *file)
Read a file into asterisk.
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.
void ast_unreplace_sigchld(void)
Restore the SIGCHLD handler.
struct ast_group_info * ast_app_group_list_head(void)
Get the head of the group count list.
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.
int ast_app_group_discard(struct ast_channel *chan)
Discard all group counting for a channel.
int ast_vm_is_registered(void)
Determine if a voicemail provider is registered.
struct stasis_topic * ast_queue_topic_all(void)
Get the Stasis Message Bus API topic for queue messages.
int() ast_sayname_fn(struct ast_channel *chan, const char *mailbox_id)
Play a recorded user name for the mailbox to the specified channel.
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.
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.
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.
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.
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.
int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, size_t size, int maxlen, int timeout)
Present a dialtone and collect a certain length extension.
int ast_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.
int ast_unlock_path(const char *path)
Unlock a path.
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.
int() ast_has_voicemail_fn(const char *mailboxes, const char *folder)
Determines if the given folder has messages.
int ast_app_group_list_rdlock(void)
Read Lock the group count list.
void ast_close_fds_above_n(int n)
Common routine for child processes, to close all fds prior to exec(2)
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
def from_mailbox(key, val, section, pjsip, nmapped)
static struct stasis_rest_handlers mailboxes
REST handler for /api-docs/mailboxes.json.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
String manipulation functions.
A structure to hold the description of an application 'option'.
uint64_t flag
The flag bit that represents this option.
unsigned int arg_index
The index of the entry in the arguments array that should be used for this option's argument.
Stack applications callback functions.
int(* run_sub)(struct ast_channel *chan, const char *args, int ignore_hangup)
Callback for the routine to run a subroutine on a channel.
Main Channel structure associated with a channel.
Structure used to handle a large number of boolean flags == used only in app_dial?
Structure used to handle boolean flags.
struct ast_channel * chan
Support for dynamic strings.
Voicemail function table definition.
ast_has_voicemail_fn * has_voicemail
unsigned int module_version
The version of this function table.
ast_vm_mailbox_snapshot_destroy_fn * mailbox_snapshot_destroy
const char * module_name
The name of the module that provides the voicemail functionality.
ast_inboxcount_fn * inboxcount
ast_vm_msg_remove_fn * msg_remove
ast_inboxcount2_fn * inboxcount2
struct ast_module * module
The module for the voicemail provider.
ast_vm_msg_move_fn * msg_move
ast_vm_index_to_foldername_fn * index_to_foldername
ast_messagecount_fn * messagecount
ast_vm_mailbox_snapshot_create_fn * mailbox_snapshot_create
ast_vm_msg_play_fn * msg_play
ast_vm_msg_forward_fn * msg_forward
ast_copy_recording_to_vm_fn * copy_recording_to_vm
Voicemail greeter function table definition.
unsigned int module_version
The version of this function table.
const char * module_name
The name of the module that provides the voicemail greeter functionality.
struct ast_module * module
The module for the voicemail greeter provider.
struct ast_vm_mailbox_snapshot::@185 * snapshots
const ast_string_field folder_name
const ast_string_field callerid
const ast_string_field origtime
struct ast_vm_msg_snapshot::@184 msg
const ast_string_field msg_id
const ast_string_field exten
const ast_string_field callerchan
const ast_string_field duration
const ast_string_field origdate
Structure used for ast_copy_recording_to_vm in order to cleanly supply data needed for making the rec...
const ast_string_field recording_file
const ast_string_field call_callerchan
const ast_string_field context
const ast_string_field folder
const ast_string_field call_callerid
const ast_string_field call_context
const ast_string_field recording_ext
const ast_string_field call_extension
const ast_string_field mailbox
structure to hold users read from users.conf
Definitions to aid in the use of thread local storage.