71 #define AST_API_MODULE 1388 #define MAX_ARGS 128 1389 #define MAX_CMD_LEN 80 1390 #define AGI_NANDFS_RETRY 3 1391 #define AGI_BUF_LEN 2048 1392 #define SRV_PREFIX "_agi._tcp." 1402 #define TONE_BLOCK_SIZE 200 1405 #define MAX_AGI_CONNECT 2000 1407 #define AGI_PORT 4573 1410 #define ASYNC_AGI_BREAK 3 1429 if (!channel_string || !event_string) {
1484 #define AGI_BUF_INITSIZE 256 1567 ast_log(
LOG_ERROR,
"Huh? Async AGI datastore disappeared on Channel %s!\n",
1634 agi_cmds_list =
ast_calloc(1,
sizeof(*agi_cmds_list));
1635 if (!agi_cmds_list) {
1640 datastore->
data = agi_cmds_list;
1663 e->
usage =
"Usage: agi exec <channel name> <app and arguments> [id]\n" 1664 " Add AGI command to the execute queue of the specified channel in Async AGI\n";
1723 snprintf(buf,
sizeof(buf),
"Channel %s does not exist.", channel);
1731 snprintf(buf,
sizeof(buf),
"Failed to add AGI command to channel %s queue",
ast_channel_name(chan));
1806 #define AGI_BUF_SIZE 1024 1807 #define AMI_BUF_SIZE 2048 1846 async_agi.
fd = fds[1];
1847 async_agi.
ctrl = fds[1];
1848 async_agi.
audio = -1;
1854 setup_env(chan,
"async", fds[1], 0, argc, argv);
1858 ast_log(
LOG_ERROR,
"Failed to read from Async AGI pipe on channel %s: %s\n",
1861 goto async_agi_abort;
1863 agi_buffer[res] =
'\0';
1885 goto async_agi_done;
1899 ast_log(
LOG_ERROR,
"Failed to read from Async AGI pipe on channel %s: %s\n",
1903 goto async_agi_done;
1910 agi_buffer[res] =
'\0';
1926 switch (cmd_status) {
1931 goto async_agi_done;
1937 goto async_agi_done;
1962 returnstatus = cmd_status;
1963 goto async_agi_done;
1995 return returnstatus;
2014 struct pollfd pfds[1];
2018 reslen =
sizeof(conresult);
2020 pfds[0].fd = netsockfd;
2021 pfds[0].events = POLLOUT;
2024 if (
errno != EINTR) {
2026 ast_log(
LOG_WARNING,
"FastAGI connection to '%s' timed out after MAX_AGI_CONNECT (%d) milliseconds.\n",
2036 if (getsockopt(pfds[0].fd, SOL_SOCKET, SO_ERROR, &conresult, &reslen) < 0) {
2056 char *
host, *script;
2057 int num_addrs = 0, i = 0;
2064 if ((script = strchr(host,
'/'))) {
2075 for (i = 0; i < num_addrs; i++) {
2102 if (i == num_addrs) {
2108 if (
errno != EINTR) {
2148 char *
host, *script;
2153 char resolved_uri[1024];
2154 const char *srvhost;
2155 unsigned short srvport;
2158 if (strlen(agiurl) < 7) {
2165 if ((script = strchr(host,
'/'))) {
2171 if (strchr(host,
':')) {
2176 snprintf(service,
sizeof(service),
"%s%s",
SRV_PREFIX, host);
2178 while (!(srv_ret =
ast_srv_lookup(&context, service, &srvhost, &srvport))) {
2179 snprintf(resolved_uri,
sizeof(resolved_uri),
"agi://%s:%d/%s", srvhost, srvport, script);
2182 ast_log(
LOG_WARNING,
"AGI request failed for host '%s' (%s:%d)\n", host, srvhost, srvport);
2203 int pid, toast[2], fromast[2], audio[2], res;
2206 if (!strncasecmp(script,
"agi://", 6)) {
2209 if (!strncasecmp(script,
"hagi://", 7)) {
2212 if (!strncasecmp(script,
"agi:async",
sizeof(
"agi:async") - 1)) {
2216 if (script[0] !=
'/') {
2222 if (stat(script, &st)) {
2231 if (pipe(fromast)) {
2282 dup2(fromast[0], STDIN_FILENO);
2283 dup2(toast[1], STDOUT_FILENO);
2285 dup2(audio[0], STDERR_FILENO + 1);
2287 close(STDERR_FILENO + 1);
2294 execv(script, argv);
2298 fprintf(stdout,
"failure\n");
2302 ast_verb(3,
"Launched AGI Script %s\n", script);
2304 fds[1] = fromast[1];
2349 ast_agi_send(fd, chan,
"agi_enhanced: %s\n", enhanced ?
"1.0" :
"0.0");
2353 ast_agi_send(fd, chan,
"agi_threadid: %ld\n", (
long)pthread_self());
2357 for(count = 1; count < argc; count++)
2358 ast_agi_send(fd, chan,
"agi_arg_%d: %s\n", count, argv[count]);
2388 if (sscanf(argv[3],
"%30d", &to) != 1)
2458 if (!strncasecmp(argv[2],
"on",2)) {
2463 if (!strncasecmp(argv[2],
"mate",4)) {
2466 if (!strncasecmp(argv[2],
"tdd",3)) {
2497 int res = 0,
skipms = 3000;
2503 if (argc < 5 || argc > 10) {
2511 if ((argc > 5) && (sscanf(argv[5],
"%30d", &
skipms) != 1)) {
2527 if (argc > 9 && (sscanf(argv[9],
"%30ld", &offsetms) != 1)) {
2534 if (res > 0 && stop && strchr(stop, res)) {
2536 snprintf(stopkeybuf,
sizeof(stopkeybuf),
"%c", res);
2549 snprintf(offsetbuf,
sizeof(offsetbuf),
"%ld", offsetms);
2552 ast_agi_send(agi->
fd, chan,
"200 result=%d endpos=%ld\n", res, offsetms);
2561 long sample_offset = 0, max_length;
2562 const char *edigits =
"";
2564 if (argc < 4 || argc > 5) {
2572 if ((argc > 4) && (sscanf(argv[4],
"%30ld", &sample_offset) != 1)) {
2577 ast_agi_send(agi->
fd, chan,
"200 result=-1 endpos=%ld\n", sample_offset);
2582 ast_debug(1,
"Ooh, found a video stream, too\n");
2584 ast_verb(3,
"<%s> Playing '%s.%s' (escape_digits=%s) (sample_offset %ld) (language '%s')\n",
2609 ast_agi_send(agi->
fd, chan,
"200 result=%d endpos=%ld\n", res, sample_offset);
2620 long sample_offset = 0, max_length;
2622 const char *edigits =
"";
2624 if ( argc < 4 || argc > 5 )
2631 timeout = atoi(argv[4]);
2638 ast_agi_send(agi->
fd, chan,
"200 result=-1 endpos=%ld\n", sample_offset);
2644 ast_debug(1,
"Ooh, found a video stream, too\n");
2646 ast_verb(3,
"Playing '%s' (escape_digits=%s) (timeout %d)\n", argv[2], edigits, timeout);
2672 if ( !strchr(edigits,res) )
2676 ast_agi_send(agi->
fd, chan,
"200 result=%d endpos=%ld\n", res, sample_offset);
2689 if (argc < 4 || argc > 5)
2691 if (sscanf(argv[2],
"%30d", &num) != 1)
2706 if (sscanf(argv[2],
"%30d", &num) != 1)
2721 if (argc < 4 || argc > 5) {
2726 switch (argv[4][0]) {
2762 if (sscanf(argv[2],
"%30d", &num) != 1)
2777 if (sscanf(argv[2],
"%30d", &num) != 1)
2800 format =
"A dBY HMS";
2802 format =
"ABdY 'digits/at' IMp";
2842 timeout = atoi(argv[3]);
2846 max = atoi(argv[4]);
2887 if (sscanf(argv[2],
"%30d", &pri) != 1) {
2903 struct timeval start;
2904 long sample_offset = 0;
2913 char *silencestr =
NULL;
2920 if (sscanf(argv[5],
"%30d", &ms) != 1)
2924 silencestr = strchr(argv[6],
's');
2925 if ((argc > 7) && (!silencestr))
2926 silencestr = strchr(argv[7],
's');
2927 if ((argc > 8) && (!silencestr))
2928 silencestr = strchr(argv[8],
's');
2931 if (strlen(silencestr) > 2) {
2932 if ((silencestr[0] ==
's') && (silencestr[1] ==
'=')) {
2936 silence = atoi(silencestr);
2963 if ((argc >6) && (sscanf(argv[6],
"%30ld", &sample_offset) != 1) && (!strchr(argv[6],
'=')))
2966 if ((argc > 7) && (!strchr(argv[7],
'=')))
2972 ast_agi_send(agi->
fd, chan,
"200 result=%d (randomerror) endpos=%ld\n", res, sample_offset);
2997 ast_agi_send(agi->
fd, chan,
"200 result=%d (waitfor) endpos=%ld\n", res,sample_offset);
3005 ast_agi_send(agi->
fd, chan,
"200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);
3037 totalsilence = dspsilence;
3041 if (totalsilence > silence) {
3065 ast_agi_send(agi->
fd, chan,
"200 result=%d (timeout) endpos=%ld\n", res, sample_offset);
3081 struct timeval whentohangup = { 0, 0 };
3085 if (sscanf(argv[2],
"%30lf", &timeout) != 1)
3090 whentohangup.tv_sec =
timeout;
3091 whentohangup.tv_usec = (timeout - whentohangup.tv_sec) * 1000000.0;
3110 }
else if (argc == 2) {
3130 int res, workaround;
3136 ast_verb(3,
"AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] :
"");
3144 res =
pbx_exec(chan, app_to_exec, argc == 2 ?
"" : argv[2]);
3185 }
else if (argc == 3) {
3219 char tempstr[1024] =
"";
3225 if (!
ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] ==
')')) {
3243 if (argc != 4 && argc != 5) {
3281 sscanf(argv[2],
"%30d", &level);
3349 if ((argc < 3) || (argc > 4)) {
3358 ast_agi_send(agi->
fd, chan,
"200 result=%c\n", num_deleted > 0 ?
'0' :
'1');
3366 e->
command =
"agi set debug [on|off]";
3368 "Usage: agi set debug [on|off]\n" 3369 " Enables/disables dumping of AGI transactions for\n" 3370 " debugging purposes.\n";
3380 if (strncasecmp(a->
argv[3],
"off", 3) == 0) {
3382 }
else if (strncasecmp(a->
argv[3],
"on", 2) == 0) {
3402 if (!strncasecmp(argv[2],
"on", 2))
3404 else if (!strncasecmp(argv[2],
"off", 3))
3560 char dtmf = 0,
tmp[4096] =
"", *
buf =
tmp;
3561 int timeout = 0, offset = 0, res = 0, i = 0;
3562 long current_offset = 0;
3563 const char *reason =
NULL;
3566 size_t left =
sizeof(
tmp);
3567 time_t start = 0, current;
3578 timeout = atoi(argv[3]);
3582 offset = atoi(argv[4]);
3617 if ((timeout > 0) && (start > 0)) {
3619 if ((current - start) >= timeout) {
3638 switch (speech->
state) {
3682 if (!strcasecmp(reason,
"speech")) {
3691 ast_agi_send(agi->
fd, chan,
"200 result=1 (speech) endpos=%ld results=%d %s\n", current_offset, i,
tmp);
3692 }
else if (!strcasecmp(reason,
"dtmf")) {
3693 ast_agi_send(agi->
fd, chan,
"200 result=1 (digit) digit=%c endpos=%ld\n", dtmf, current_offset);
3694 }
else if (!strcasecmp(reason,
"hangup") || !strcasecmp(reason,
"timeout")) {
3695 ast_agi_send(agi->
fd, chan,
"200 result=1 (%s) endpos=%ld\n", reason, current_offset);
3697 ast_agi_send(agi->
fd, chan,
"200 result=0 endpos=%ld\n", current_offset);
3763 ast_join(matchstr,
sizeof(matchstr), match);
3765 ast_cli(fd,
"%5.5s %30.30s %s\n",
"Dead",
"Command",
"Description");
3771 if ((e->
cmda[0])[0] ==
'_')
3774 if (match && strncasecmp(matchstr, fullcmd, strlen(matchstr)))
3787 ast_join(fullcmd,
sizeof(fullcmd), cmd->cmda);
3799 #ifndef HAVE_NULLSAFE_PRINTF 3800 if (!cmd->summary) {
3809 if (!cmd->seealso) {
3819 ast_verb(2,
"AGI Command '%s' registered\n",fullcmd);
3830 int unregistered = 0;
3833 ast_join(fullcmd,
sizeof(fullcmd), cmd->cmda);
3858 ast_verb(2,
"AGI Command '%s' unregistered\n",fullcmd);
3860 return unregistered;
3865 unsigned int i, x = 0;
3867 for (i = 0; i <
len; i++) {
3876 for (; x > 0; x--) {
3898 for (i = 0; i <
len; i++) {
3920 for (y = 0; match && cmds[y]; y++) {
3924 if (!e->
cmda[y] && !exact)
3931 if (strcasecmp(e->
cmda[y], cmds[y]))
3936 if ((exact > -1) && e->
cmda[y])
3949 int x = 0, quoted = 0, escaped = 0, whitespace = 1;
3961 if (quoted && whitespace) {
3970 if (!quoted && !escaped) {
4014 "CommandId", command_id,
4016 "ResultCode", result_code,
4028 const char *ami_res;
4034 "CommandId", command_id,
4035 "Command", ami_cmd);
4041 ami_res =
"Invalid or unknown command";
4051 if (!dead || (dead && c->
dead)) {
4052 res = c->
handler(chan, agi, argc, argv);
4061 ast_agi_send(agi->
fd, chan,
"520 Invalid command syntax. Proper usage not available.\n");
4063 ast_agi_send(agi->
fd, chan,
"520-Invalid command syntax. Proper usage follows:\n");
4070 ami_res =
"Failure";
4078 ami_res =
"Success";
4085 ami_res =
"Success";
4092 ami_res =
"Unknown Result";
4100 ami_res =
"Command Not Permitted on a dead channel or intercept routine";
4127 const char *sighup_str;
4128 const char *exit_on_hangup_str;
4137 exit_on_hangup =
ast_true(exit_on_hangup_str);
4140 if (!(readf = fdopen(agi->
ctrl,
"r"))) {
4142 if (send_sighup && pid > -1)
4157 }
else if (agi->
fast) {
4161 if (exit_on_hangup) {
4166 if (dead || in_intercept) {
4184 if (!returnstatus) {
4196 }
else if (outfd > -1) {
4197 size_t len =
sizeof(
buf);
4205 res = fgets(buf + buflen, len, readf);
4208 if (ferror(readf) && ((
errno != EINTR) && (
errno != EAGAIN)))
4212 buflen = strlen(buf);
4213 if (buflen && buf[buflen - 1] ==
'\n')
4215 len =
sizeof(
buf) - buflen;
4217 ast_verbose(
"AGI Rx << temp buffer %s - errno %s\nNo \\n received, checking again.\n", buf, strerror(
errno));
4224 waitpid(pid, status, 0);
4231 if (*buf && strncasecmp(buf,
"failure", 7) == 0) {
4237 buflen = strlen(buf);
4238 if (buflen && buf[buflen - 1] ==
'\n') {
4239 buf[buflen - 1] =
'\0';
4245 switch (cmd_status) {
4270 if (kill(pid, SIGHUP)) {
4275 waitpid(pid, status, WNOHANG);
4276 }
else if (agi->
fast) {
4281 return returnstatus;
4292 e->
command =
"agi show commands [topic]";
4294 "Usage: agi show commands [topic] <topic>\n" 4295 " When called with a topic as an argument, displays usage\n" 4296 " information on the given command. If called without a\n" 4297 " topic, it provides a list of AGI commands.\n";
4315 size_t synlen, desclen, seealsolen, stxlen;
4325 snprintf(info,
sizeof(info),
"\n -= Info about agi '%s' =- ", fullcmd);
4332 if (!seealso || !description || !synopsis) {
4334 goto return_cleanup;
4348 if (!synopsis || !description || !seealso) {
4350 goto return_cleanup;
4361 goto return_cleanup;
4365 ast_cli(a->
fd,
"%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n", infotitle, stxtitle, syntax,
4366 desctitle, description, syntitle, synopsis, deadtitle, deadcontent,
4367 seealsotitle, seealso);
4378 ast_cli(a->
fd,
"No such command '%s'.\n", fullcmd);
4397 fprintf(htmlfile,
"%s",
"<");
4400 fprintf(htmlfile,
"%s",
">");
4403 fprintf(htmlfile,
"%s",
"&");
4406 fprintf(htmlfile,
"%s",
""");
4409 fprintf(htmlfile,
"%c", *cur);
4424 if (!(htmlfile = fopen(filename,
"wt")))
4427 fprintf(htmlfile,
"<HTML>\n<HEAD>\n<TITLE>AGI Commands</TITLE>\n</HEAD>\n");
4428 fprintf(htmlfile,
"<BODY>\n<CENTER><B><H1>AGI Commands</H1></B></CENTER>\n\n");
4429 fprintf(htmlfile,
"<TABLE BORDER=\"0\" CELLSPACING=\"10\">\n");
4433 char *tempstr, *stringp;
4435 if (!command->
cmda[0])
4438 if ((command->
cmda[0])[0] ==
'_')
4442 fprintf(htmlfile,
"<TR><TD><TABLE BORDER=\"1\" CELLPADDING=\"5\" WIDTH=\"100%%\">\n");
4443 fprintf(htmlfile,
"<TR><TH ALIGN=\"CENTER\"><B>%s - %s</B></TH></TR>\n", fullcmd, command->
summary);
4449 tempstr =
strsep(&stringp,
"\n");
4451 fprintf(htmlfile,
"<TR><TD ALIGN=\"CENTER\">");
4453 fprintf(htmlfile,
"</TD></TR>\n");
4454 fprintf(htmlfile,
"<TR><TD ALIGN=\"CENTER\">\n");
4456 while ((tempstr =
strsep(&stringp,
"\n")) !=
NULL) {
4458 fprintf(htmlfile,
"<BR>\n");
4460 fprintf(htmlfile,
"</TD></TR>\n");
4461 fprintf(htmlfile,
"</TABLE></TD></TR>\n\n");
4465 fprintf(htmlfile,
"</TABLE>\n</BODY>\n</HTML>\n");
4476 "Usage: agi dump html <filename>\n" 4477 " Dumps the AGI command list in HTML format to the given\n" 4498 int fds[2], efd = -1, pid = -1;
4509 ast_debug(3,
"Hungup channel detected, running agi in dead mode.\n");
4510 memset(&agi, 0,
sizeof(agi));
4534 if (fds[1] != fds[0])
4574 const char *requested_format_name;
4577 ast_log(
LOG_ERROR,
"EAGI cannot be run on a dead/hungup channel, please use AGI.\n");
4582 if (requested_format_name) {
4584 if (requested_format) {
4585 ast_verb(3,
"<%s> Setting EAGI audio pipe format to %s\n",
4588 ast_log(
LOG_ERROR,
"Could not find requested format: %s\n", requested_format_name);
4624 #ifdef TEST_FRAMEWORK 4633 info->name =
"null_agi_docs";
4634 info->category =
"/res/agi/";
4635 info->summary =
"AGI command with no documentation";
4636 info->description =
"Test whether an AGI command with no documentation will crash Asterisk";
4647 #ifndef HAVE_NULLSAFE_PRINTF 4714 .requires =
"res_speech",
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
const char *const summary
static const char synopsis[]
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
const char * ast_config_AST_KEY_DIR
static int handle_speechactivategrammar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static struct ast_manager_event_blob * agi_exec_end_to_ami(struct stasis_message *message)
const char *const seealso
Struct containing info for an AMI event to send out.
struct sockaddr_storage ss
int ast_recvchar(struct ast_channel *chan, int timeout)
Receives a text character from a channel.
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
#define ast_channel_lock(chan)
int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len)
executes a read operation on a function
Main Channel structure associated with a channel.
static char * help_workhorse(int fd, const char *const match[])
SAY_EXTERN int(* ast_say_number_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_number_full)
Same as ast_say_number() with audiofd for received audio and returns 1 on ctrlfd being readable...
#define AST_CLI_DEFINE(fn, txt,...)
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
#define AST_LIST_LOCK(head)
Locks a list.
static int load_module(void)
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
SAY_EXTERN int(* ast_say_time)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_time)
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
static void agi_destroy_commands_cb(void *data)
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
static struct ast_manager_event_blob * agi_channel_to_ami(const char *type, struct stasis_message *message)
Generic Speech Recognition API.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
static int parse_args(char *s, int *max, const char *argv[])
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
static int handle_getvariablefull(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int(*const handler)(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
String manipulation functions.
int ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
static enum agi_result async_agi_read_frame(struct ast_channel *chan)
void ast_speech_start(struct ast_speech *speech)
Indicate to the speech engine that audio is now going to start being written.
#define ast_join(s, len, w)
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_connection(const char *agiurl, const struct ast_sockaddr addr, const int netsockfd)
Asterisk version information.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_test_flag(p, flag)
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
void ast_channel_publish_cached_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message using the latest snapshot from the cache.
void ast_dsp_free(struct ast_dsp *dsp)
const char * ast_config_AST_MODULE_DIR
int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
Try to write string, but wait no more than ms milliseconds before timing out.
const char * ast_get_version(void)
Retrieve the Asterisk version string.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
struct ast_channel_snapshot * snapshot
Convenient Signal Processing routines.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
AGI Extension interfaces - Asterisk Gateway Interface.
#define ast_set_flag(p, flag)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_check_hangup_locked(struct ast_channel *chan)
static struct ast_manager_event_blob * agi_async_start_to_ami(struct stasis_message *message)
descriptor for a cli entry.
static struct ast_manager_event_blob * agi_exec_start_to_ami(struct stasis_message *message)
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define ast_str_make_space(buf, new_len)
Support for DNS SRV records, used in to locate SIP services.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ast_socket_nonblock(domain, type, protocol)
Create a non-blocking socket.
static int add_agi_cmd(struct ast_channel *chan, const char *cmd_buff, const char *cmd_id)
int AST_OPTIONAL_API_NAME() ast_agi_unregister(agi_command *cmd)
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
static int handle_sendtext(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
char * ast_xmldoc_build_description(const char *type, const char *name, const char *module)
Generate description documentation from XML.
void ast_close_fds_above_n(int n)
Common routine for child processes, to close all fds prior to exec(2)
char * ast_uri_encode(const char *string, char *outbuf, int buflen, struct ast_flags spec)
Turn text string to URI-encoded XX version.
Structure representing a snapshot of channel state.
static int handle_answer(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
void ast_srv_cleanup(struct srv_context **context)
Cleanup resources associated with ast_srv_lookup.
int ast_str_set_va(struct ast_str **buf, ssize_t max_len, const char *fmt, va_list ap)
Set a dynamic string from a va_list.
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
enum ast_cc_service_type service
#define AST_TEST_REGISTER(cb)
static void publish_async_exec_end(struct ast_channel *chan, int command_id, const char *command, int result_code, const char *result)
Structure for a data store type.
ast_channel_state
ast_channel states
struct ast_speech_result * ast_speech_results_get(struct ast_speech *speech)
Get speech recognition results.
static enum agi_result launch_asyncagi(struct ast_channel *chan, int argc, char *argv[], int *efd)
static int speech_streamfile(struct ast_channel *chan, const char *filename, const char *preflang, int offset)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
static int handle_speechloadgrammar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
const char * ast_config_AST_RUN_DIR
#define ast_mutex_lock(a)
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
static agi_command * find_command(const char *const cmds[], int exact)
static int eagi_exec(struct ast_channel *chan, const char *data)
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
void ast_verbose(const char *fmt,...)
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
static struct ast_manager_event_blob * agi_async_end_to_ami(struct stasis_message *message)
struct agi_cmd::@446 entry
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.
char * ast_xmldoc_build_synopsis(const char *type, const char *name, const char *module)
Generate synopsis documentation from XML.
void ast_cli(int fd, const char *fmt,...)
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
static int handle_autohangup(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int action_add_agi_cmd(struct mansession *s, const struct message *m)
Add a new command to execute by the Async AGI application.
static int get_agi_cmd(struct ast_channel *chan, struct agi_cmd **cmd)
Retrieve the list head to the requested channel's AGI datastore.
int ast_unregister_application(const char *app)
Unregister an application.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
static int handle_recordfile(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
Socket address structure.
int ast_channel_priority(const struct ast_channel *chan)
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **chan, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
ast_doc_src
From where the documentation come from, this structure is useful for use it inside application/functi...
#define ast_verb(level,...)
static int handle_speechset(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
struct ast_manager_event_blob * ast_manager_event_blob_create(int event_flags, const char *manager_event, const char *extra_fields_fmt,...)
Construct a ast_manager_event_blob.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_frame_subclass subclass
int ast_send_image(struct ast_channel *chan, const char *filename)
Sends an image.
int ast_json_object_set(struct ast_json *object, const char *key, struct ast_json *value)
Set a field in a JSON object.
Blob of data associated with a channel.
int args
This gets set in ast_cli_register()
const char * astman_get_header(const struct message *m, char *var)
Get header from mananger transaction.
#define ast_module_unref(mod)
Release a reference to the module.
#define ast_strlen_zero(foo)
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
off_t ast_tellstream(struct ast_filestream *fs)
Tell where we are in a stream.
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
struct ast_str * ast_manager_str_from_json_object(struct ast_json *blob, key_exclusion_cb exclusion_cb)
Convert a JSON object into an AMI compatible string.
void ast_child_verbose(int level, const char *fmt,...)
static int handle_dbdel(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define AST_TERM_MAX_ESCAPE_CHARS
Maximum number of characters needed for a color escape sequence, and another one for a trailing reset...
#define ast_sockaddr_port(addr)
Get the port number of a socket address.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
const char * ast_config_AST_CONFIG_FILE
int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
get values from config variables.
#define ast_fd_set_flags(fd, flags)
Set flags on the given file descriptor.
#define ast_debug(level,...)
Log a DEBUG message.
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...
STASIS_MESSAGE_TYPE_DEFN_LOCAL(agi_exec_start_type,.to_ami=agi_exec_start_to_ami,)
General Asterisk channel definitions for image handling.
static int agi_exec(struct ast_channel *chan, const char *data)
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name)
Deactivate a grammar on a speech structure.
int ast_playstream(struct ast_filestream *s)
Play a open stream on a channel.
int ast_build_string(char **buffer, size_t *space, const char *fmt,...)
Build a string in a buffer, designed to be called repeatedly.
struct ast_channel_snapshot * ast_channel_snapshot_get_latest_by_name(const char *name)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object...
struct ast_filestream * ast_openvstream(struct ast_channel *chan, const char *filename, const char *preflang)
Opens stream for use in seeking, playing.
static int handle_speechcreate(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
General Asterisk PBX channel definitions.
const char * ast_channel_accountcode(const struct ast_channel *chan)
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
Asterisk file paths, configured in asterisk.conf.
int AST_OPTIONAL_API_NAME() ast_agi_register(struct ast_module *mod, agi_command *cmd)
SAY_EXTERN int(* ast_say_digit_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_digit_str_full)
Same as ast_say_digit_str() with audiofd for received audio and returns 1 on ctrlfd being readable...
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_status_update(a, b, c...)
struct ast_json * ast_json_string_create(const char *value)
Construct a JSON string from value.
const char * ast_config_AST_AGI_DIR
int ast_speech_change_state(struct ast_speech *speech, int state)
Change state of a speech structure.
static int handle_setmusic(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
void ast_safe_fork_cleanup(void)
Common routine to cleanup after fork'ed process is complete (if reaping was stopped) ...
#define ast_poll(a, b, c)
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
static void setup_env(struct ast_channel *chan, char *request, int fd, int enhanced, int argc, char *argv[])
#define AST_RWLIST_TRAVERSE
static int handle_setcallerid(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define ao2_ref(o, delta)
static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi, int pid, int *status, int dead, int argc, char *argv[])
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
static int handle_saydigits(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
In case you didn't read that giant block of text above the mansession_session struct, the struct mansession is named this solely to keep the API the same in Asterisk. This structure really represents data that is different from Manager action to Manager action. The mansession_session pointer contained within points to session-specific data.
static struct agi_command commands[]
AGI commands list.
long int ast_random(void)
static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define AST_RWLIST_REMOVE_CURRENT
#define ast_strdupa(s)
duplicate a string in memory from the stack
static char * handle_cli_agi_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_cli_entry cli_agi[]
#define ast_malloc(len)
A wrapper for malloc()
static enum agi_result launch_script(struct ast_channel *chan, char *script, int argc, char *argv[], int *fds, int *efd, int *opid)
static int handle_channelstatus(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
int ast_speech_grammar_unload(struct ast_speech *speech, const char *grammar_name)
Unload a grammar.
static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
struct ast_speech_result * results
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
SAY_EXTERN int(* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date)
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
int ast_set_priority(int)
We set ourselves to a high priority, that we might pre-empt everything else. If your PBX has heavy ac...
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
static int handle_speechdestroy(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
Wrapper for network related headers, masking differences between various operating systems...
static struct ast_manager_event_blob * agi_async_exec_to_ami(struct stasis_message *message)
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set the minimum average magnitude threshold to determine talking by the DSP.
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
Colorize a specified string by adding terminal color codes.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_config_AST_DATA_DIR
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
int AST_OPTIONAL_API_NAME() ast_agi_unregister_multiple(struct agi_command *cmd, unsigned int len)
static int agi_exec_full(struct ast_channel *chan, const char *data, int enhanced, int dead)
SAY_EXTERN int(* ast_say_date_with_format)(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezone) SAY_INIT(ast_say_date_with_format)
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
static enum agi_result launch_ha_netscript(char *agiurl, char *argv[], int *fds)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static int handle_speechdeactivategrammar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_applystream(struct ast_channel *chan, struct ast_filestream *s)
Applys a open stream to a channel.
const char * ast_config_AST_CONFIG_DIR
void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
Retrieve the value of a builtin variable or variable from the channel variable stack.
#define ast_sockaddr_set_port(addr, port)
Sets the port number of a socket address.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
#define AST_TEST_UNREGISTER(cb)
int ast_channel_streamid(const struct ast_channel *chan)
char * ast_recvtext(struct ast_channel *chan, int timeout)
Receives a text string from a channel Read a string of text from a channel.
static int add_to_agi(struct ast_channel *chan)
const char *const cmda[AST_MAX_CMD_LEN]
int ast_stream_rewind(struct ast_filestream *fs, off_t ms)
Rewind stream ms.
int ast_findlabel_extension(struct ast_channel *c, const char *context, const char *exten, const char *label, const char *callerid)
Find the priority of an extension that has the specified label.
int ast_speech_grammar_activate(struct ast_speech *speech, const char *grammar_name)
Activate a grammar on a speech structure.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ast_safe_fork(int stop_reaper)
Common routine to safely fork without a chance of a signal handler firing badly in the child...
static int write_htmldump(const char *filename)
static char * ast_sockaddr_stringify(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() with default format.
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
struct ast_filestream * ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
Starts writing a file.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
struct ast_speech * speech
static int handle_sayalpha(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.
static int handle_asyncagi_break(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[])
const char * ast_config_AST_LOG_DIR
int ast_seekstream(struct ast_filestream *fs, off_t sample_offset, int whence)
Seeks into stream.
static char * handle_cli_agi_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define ast_channel_unlock(chan)
static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
int AST_OPTIONAL_API_NAME() ast_agi_register_multiple(struct ast_module *mod, struct agi_command *cmd, unsigned int len)
const char * ast_config_AST_MONITOR_DIR
static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define ast_calloc(num, len)
A wrapper for calloc()
static int handle_tddmode(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static const struct ast_datastore_info agi_commands_datastore_info
int ast_closestream(struct ast_filestream *f)
Closes a stream.
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
static void to_ami(struct ast_sip_subscription *sub, struct ast_str **buf)
Asterisk XML Documentation API.
static void suspend(struct cc_core_instance *core_instance)
Module has failed to load, may be in an inconsistent state.
static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf, int dead)
enum ast_channel_state state
const char * ast_config_AST_SPOOL_DIR
static int request(void *obj)
char * ast_xmldoc_printable(const char *bwinput, int withcolors)
Colorize and put delimiters (instead of tags) to the xmldoc output.
static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
char * ast_xmldoc_build_syntax(const char *type, const char *name, const char *module)
Get the syntax for a specified application or function.
char * ast_xmldoc_build_seealso(const char *type, const char *name, const char *module)
Parse the <see-also> node content.
#define ast_clear_flag(p, flag)
static int handle_noop(struct ast_channel *chan, AGI *agi, int arg, const char *const argv[])
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
int ast_truncstream(struct ast_filestream *fs)
Trunc stream at current location.
static struct agi_commands agi_commands
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
const char * ast_channel_data(const struct ast_channel *chan)
#define ast_module_running_ref(mod)
Hold a reference to the module if it is running.
int ast_srv_lookup(struct srv_context **context, const char *service, const char **host, unsigned short *port)
Retrieve set of SRV lookups, in order.
struct agi_command::@219 list
static struct ast_threadstorage agi_buf
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
Process the audio frame for silence.
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd)
char * strsep(char **str, const char *delims)
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
#define ast_channel_ref(c)
Increase channel reference count.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
Standard Command Line Interface.
static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
AST_TEST_DEFINE(test_agi_null_docs)
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_str_update(struct ast_str *buf)
Update the length of the buffer, after using ast_str merely as a buffer.
static int handle_dbdeltree(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
ast_app: A registered application
const char * ast_channel_name(const struct ast_channel *chan)
int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
Writes a frame to a stream.
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"...
static char * handle_cli_agi_dump_html(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int handle_recvchar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
struct ast_speech * ast_speech_new(const char *engine_name, const struct ast_format_cap *formats)
Create a new speech structure.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static int handle_setcontext(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_answer(struct ast_channel *chan)
Answer a channel.
static void free_agi_cmd(struct agi_cmd *cmd)
static int deadagi_exec(struct ast_channel *chan, const char *data)
static int handle_setextension(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_sched_wait(struct ast_sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place.
char * ast_complete_channels(const char *line, const char *word, int pos, int state, int rpos)
Command completion for the list of active channels.
Data structure associated with a single frame of data.
const char * ast_channel_language(const struct ast_channel *chan)
Abstract JSON element (object, array, string, int, ...).
static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_channel_get_intercept_mode(void)
Am I currently running an intercept dialplan routine.
SAY_EXTERN int(* ast_say_character_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, enum ast_say_case_sensitivity sensitivity, int audiofd, int ctrlfd) SAY_INIT(ast_say_character_str_full)
const char * ast_channel_context(const struct ast_channel *chan)
Handy terminal functions for vt* terms.
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int error(const char *format,...)
const struct ast_flags ast_uri_http
int setenv(const char *name, const char *value, int overwrite)
#define ast_datastore_alloc(info, uid)
union ast_frame::@263 data
enum ast_frame_type frametype
static int handle_dbput(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define AST_OPTIONAL_API_NAME(name)
Expands to the name of the implementation function.
static void write_html_escaped(FILE *htmlfile, char *str)
Convert string to use HTML escaped characters.
struct ast_filestream * vfs
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
static struct ast_str * prompt
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.
static char context[AST_MAX_CONTEXT]
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
int ast_speech_write(struct ast_speech *speech, void *data, int len)
Write audio to the speech engine.
static int handle_sayphonetic(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_speech_grammar_load(struct ast_speech *speech, const char *grammar_name, const char *grammar)
Load a grammar on a speech structure (not globally)
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
struct ast_app * pbx_findapp(const char *app)
Look up an application.
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Say numbers and dates (maybe words one day too)
int AST_OPTIONAL_API_NAME() ast_agi_send(int fd, struct ast_channel *chan, char *fmt,...)
#define ASTERISK_GPL_KEY
The text the key() function should return.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
static int handle_setvariable(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
const char * ast_config_AST_VAR_DIR
SAY_EXTERN int(* ast_say_phonetic_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_phonetic_str_full)
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
static snd_pcm_format_t format
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Persistant data storage (akin to *doze registry)
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value)
Change an engine specific attribute.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int unload_module(void)
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
static int handle_sendimage(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[])
#define AST_RWLIST_TRAVERSE_SAFE_END
int ast_waitfordigit_full(struct ast_channel *c, int ms, const char *breakon, int audiofd, int ctrlfd)
Wait for a digit Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to mon...
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_db_deltree(const char *family, const char *keytree)
Delete one or more entries in astdb.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
static int handle_speechunloadgrammar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_connect(int sockfd, const struct ast_sockaddr *addr)
Wrapper around connect(2) that uses struct ast_sockaddr.
static enum agi_result launch_netscript(char *agiurl, char *argv[], int *fds)
struct ast_filestream * ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
Opens stream for use in seeking, playing.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
#define ast_mutex_unlock(a)
int ast_sockaddr_resolve(struct ast_sockaddr **addrs, const char *str, int flags, int family)
Parses a string with an IPv4 or IPv6 address and place results into an array.
int ast_sendtext(struct ast_channel *chan, const char *text)
Sends text to a channel.
#define AST_APP_ARG(name)
Define an application argument.
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])