External IVR application interface. More...
#include "asterisk.h"
#include <signal.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/linkedlists.h"
#include "asterisk/app.h"
#include "asterisk/utils.h"
#include "asterisk/tcptls.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
Data Structures | |
struct | ivr_localuser::finishlist |
struct | gen_state |
struct | ivr_localuser |
struct | ivr_localuser::playlist |
struct | playlist_entry |
Macros | |
#define | ast_chan_log(level, channel, format,...) ast_log(level, "%s: " format, channel->name , ## __VA_ARGS__) |
#define | EIVR_CMD_ANS 'T' /* answer channel */ |
#define | EIVR_CMD_APND 'A' /* append to prompt queue */ |
#define | EIVR_CMD_DTMF 'D' /* send DTMF */ |
#define | EIVR_CMD_EXIT 'E' /* exit */ |
#define | EIVR_CMD_GET 'G' /* get channel varable(s) */ |
#define | EIVR_CMD_HGUP 'H' /* hangup */ |
#define | EIVR_CMD_LOG 'L' /* log message */ |
#define | EIVR_CMD_OPT 'O' /* option */ |
#define | EIVR_CMD_PARM 'P' /* return supplied params */ |
#define | EIVR_CMD_SQUE 'S' /* (re)set prompt queue */ |
#define | EIVR_CMD_SVAR 'V' /* set channel varable(s) */ |
#define | EIVR_CMD_XIT 'X' /* exit **depricated** */ |
Enumerations | |
enum | options_flags { noanswer = (1 << 0), ignore_hangup = (1 << 1), run_dead = (1 << 2) } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | app_exec (struct ast_channel *chan, const char *data) |
static void | ast_eivr_getvariable (struct ast_channel *chan, char *data, char *outbuf, int outbuflen) |
static void | ast_eivr_senddtmf (struct ast_channel *chan, char *vdata) |
static void | ast_eivr_setvariable (struct ast_channel *chan, char *data) |
static int | eivr_comm (struct ast_channel *chan, struct ivr_localuser *u, int *eivr_events_fd, int *eivr_commands_fd, int *eivr_errors_fd, const struct ast_str *args, const struct ast_flags flags) |
int | eivr_connect_socket (struct ast_channel *chan, const char *host, int port) |
static void * | gen_alloc (struct ast_channel *chan, void *params) |
static void | gen_closestream (struct gen_state *state) |
static int | gen_generate (struct ast_channel *chan, void *data, int len, int samples) |
static int | gen_nextfile (struct gen_state *state) |
static struct ast_frame * | gen_readframe (struct gen_state *state) |
static void | gen_release (struct ast_channel *chan, void *data) |
static int | load_module (void) |
static struct playlist_entry * | make_entry (const char *filename) |
static void | send_eivr_event (FILE *handle, const char event, const char *data, const struct ast_channel *chan) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "External IVR Interface Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static const char | app [] = "ExternalIVR" |
static struct ast_app_option | app_opts [128] = { [ 'n' ] = { .flag = noanswer }, [ 'i' ] = { .flag = ignore_hangup }, [ 'd' ] = { .flag = run_dead }, } |
static struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_generator | gen |
External IVR application interface.
Definition in file app_externalivr.c.
#define ast_chan_log | ( | level, | |
channel, | |||
format, | |||
... | |||
) | ast_log(level, "%s: " format, channel->name , ## __VA_ARGS__) |
Definition at line 100 of file app_externalivr.c.
Referenced by app_exec(), eivr_comm(), gen_generate(), and gen_nextfile().
#define EIVR_CMD_ANS 'T' /* answer channel */ |
Definition at line 112 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_APND 'A' /* append to prompt queue */ |
Definition at line 103 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_DTMF 'D' /* send DTMF */ |
Definition at line 104 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_EXIT 'E' /* exit */ |
Definition at line 105 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_GET 'G' /* get channel varable(s) */ |
Definition at line 106 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_HGUP 'H' /* hangup */ |
Definition at line 107 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_LOG 'L' /* log message */ |
Definition at line 108 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_OPT 'O' /* option */ |
Definition at line 109 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_PARM 'P' /* return supplied params */ |
Definition at line 110 of file app_externalivr.c.
Referenced by eivr_comm().
Definition at line 111 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_SVAR 'V' /* set channel varable(s) */ |
Definition at line 113 of file app_externalivr.c.
Referenced by eivr_comm().
#define EIVR_CMD_XIT 'X' /* exit **depricated** */ |
Definition at line 114 of file app_externalivr.c.
Referenced by eivr_comm().
enum options_flags |
Enumerator | |
---|---|
noanswer | |
ignore_hangup | |
run_dead |
Definition at line 116 of file app_externalivr.c.
|
static |
Definition at line 891 of file app_externalivr.c.
|
static |
Definition at line 891 of file app_externalivr.c.
|
static |
Definition at line 389 of file app_externalivr.c.
References ast_channel::_state, ivr_localuser::abort_current_sound, ast_tcptls_session_args::accept_fd, ao2_ref, app_opts, ast_activate_generator(), ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_chan_log, ast_close_fds_above_n(), ast_copy_string(), ast_deactivate_generator(), ast_debug, AST_DECLARE_APP_ARGS, ast_free, ast_gethostbyname(), AST_LIST_HEAD_INIT_VALUE, AST_LIST_REMOVE_HEAD, ast_log(), ast_opt_high_priority, ast_safe_fork(), ast_set_priority(), ast_sockaddr_from_sin, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_str_alloca, ast_str_append(), ast_str_reset(), ast_strdupa, ast_strlen_zero(), ast_tcptls_client_create(), ast_tcptls_client_start(), ast_test_flag, ast_verb, ivr_localuser::chan, eivr_comm(), errno, ast_tcptls_session_instance::fd, ivr_localuser::gen_active, hostname, ast_hostent::hp, ignore_hangup, LOG_ERROR, noanswer, ivr_localuser::playlist, ast_tcptls_session_args::remote_address, and run_dead.
Referenced by load_module().
|
static |
Definition at line 301 of file app_externalivr.c.
References ast_channel_lock, ast_channel_unlock, ast_copy_string(), ast_str_alloca, ast_str_append(), ast_str_buffer(), inbuf(), pbx_builtin_getvar_helper(), strsep(), and value.
Referenced by eivr_comm().
|
static |
Definition at line 353 of file app_externalivr.c.
References args, AST_APP_ARG, ast_app_parse_timelen(), AST_DECLARE_APP_ARGS, ast_dtmf_stream(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_verb, and TIMELEN_MILLISECONDS.
Referenced by eivr_comm().
|
static |
Definition at line 334 of file app_externalivr.c.
References ast_debug, ast_strdupa, inbuf(), pbx_builtin_setvar_helper(), strsep(), and value.
Referenced by eivr_comm().
|
static |
Definition at line 599 of file app_externalivr.c.
References ast_channel::_state, ivr_localuser::abort_current_sound, ast_activate_generator(), ast_answer(), ast_chan_log, ast_check_hangup(), AST_CONTROL_HANGUP, ast_eivr_getvariable(), ast_eivr_senddtmf(), ast_eivr_setvariable(), ast_fileexists(), AST_FLAG_ZOMBIE, AST_FRAME_CONTROL, AST_FRAME_DTMF, ast_free, ast_frfree, AST_LIST_EMPTY, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_read(), AST_STATE_UP, ast_str_buffer(), ast_strip(), ast_test_flag, ast_verb, ast_waitfor_nandfds(), ivr_localuser::chan, ast_frame::data, EIVR_CMD_ANS, EIVR_CMD_APND, EIVR_CMD_DTMF, EIVR_CMD_EXIT, EIVR_CMD_GET, EIVR_CMD_HGUP, EIVR_CMD_LOG, EIVR_CMD_OPT, EIVR_CMD_PARM, EIVR_CMD_SQUE, EIVR_CMD_SVAR, EIVR_CMD_XIT, errno, f, playlist_entry::filename, ivr_localuser::finishlist, ast_frame::frametype, ivr_localuser::gen_active, ast_channel::hangupcause, ignore_hangup, input(), ast_frame_subclass::integer, ast_channel::language, LOG_ERROR, LOG_NOTICE, LOG_WARNING, make_entry(), ivr_localuser::option_autoclear, ivr_localuser::playing_silence, ivr_localuser::playlist, run_dead, send_eivr_event(), ast_frame::subclass, and ast_frame::uint32.
Referenced by app_exec().
int eivr_connect_socket | ( | struct ast_channel * | chan, |
const char * | host, | ||
int | port | ||
) |
|
static |
Definition at line 172 of file app_externalivr.c.
References ast_calloc, state, and gen_state::u.
|
static |
Definition at line 185 of file app_externalivr.c.
References ast_closestream(), ivr_localuser::chan, gen_state::stream, ast_channel::stream, and gen_state::u.
Referenced by gen_nextfile(), gen_readframe(), and gen_release().
|
static |
Definition at line 270 of file app_externalivr.c.
References ast_chan_log, ast_frfree, ast_write(), errno, f, gen_readframe(), LOG_WARNING, gen_state::sample_queue, and ast_frame::samples.
|
static |
Definition at line 204 of file app_externalivr.c.
References ivr_localuser::abort_current_sound, ast_chan_log, AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_openstream_full(), ivr_localuser::chan, gen_state::current, errno, playlist_entry::filename, gen_closestream(), ast_channel::language, LOG_WARNING, ivr_localuser::playing_silence, ivr_localuser::playlist, gen_state::stream, and gen_state::u.
Referenced by gen_readframe().
Definition at line 238 of file app_externalivr.c.
References ivr_localuser::abort_current_sound, AST_LIST_FIRST, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_readframe(), gen_state::current, f, ivr_localuser::finishlist, gen_closestream(), gen_nextfile(), ivr_localuser::playing_silence, ivr_localuser::playlist, gen_state::stream, and gen_state::u.
Referenced by gen_generate().
|
static |
Definition at line 195 of file app_externalivr.c.
References ast_free, and gen_closestream().
|
static |
Definition at line 886 of file app_externalivr.c.
References app_exec(), and ast_register_application_xml.
|
static |
Definition at line 377 of file app_externalivr.c.
References ast_calloc, and playlist_entry::filename.
Referenced by eivr_comm().
|
static |
Definition at line 157 of file app_externalivr.c.
References ast_debug, ast_free, ast_str_append(), ast_str_buffer(), and ast_str_create().
Referenced by eivr_comm().
|
static |
Definition at line 881 of file app_externalivr.c.
References ast_unregister_application().
|
static |
Definition at line 891 of file app_externalivr.c.
|
static |
Definition at line 97 of file app_externalivr.c.
|
static |
Definition at line 126 of file app_externalivr.c.
Referenced by app_exec().
|
static |
Definition at line 891 of file app_externalivr.c.
|
static |
Definition at line 294 of file app_externalivr.c.
Referenced by ast_activate_generator(), reload_config(), and set_config().