Asterisk - The Open Source Telephony Project
18.5.0
|
AGI - the Asterisk Gateway Interface. More...
#include "asterisk.h"
#include <math.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <pthread.h>
#include "asterisk/paths.h"
#include "asterisk/network.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/astdb.h"
#include "asterisk/callerid.h"
#include "asterisk/cli.h"
#include "asterisk/image.h"
#include "asterisk/say.h"
#include "asterisk/app.h"
#include "asterisk/dsp.h"
#include "asterisk/musiconhold.h"
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/strings.h"
#include "asterisk/manager.h"
#include "asterisk/ast_version.h"
#include "asterisk/speech.h"
#include "asterisk/term.h"
#include "asterisk/xmldoc.h"
#include "asterisk/srv.h"
#include "asterisk/test.h"
#include "asterisk/netsock2.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/format_cache.h"
#include "asterisk/agi.h"
Go to the source code of this file.
Data Structures | |
struct | agi_cmd |
struct | agi_commands |
Macros | |
#define | AGI_BUF_INITSIZE 256 |
#define | AGI_BUF_LEN 2048 |
#define | AGI_BUF_SIZE 1024 |
#define | AGI_NANDFS_RETRY 3 |
#define | AGI_PORT 4573 |
#define | AMI_BUF_SIZE 2048 |
#define | AST_API_MODULE |
#define | ASYNC_AGI_BREAK 3 |
#define | MAX_AGI_CONNECT 2000 |
#define | MAX_ARGS 128 |
#define | MAX_CMD_LEN 80 |
#define | SRV_PREFIX "_agi._tcp." |
#define | TONE_BLOCK_SIZE 200 |
Enumerations | |
enum | agi_result { AGI_RESULT_FAILURE = -1, AGI_RESULT_SUCCESS, AGI_RESULT_SUCCESS_FAST, AGI_RESULT_SUCCESS_ASYNC, AGI_RESULT_NOTFOUND, AGI_RESULT_HANGUP } |
Functions | |
static void | __init_agi_buf (void) |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | action_add_agi_cmd (struct mansession *s, const struct message *m) |
Add a new command to execute by the Async AGI application. More... | |
static int | add_agi_cmd (struct ast_channel *chan, const char *cmd_buff, const char *cmd_id) |
static int | add_to_agi (struct ast_channel *chan) |
static struct ast_manager_event_blob * | agi_async_end_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | agi_async_exec_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | agi_async_start_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | agi_channel_to_ami (const char *type, struct stasis_message *message) |
static void | agi_destroy_commands_cb (void *data) |
static int | agi_exec (struct ast_channel *chan, const char *data) |
static struct ast_manager_event_blob * | agi_exec_end_to_ami (struct stasis_message *message) |
static int | agi_exec_full (struct ast_channel *chan, const char *data, int enhanced, int dead) |
static struct ast_manager_event_blob * | agi_exec_start_to_ami (struct stasis_message *message) |
static enum agi_result | agi_handle_command (struct ast_channel *chan, AGI *agi, char *buf, int dead) |
int AST_OPTIONAL_API_NAME() | ast_agi_register (struct ast_module *mod, agi_command *cmd) |
int AST_OPTIONAL_API_NAME() | ast_agi_register_multiple (struct ast_module *mod, struct agi_command *cmd, unsigned int len) |
int AST_OPTIONAL_API_NAME() | ast_agi_send (int fd, struct ast_channel *chan, char *fmt,...) |
int AST_OPTIONAL_API_NAME() | ast_agi_unregister (agi_command *cmd) |
int AST_OPTIONAL_API_NAME() | ast_agi_unregister_multiple (struct agi_command *cmd, unsigned int len) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (test_agi_null_docs) | |
static enum agi_result | async_agi_read_frame (struct ast_channel *chan) |
static int | deadagi_exec (struct ast_channel *chan, const char *data) |
static int | eagi_exec (struct ast_channel *chan, const char *data) |
static agi_command * | find_command (const char *const cmds[], int exact) |
static void | free_agi_cmd (struct agi_cmd *cmd) |
static int | get_agi_cmd (struct ast_channel *chan, struct agi_cmd **cmd) |
Retrieve the list head to the requested channel's AGI datastore. More... | |
static int | handle_answer (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_asyncagi_break (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_autohangup (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_channelstatus (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static char * | handle_cli_agi_add_cmd (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command to add applications to execute in Async AGI. More... | |
static char * | handle_cli_agi_debug (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_agi_dump_html (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_agi_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | handle_connection (const char *agiurl, const struct ast_sockaddr addr, const int netsockfd) |
static int | handle_controlstreamfile (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_dbdel (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_dbdeltree (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_dbget (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_dbput (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_exec (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_getdata (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_getoption (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
get option - really similar to the handle_streamfile, but with a timeout More... | |
static int | handle_getvariable (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_getvariablefull (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_hangup (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_noop (struct ast_channel *chan, AGI *agi, int arg, const char *const argv[]) |
static int | handle_recordfile (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_recvchar (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_recvtext (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_sayalpha (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_saydate (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_saydatetime (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_saydigits (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_saynumber (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
Say number in various language syntaxes. More... | |
static int | handle_sayphonetic (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_saytime (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_sendimage (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_sendtext (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_setcallerid (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_setcontext (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_setextension (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_setmusic (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_setpriority (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_setvariable (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_speechactivategrammar (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_speechcreate (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_speechdeactivategrammar (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_speechdestroy (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_speechloadgrammar (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_speechrecognize (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_speechset (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_speechunloadgrammar (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_streamfile (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_tddmode (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_verbose (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static int | handle_waitfordigit (struct ast_channel *chan, AGI *agi, int argc, const char *const argv[]) |
static char * | help_workhorse (int fd, const char *const match[]) |
static enum agi_result | launch_asyncagi (struct ast_channel *chan, int argc, char *argv[], int *efd) |
static enum agi_result | launch_ha_netscript (char *agiurl, char *argv[], int *fds) |
static enum agi_result | launch_netscript (char *agiurl, char *argv[], int *fds) |
static enum agi_result | launch_script (struct ast_channel *chan, char *script, int argc, char *argv[], int *fds, int *efd, int *opid) |
static int | load_module (void) |
static int | parse_args (char *s, int *max, const char *argv[]) |
static void | publish_async_exec_end (struct ast_channel *chan, int command_id, const char *command, int result_code, const char *result) |
static enum agi_result | run_agi (struct ast_channel *chan, char *request, AGI *agi, int pid, int *status, int dead, int argc, char *argv[]) |
static void | setup_env (struct ast_channel *chan, char *request, int fd, int enhanced, int argc, char *argv[]) |
static int | speech_streamfile (struct ast_channel *chan, const char *filename, const char *preflang, int offset) |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (agi_exec_start_type,.to_ami=agi_exec_start_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (agi_exec_end_type,.to_ami=agi_exec_end_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (agi_async_start_type,.to_ami=agi_async_start_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (agi_async_exec_type,.to_ami=agi_async_exec_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (agi_async_end_type,.to_ami=agi_async_end_to_ami,) | |
static int | unload_module (void) |
static void | write_html_escaped (FILE *htmlfile, char *str) |
Convert string to use HTML escaped characters. More... | |
static int | write_htmldump (const char *filename) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Asterisk Gateway Interface (AGI)" , .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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .requires = "res_speech", } |
static struct ast_threadstorage | agi_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_agi_buf , .custom_init = NULL , } |
static struct agi_commands | agi_commands = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static const struct ast_datastore_info | agi_commands_datastore_info |
static int | agidebug = 0 |
static char * | app = "AGI" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli_agi [] |
static struct agi_command | commands [] |
AGI commands list. More... | |
static char * | deadapp = "DeadAGI" |
static char * | eapp = "EAGI" |
AGI - the Asterisk Gateway Interface.
Definition in file res_agi.c.
#define AGI_BUF_INITSIZE 256 |
Definition at line 1484 of file res_agi.c.
Referenced by ast_agi_send().
#define AGI_BUF_SIZE 1024 |
Referenced by launch_asyncagi().
#define AGI_PORT 4573 |
Definition at line 1407 of file res_agi.c.
Referenced by launch_netscript().
#define AMI_BUF_SIZE 2048 |
Referenced by launch_asyncagi().
#define ASYNC_AGI_BREAK 3 |
Special return code for "asyncagi break" command.
Definition at line 1410 of file res_agi.c.
Referenced by agi_handle_command(), and handle_asyncagi_break().
#define MAX_AGI_CONNECT 2000 |
Definition at line 1405 of file res_agi.c.
Referenced by handle_connection().
#define MAX_ARGS 128 |
Definition at line 1388 of file res_agi.c.
Referenced by agi_exec_full(), agi_handle_command(), and parse_args().
#define MAX_CMD_LEN 80 |
Definition at line 1389 of file res_agi.c.
Referenced by ast_agi_register(), ast_agi_unregister(), handle_cli_agi_show(), help_workhorse(), and write_htmldump().
#define SRV_PREFIX "_agi._tcp." |
Definition at line 1392 of file res_agi.c.
Referenced by launch_ha_netscript().
enum agi_result |
Enumerator | |
---|---|
AGI_RESULT_FAILURE | |
AGI_RESULT_SUCCESS | |
AGI_RESULT_SUCCESS_FAST | |
AGI_RESULT_SUCCESS_ASYNC | |
AGI_RESULT_NOTFOUND | |
AGI_RESULT_HANGUP |
Definition at line 1412 of file res_agi.c.
|
static |
Add a new command to execute by the Async AGI application.
s | |
m | It will append the application to the specified channel's queue if the channel is not inside Async AGI application it will return an error |
0 | on success or incorrect use |
1 | on failure to add the command ( most likely because the channel is not in Async AGI loop ) |
Definition at line 1709 of file res_agi.c.
References add_agi_cmd(), agi_handle_command(), ast_channel_get_by_name(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_channel_unref, ast_strlen_zero, astman_get_header(), astman_send_ack(), astman_send_error(), buf, request(), and setup_env().
Referenced by load_module().
|
static |
Definition at line 1580 of file res_agi.c.
References agi_commands, ast_calloc, ast_channel_datastore_find(), ast_channel_name(), ast_free, AST_LIST_HEAD, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log, ast_strdup, agi_cmd::cmd_buffer, agi_cmd::cmd_id, ast_datastore::data, LOG_WARNING, and NULL.
Referenced by action_add_agi_cmd(), and handle_cli_agi_add_cmd().
|
static |
Definition at line 1613 of file res_agi.c.
References ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), AST_LIST_HEAD, AST_LIST_HEAD_INIT, ast_log, ast_datastore::data, LOG_ERROR, and NULL.
Referenced by launch_asyncagi().
|
static |
Definition at line 1460 of file res_agi.c.
References agi_async_exec_to_ami(), agi_async_start_to_ami(), agi_channel_to_ami(), agi_exec_end_to_ami(), agi_exec_start_to_ami(), find_command(), STASIS_MESSAGE_TYPE_DEFN_LOCAL(), and to_ami().
|
static |
Definition at line 1455 of file res_agi.c.
References agi_channel_to_ami().
Referenced by agi_async_end_to_ami().
|
static |
Definition at line 1450 of file res_agi.c.
References agi_channel_to_ami().
Referenced by agi_async_end_to_ami().
|
static |
Definition at line 1421 of file res_agi.c.
References ast_free, ast_manager_build_channel_state_string(), ast_manager_event_blob_create(), ast_manager_str_from_json_object(), ast_str_buffer(), ast_channel_blob::blob, EVENT_FLAG_AGI, NULL, RAII_VAR, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by agi_async_end_to_ami(), agi_async_exec_to_ami(), agi_async_start_to_ami(), agi_exec_end_to_ami(), and agi_exec_start_to_ami().
|
static |
Definition at line 1530 of file res_agi.c.
References ast_free, AST_LIST_HEAD, AST_LIST_HEAD_DESTROY, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, and free_agi_cmd().
|
static |
Definition at line 4561 of file res_agi.c.
References agi_exec_full(), and ast_check_hangup().
Referenced by deadagi_exec(), and load_module().
|
static |
Definition at line 1445 of file res_agi.c.
References agi_channel_to_ami().
Referenced by agi_async_end_to_ami().
|
static |
Definition at line 4494 of file res_agi.c.
References AGI_RESULT_FAILURE, AGI_RESULT_HANGUP, AGI_RESULT_NOTFOUND, AGI_RESULT_SUCCESS, AGI_RESULT_SUCCESS_ASYNC, AGI_RESULT_SUCCESS_FAST, args, ast_answer(), AST_APP_ARG, ast_debug, AST_DECLARE_APP_ARGS, ast_log, ast_safe_fork_cleanup(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_strlen_zero, buf, launch_script(), LOG_WARNING, MAX_ARGS, NULL, pbx_builtin_setvar_helper(), run_agi(), and status.
Referenced by agi_exec(), and eagi_exec().
|
static |
Definition at line 1440 of file res_agi.c.
References agi_channel_to_ami().
Referenced by agi_async_end_to_ami().
|
static |
Definition at line 4021 of file res_agi.c.
References AGI_RESULT_FAILURE, AGI_RESULT_SUCCESS, AGI_RESULT_SUCCESS_ASYNC, ast_agi_send(), ast_channel_publish_cached_blob(), ast_json_pack(), ast_json_unref(), ast_module_running_ref, ast_module_unref, ast_random(), ast_strdupa, ast_strlen_zero, ASYNC_AGI_BREAK, c, agi_command::dead, agi_state::fd, find_command(), agi_command::handler, MAX_ARGS, agi_command::mod, NULL, parse_args(), publish_async_exec_end(), RAII_VAR, RESULT_FAILURE, RESULT_SHOWUSAGE, RESULT_SUCCESS, and agi_command::usage.
Referenced by action_add_agi_cmd(), launch_asyncagi(), and run_agi().
int AST_OPTIONAL_API_NAME() ast_agi_register | ( | struct ast_module * | mod, |
agi_command * | cmd | ||
) |
Definition at line 3783 of file res_agi.c.
References ast_join, AST_LIST_INSERT_TAIL, ast_log, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, AST_STATIC_DOC, ast_strdup, ast_strlen_zero, ast_verb, AST_XML_DOC, ast_xmldoc_build_description(), ast_xmldoc_build_seealso(), ast_xmldoc_build_synopsis(), ast_xmldoc_build_syntax(), find_command(), LOG_WARNING, MAX_CMD_LEN, and NULL.
Referenced by ast_agi_register_multiple(), AST_TEST_DEFINE(), and load_module().
int AST_OPTIONAL_API_NAME() ast_agi_register_multiple | ( | struct ast_module * | mod, |
struct agi_command * | cmd, | ||
unsigned int | len | ||
) |
Definition at line 3863 of file res_agi.c.
References ast_agi_register(), ast_agi_unregister(), and len().
Referenced by __stub__ast_agi_unregister(), and load_module().
int AST_OPTIONAL_API_NAME() ast_agi_send | ( | int | fd, |
struct ast_channel * | chan, | ||
char * | fmt, | ||
... | |||
) |
Definition at line 1486 of file res_agi.c.
References agi_buf, AGI_BUF_INITSIZE, agidebug, ast_carefulwrite(), ast_channel_name(), ast_log, ast_str_buffer(), ast_str_set_va(), ast_str_strlen(), ast_str_thread_get(), ast_verbose(), buf, and LOG_ERROR.
Referenced by __stub__ast_agi_unregister_multiple(), agi_handle_command(), handle_answer(), handle_asyncagi_break(), handle_autohangup(), handle_channelstatus(), handle_controlstreamfile(), handle_dbdel(), handle_dbdeltree(), handle_dbget(), handle_dbput(), handle_exec(), handle_getdata(), handle_getoption(), handle_getvariable(), handle_getvariablefull(), handle_gosub(), handle_hangup(), handle_noop(), handle_recordfile(), handle_recvchar(), handle_recvtext(), handle_sayalpha(), handle_saydate(), handle_saydatetime(), handle_saydigits(), handle_saynumber(), handle_sayphonetic(), handle_saytime(), handle_sendimage(), handle_sendtext(), handle_setcallerid(), handle_setcontext(), handle_setextension(), handle_setmusic(), handle_setpriority(), handle_setvariable(), handle_speechactivategrammar(), handle_speechcreate(), handle_speechdeactivategrammar(), handle_speechdestroy(), handle_speechloadgrammar(), handle_speechrecognize(), handle_speechset(), handle_speechunloadgrammar(), handle_streamfile(), handle_tddmode(), handle_verbose(), handle_waitfordigit(), launch_netscript(), run_agi(), and setup_env().
int AST_OPTIONAL_API_NAME() ast_agi_unregister | ( | agi_command * | cmd | ) |
Definition at line 3827 of file res_agi.c.
References ast_free, ast_join, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, AST_XML_DOC, agi_command::docsrc, agi_command::list, MAX_CMD_LEN, NULL, agi_command::seealso, agi_command::summary, agi_command::syntax, and agi_command::usage.
Referenced by __stub__ast_agi_register(), ast_agi_register_multiple(), ast_agi_unregister_multiple(), AST_TEST_DEFINE(), and unload_module().
int AST_OPTIONAL_API_NAME() ast_agi_unregister_multiple | ( | struct agi_command * | cmd, |
unsigned int | len | ||
) |
Definition at line 3893 of file res_agi.c.
References ast_agi_unregister(), and len().
Referenced by __stub__ast_agi_register_multiple(), and unload_module().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
AST_TEST_DEFINE | ( | test_agi_null_docs | ) |
Definition at line 4625 of file res_agi.c.
References ast_agi_register(), ast_agi_unregister(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, handle_noop(), sip_to_pjsip::info(), NULL, ast_module_info::self, agi_command::syntax, TEST_EXECUTE, TEST_INIT, and agi_command::usage.
|
static |
Definition at line 1759 of file res_agi.c.
References AGI_RESULT_HANGUP, AGI_RESULT_SUCCESS, ast_channel_name(), AST_CONTROL_HANGUP, ast_debug, AST_FRAME_CONTROL, ast_frfree, ast_read(), ast_frame::frametype, ast_frame_subclass::integer, and ast_frame::subclass.
Referenced by launch_asyncagi().
|
static |
Definition at line 4611 of file res_agi.c.
References agi_exec(), ast_log, and LOG_WARNING.
Referenced by load_module().
|
static |
Definition at line 4569 of file res_agi.c.
References agi_exec_full(), ao2_bump, ao2_cleanup, ast_channel_name(), ast_channel_readformat(), ast_check_hangup(), ast_format_cache_get, ast_format_get_name(), ast_format_slin, ast_log, ast_set_read_format(), ast_verb, LOG_ERROR, LOG_WARNING, NULL, and pbx_builtin_getvar_helper().
Referenced by load_module().
|
static |
Definition at line 3909 of file res_agi.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, agi_command::cmda, agi_command::list, match(), and NULL.
Referenced by agi_async_end_to_ami(), agi_handle_command(), ast_agi_register(), and handle_cli_agi_show().
|
static |
Definition at line 1522 of file res_agi.c.
References ast_free, agi_cmd::cmd_buffer, and agi_cmd::cmd_id.
Referenced by agi_destroy_commands_cb(), and launch_asyncagi().
|
static |
Retrieve the list head to the requested channel's AGI datastore.
chan | Channel datastore is requested for |
cmd | Pointer to the struct pointer which will reference the head of the agi command list. |
0 | if the datastore was valid and the list head was retrieved appropriately (even if it's NULL and the list is empty) |
-1 | if the datastore could not be retrieved causing an error |
Definition at line 1558 of file res_agi.c.
References agi_commands, ast_channel_datastore_find(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, AST_LIST_HEAD, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log, ast_datastore::data, LOG_ERROR, and NULL.
Referenced by launch_asyncagi().
|
static |
Definition at line 2364 of file res_agi.c.
References ast_agi_send(), ast_answer(), AST_STATE_UP, agi_state::fd, RESULT_FAILURE, and RESULT_SUCCESS.
|
static |
Definition at line 2376 of file res_agi.c.
References ast_agi_send(), ASYNC_AGI_BREAK, and agi_state::fd.
|
static |
Definition at line 3078 of file res_agi.c.
References ast_agi_send(), ast_channel_lock, ast_channel_setwhentohangup_tv(), ast_channel_unlock, agi_state::fd, RESULT_SHOWUSAGE, RESULT_SUCCESS, and timeout.
|
static |
Definition at line 3179 of file res_agi.c.
References ao2_ref, ast_agi_send(), ast_channel_snapshot_get_latest_by_name(), agi_state::fd, RESULT_SHOWUSAGE, RESULT_SUCCESS, and ast_channel_snapshot::state.
|
static |
CLI command to add applications to execute in Async AGI.
e | |
cmd | |
a |
CLI_SUCCESS | on success |
NULL | when init or tab completion is used |
Definition at line 1657 of file res_agi.c.
References add_agi_cmd(), ast_cli_args::argc, ast_cli_args::argv, ast_channel_get_by_name(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_channel_unref, ast_cli(), ast_complete_channels(), ast_debug, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 3362 of file res_agi.c.
References agidebug, ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 4470 of file res_agi.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, NULL, ast_cli_entry::usage, and write_htmldump().
|
static |
Definition at line 4284 of file res_agi.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), ast_free, ast_join, ast_malloc, AST_TERM_MAX_ESCAPE_CHARS, AST_XML_DOC, ast_xmldoc_printable(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, COLOR_CYAN, COLOR_MAGENTA, ast_cli_entry::command, agi_command::dead, agi_command::docsrc, error(), ast_cli_args::fd, find_command(), help_workhorse(), sip_to_pjsip::info(), MAX_CMD_LEN, NULL, S_OR, agi_command::seealso, agi_command::summary, synopsis, agi_command::syntax, term_color(), agi_command::usage, and ast_cli_entry::usage.
|
static |
Definition at line 2012 of file res_agi.c.
References ast_log, ast_poll, ast_sockaddr_stringify(), errno, LOG_WARNING, and MAX_AGI_CONNECT.
Referenced by launch_netscript().
|
static |
Definition at line 2495 of file res_agi.c.
References ast_agi_send(), AST_CONTROL_STREAM_STOP, ast_control_streamfile(), ast_strlen_zero, agi_state::fd, NULL, pbx_builtin_setvar_helper(), RESULT_FAILURE, RESULT_SHOWUSAGE, RESULT_SUCCESS, skipms, stop, and suspend().
|
static |
Definition at line 3334 of file res_agi.c.
References ast_agi_send(), ast_db_del(), agi_state::fd, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3345 of file res_agi.c.
References ast_agi_send(), ast_db_deltree(), agi_state::fd, NULL, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3290 of file res_agi.c.
References ast_agi_send(), ast_db_get(), ast_free, ast_str_buffer(), ast_str_create, ast_str_make_space, ast_str_size(), ast_str_strlen(), ast_str_update(), buf, agi_state::fd, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3323 of file res_agi.c.
References ast_agi_send(), ast_db_put(), agi_state::fd, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3128 of file res_agi.c.
References ast_agi_send(), ast_channel_clear_flag(), ast_channel_flags(), ast_channel_lock, ast_channel_unlock, AST_FLAG_DISABLE_WORKAROUNDS, ast_log, ast_set_flag, ast_test_flag, ast_verb, agi_state::fd, LOG_WARNING, pbx_exec(), pbx_findapp(), and RESULT_SHOWUSAGE.
|
static |
Definition at line 2834 of file res_agi.c.
References ast_agi_send(), ast_app_getdata_full(), agi_state::audio, agi_state::ctrl, agi_state::fd, max, RESULT_SHOWUSAGE, RESULT_SUCCESS, and timeout.
|
static |
get option - really similar to the handle_streamfile, but with a timeout
Definition at line 2616 of file res_agi.c.
References ast_agi_send(), ast_applystream(), ast_channel_language(), ast_channel_pbx(), ast_channel_stream(), ast_debug, ast_log, ast_openstream(), ast_openvstream(), ast_playstream(), ast_seekstream(), ast_stopstream(), ast_tellstream(), ast_verb, ast_waitfordigit_full(), ast_waitstream_full(), agi_state::audio, agi_state::ctrl, ast_pbx::dtimeoutms, agi_state::fd, LOG_WARNING, NULL, RESULT_FAILURE, RESULT_SHOWUSAGE, RESULT_SUCCESS, timeout, and ast_filestream::vfs.
|
static |
Definition at line 3216 of file res_agi.c.
References ast_agi_send(), ast_func_read(), ast_strlen_zero, agi_state::fd, NULL, pbx_retrieve_variable(), RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3239 of file res_agi.c.
References ast_agi_send(), ast_channel_get_by_name(), ast_channel_ref, ast_channel_unref, ast_free, ast_str_buffer(), ast_str_create, ast_str_substitute_variables(), agi_state::fd, NULL, RESULT_SHOWUSAGE, RESULT_SUCCESS, and str.
|
static |
Definition at line 3100 of file res_agi.c.
References ast_agi_send(), ast_channel_get_by_name(), ast_channel_unref, ast_set_hangupsource(), ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, c, agi_state::fd, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3391 of file res_agi.c.
References ast_agi_send(), agi_state::fd, and RESULT_SUCCESS.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 2899 of file res_agi.c.
References ao2_bump, ao2_cleanup, ast_agi_send(), ast_applystream(), ast_channel_language(), ast_channel_name(), ast_channel_readformat(), ast_channel_stream_set(), ast_closestream(), AST_CONTROL_VIDUPDATE, ast_dsp_free(), ast_dsp_get_threshold_from_settings(), ast_dsp_new(), ast_dsp_set_threshold(), ast_dsp_silence(), AST_FILE_MODE, ast_format_slin, AST_FRAME_DTMF, AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_frfree, ast_indicate(), ast_log, ast_read(), ast_seekstream(), ast_set_read_format(), ast_stream_rewind(), ast_streamfile(), ast_tellstream(), ast_truncstream(), ast_tvdiff_ms(), ast_tvnow(), ast_waitfor(), ast_waitstream(), ast_writefile(), ast_writestream(), agi_state::fd, ast_frame::frametype, ast_frame_subclass::integer, LOG_WARNING, NULL, RAII_VAR, RESULT_FAILURE, RESULT_SHOWUSAGE, RESULT_SUCCESS, ast_frame::subclass, THRESHOLD_SILENCE, and ast_dsp::totalsilence.
|
static |
Definition at line 2414 of file res_agi.c.
References ast_agi_send(), ast_recvchar(), agi_state::fd, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2434 of file res_agi.c.
References ast_agi_send(), ast_free, ast_recvtext(), buf, agi_state::fd, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2716 of file res_agi.c.
References ast_agi_send(), ast_channel_language(), AST_SAY_CASE_ALL, AST_SAY_CASE_LOWER, AST_SAY_CASE_NONE, AST_SAY_CASE_UPPER, ast_say_character_str_full, agi_state::audio, agi_state::ctrl, agi_state::fd, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2756 of file res_agi.c.
References ast_agi_send(), ast_channel_language(), ast_say_date, agi_state::fd, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2786 of file res_agi.c.
References ast_agi_send(), ast_channel_language(), ast_get_time_t(), ast_say_date_with_format, ast_strlen_zero, agi_state::fd, format, NULL, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2700 of file res_agi.c.
References ast_agi_send(), ast_channel_language(), ast_say_digit_str_full, agi_state::audio, agi_state::ctrl, agi_state::fd, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Say number in various language syntaxes.
Definition at line 2685 of file res_agi.c.
References ast_agi_send(), ast_channel_language(), ast_say_number_full, agi_state::audio, agi_state::ctrl, agi_state::fd, NULL, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2820 of file res_agi.c.
References ast_agi_send(), ast_channel_language(), ast_say_phonetic_str_full, agi_state::audio, agi_state::ctrl, agi_state::fd, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2771 of file res_agi.c.
References ast_agi_send(), ast_channel_language(), ast_say_time, agi_state::fd, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2479 of file res_agi.c.
References ast_agi_send(), ast_check_hangup(), ast_send_image(), agi_state::fd, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2395 of file res_agi.c.
References ast_agi_send(), ast_sendtext(), agi_state::fd, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3158 of file res_agi.c.
References ast_agi_send(), ast_callerid_parse(), ast_copy_string(), ast_set_callerid(), ast_shrink_phone_number(), agi_state::fd, NULL, RESULT_SUCCESS, and tmp().
|
static |
Definition at line 2861 of file res_agi.c.
References ast_agi_send(), ast_channel_context_set(), agi_state::fd, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2871 of file res_agi.c.
References ast_agi_send(), ast_channel_exten_set(), agi_state::fd, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3397 of file res_agi.c.
References ast_agi_send(), ast_moh_start(), ast_moh_stop(), agi_state::fd, NULL, RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 2880 of file res_agi.c.
References ast_agi_send(), ast_channel_caller(), ast_channel_context(), ast_channel_exten(), ast_explicit_goto(), ast_findlabel_extension(), agi_state::fd, NULL, RESULT_SHOWUSAGE, RESULT_SUCCESS, and S_COR.
|
static |
Definition at line 3203 of file res_agi.c.
References ast_agi_send(), agi_state::fd, pbx_builtin_setvar_helper(), RESULT_SHOWUSAGE, and RESULT_SUCCESS.
|
static |
Definition at line 3501 of file res_agi.c.
References ast_agi_send(), ast_speech_grammar_activate(), agi_state::fd, RESULT_SHOWUSAGE, RESULT_SUCCESS, and agi_state::speech.
|
static |
Definition at line 3410 of file res_agi.c.
References ao2_ref, ast_agi_send(), ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_slin, ast_speech_new(), agi_state::fd, RESULT_FAILURE, RESULT_SUCCESS, and agi_state::speech.
|
static |
Definition at line 3519 of file res_agi.c.
References ast_agi_send(), ast_speech_grammar_deactivate(), agi_state::fd, RESULT_SHOWUSAGE, RESULT_SUCCESS, and agi_state::speech.
|
static |
Definition at line 3452 of file res_agi.c.
References ast_agi_send(), ast_speech_destroy(), agi_state::fd, NULL, RESULT_SUCCESS, and agi_state::speech.
|
static |
Definition at line 3465 of file res_agi.c.
References ast_agi_send(), ast_speech_grammar_load(), agi_state::fd, RESULT_SHOWUSAGE, RESULT_SUCCESS, and agi_state::speech.
|
static |
Definition at line 3556 of file res_agi.c.
References ast_agi_send(), ast_build_string(), ast_channel_language(), ast_channel_sched(), ast_channel_stream(), ast_channel_streamid(), ast_channel_timingfunc(), ast_clear_flag, AST_CONTROL_HANGUP, ast_format_slin, AST_FRAME_CONTROL, AST_FRAME_DTMF, AST_FRAME_VOICE, ast_frfree, AST_LIST_NEXT, ast_mutex_lock, ast_mutex_unlock, ast_read(), ast_sched_runq(), ast_sched_wait(), ast_set_read_format(), ast_speech_change_state(), AST_SPEECH_QUIET, ast_speech_results_get(), ast_speech_start(), AST_SPEECH_STATE_DONE, AST_SPEECH_STATE_NOT_READY, AST_SPEECH_STATE_READY, AST_SPEECH_STATE_WAIT, ast_speech_write(), ast_stopstream(), ast_strlen_zero, ast_tellstream(), ast_test_flag, ast_waitfor(), buf, ast_frame::data, ast_frame::datalen, agi_state::fd, ast_frame::frametype, ast_speech_result::grammar, ast_frame_subclass::integer, ast_speech::lock, NULL, ast_speech::processing_sound, prompt, ast_frame::ptr, result, RESULT_SHOWUSAGE, RESULT_SUCCESS, ast_speech::results, ast_speech_result::score, agi_state::speech, speech_streamfile(), ast_speech::state, ast_frame::subclass, ast_speech_result::text, timeout, and tmp().
|
static |
Definition at line 3434 of file res_agi.c.
References ast_agi_send(), ast_speech_change(), agi_state::fd, RESULT_SHOWUSAGE, RESULT_SUCCESS, and agi_state::speech.
|
static |
Definition at line 3483 of file res_agi.c.
References ast_agi_send(), ast_speech_grammar_unload(), agi_state::fd, RESULT_SHOWUSAGE, RESULT_SUCCESS, and agi_state::speech.
|
static |
Definition at line 2557 of file res_agi.c.
References ast_agi_send(), ast_applystream(), ast_channel_language(), ast_channel_name(), ast_channel_stream(), ast_channel_writeformat(), ast_debug, ast_format_get_name(), ast_openstream(), ast_openvstream(), ast_playstream(), ast_seekstream(), ast_stopstream(), ast_tellstream(), ast_verb, ast_waitstream_full(), agi_state::audio, agi_state::ctrl, agi_state::fd, pbx_builtin_setvar_helper(), RESULT_FAILURE, RESULT_SHOWUSAGE, RESULT_SUCCESS, S_OR, and ast_filestream::vfs.
|
static |
Definition at line 2451 of file res_agi.c.
References ast_agi_send(), ast_channel_setoption(), AST_OPTION_TDD, agi_state::fd, RESULT_SHOWUSAGE, and RESULT_SUCCESS.