69 #define AST_API_MODULE
904 #define MAX_CMD_LEN 80
905 #define AGI_NANDFS_RETRY 3
906 #define AGI_BUF_LEN 2048
907 #define SRV_PREFIX "_agi._tcp."
917 #define TONE_BLOCK_SIZE 200
920 #define MAX_AGI_CONNECT 2000
922 #define AGI_PORT 4573
925 #define ASYNC_AGI_BREAK 3
939 #define AGI_BUF_INITSIZE 256
1014 ast_log(
LOG_ERROR,
"Huh? Async AGI datastore disappeared on Channel %s!\n",
1080 agi_cmds_list =
ast_calloc(1,
sizeof(*agi_cmds_list));
1081 if (!agi_cmds_list) {
1086 datastore->
data = agi_cmds_list;
1109 e->
usage =
"Usage: agi exec <channel name> <app and arguments> [id]\n"
1110 " Add AGI command to the execute queue of the specified channel in Async AGI\n";
1130 ast_cli(a->
fd,
"Failed to add AGI command to queue of channel %s\n", chan->
name);
1136 ast_debug(1,
"Added AGI command to channel %s queue\n", chan->
name);
1169 snprintf(buf,
sizeof(buf),
"Channel %s does not exist.", channel);
1177 snprintf(buf,
sizeof(buf),
"Failed to add AGI command to channel %s queue", chan->
name);
1193 static void setup_env(
struct ast_channel *chan,
char *request,
int fd,
int enhanced,
int argc,
char *argv[]);
1211 ast_debug(3,
"No frame read on channel %s, going out ...\n", chan->
name);
1221 ast_debug(3,
"Got HANGUP frame on channel %s, going out ...\n", chan->
name);
1252 #define AGI_BUF_SIZE 1024
1253 #define AMI_BUF_SIZE 2048
1291 async_agi.
fd = fds[1];
1292 async_agi.
ctrl = fds[1];
1293 async_agi.
audio = -1;
1299 setup_env(chan,
"async", fds[1], 0, 0, NULL);
1303 ast_log(
LOG_ERROR,
"Failed to read from Async AGI pipe on channel %s: %s\n",
1304 chan->
name, res < 0 ? strerror(
errno) :
"EOF");
1306 goto async_agi_abort;
1308 agi_buffer[res] =
'\0';
1314 "SubEvent: Start\r\n"
1316 "Env: %s\r\n", chan->
name, ami_buffer);
1333 ast_log(
LOG_ERROR,
"Failed to read from Async AGI pipe on channel %s: %s\n",
1334 chan->
name, res < 0 ? strerror(
errno) :
"EOF");
1337 goto async_agi_done;
1344 agi_buffer[res] =
'\0';
1348 "SubEvent: Exec\r\n"
1350 "Result: %s\r\n", chan->
name, ami_buffer);
1353 "SubEvent: Exec\r\n"
1356 "Result: %s\r\n", chan->
name, cmd->
cmd_id, ami_buffer);
1365 switch (cmd_status) {
1370 goto async_agi_done;
1376 goto async_agi_done;
1386 ast_debug(1,
"ast_waitfor returned <= 0 on chan %s\n", chan->
name);
1401 returnstatus = cmd_status;
1402 goto async_agi_done;
1419 "Channel: %s\r\n", chan->
name);
1437 return returnstatus;
1447 int s, flags, res, port =
AGI_PORT;
1448 struct pollfd pfds[1];
1449 char *host, *c, *script;
1450 struct sockaddr_in addr_in;
1457 if ((script = strchr(host,
'/'))) {
1463 if ((c = strchr(host,
':'))) {
1471 if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
1475 if ((flags = fcntl(s, F_GETFL)) < 0) {
1480 if (fcntl(s, F_SETFL, flags | O_NONBLOCK) < 0) {
1485 memset(&addr_in, 0,
sizeof(addr_in));
1486 addr_in.sin_family = AF_INET;
1487 addr_in.sin_port = htons(port);
1488 memcpy(&addr_in.sin_addr, hp->h_addr,
sizeof(addr_in.sin_addr));
1489 if (connect(s, (
struct sockaddr *)&addr_in,
sizeof(addr_in)) && (
errno != EINPROGRESS)) {
1496 pfds[0].events = POLLOUT;
1498 if (
errno != EINTR) {
1500 ast_log(
LOG_WARNING,
"FastAGI connection to '%s' timed out after MAX_AGI_CONNECT (%d) milliseconds.\n",
1510 if (
errno != EINTR) {
1520 ast_agi_send(s, NULL,
"agi_network_script: %s\n", script);
1549 char *host, *script;
1554 char resolved_uri[1024];
1555 const char *srvhost;
1556 unsigned short srvport;
1559 if (strlen(agiurl) < 7) {
1566 if ((script = strchr(host,
'/'))) {
1572 if (strchr(host,
':')) {
1577 snprintf(service,
sizeof(service),
"%s%s",
SRV_PREFIX, host);
1579 while (!(srv_ret =
ast_srv_lookup(&context, service, &srvhost, &srvport))) {
1580 snprintf(resolved_uri,
sizeof(resolved_uri),
"agi://%s:%d/%s", srvhost, srvport, script);
1583 ast_log(
LOG_WARNING,
"AGI request failed for host '%s' (%s:%d)\n", host, srvhost, srvport);
1604 int pid, toast[2], fromast[2], audio[2], res;
1607 if (!strncasecmp(script,
"agi://", 6)) {
1610 if (!strncasecmp(script,
"hagi://", 7)) {
1613 if (!strncasecmp(script,
"agi:async",
sizeof(
"agi:async") - 1)) {
1617 if (script[0] !=
'/') {
1623 if (stat(script, &st)) {
1632 if (pipe(fromast)) {
1647 res = fcntl(audio[1], F_GETFL);
1649 res = fcntl(audio[1], F_SETFL, res | O_NONBLOCK);
1684 dup2(fromast[0], STDIN_FILENO);
1685 dup2(toast[1], STDOUT_FILENO);
1687 dup2(audio[0], STDERR_FILENO + 1);
1689 close(STDERR_FILENO + 1);
1696 execv(script, argv);
1700 fprintf(stdout,
"failure\n");
1704 ast_verb(3,
"Launched AGI Script %s\n", script);
1706 fds[1] = fromast[1];
1751 ast_agi_send(fd, chan,
"agi_enhanced: %s\n", enhanced ?
"1.0" :
"0.0");
1755 ast_agi_send(fd, chan,
"agi_threadid: %ld\n", (
long)pthread_self());
1759 for(count = 1; count < argc; count++)
1760 ast_agi_send(fd, chan,
"agi_arg_%d: %s\n", count, argv[count]);
1790 if (sscanf(argv[3],
"%30d", &to) != 1)
1860 if (!strncasecmp(argv[2],
"on",2)) {
1865 if (!strncasecmp(argv[2],
"mate",4)) {
1868 if (!strncasecmp(argv[2],
"tdd",3)) {
1899 int res = 0,
skipms = 3000;
1900 const char *fwd =
"#", *rev =
"*", *
suspend = NULL, *
stop = NULL;
1902 if (argc < 5 || argc > 9) {
1910 if ((argc > 5) && (sscanf(argv[5],
"%30d", &
skipms) != 1)) {
1937 long sample_offset = 0, max_length;
1938 const char *edigits =
"";
1940 if (argc < 4 || argc > 5)
1946 if ((argc > 4) && (sscanf(argv[4],
"%30ld", &sample_offset) != 1))
1950 ast_agi_send(agi->
fd, chan,
"200 result=-1 endpos=%ld\n", sample_offset);
1955 ast_debug(1,
"Ooh, found a video stream, too\n");
1957 ast_verb(3,
"Playing '%s' (escape_digits=%s) (sample_offset %ld)\n", argv[2], edigits, sample_offset);
1978 ast_agi_send(agi->
fd, chan,
"200 result=%d endpos=%ld\n", res, sample_offset);
1987 long sample_offset = 0, max_length;
1989 const char *edigits =
"";
1991 if ( argc < 4 || argc > 5 )
1998 timeout = atoi(argv[4]);
2005 ast_agi_send(agi->
fd, chan,
"200 result=-1 endpos=%ld\n", sample_offset);
2011 ast_debug(1,
"Ooh, found a video stream, too\n");
2013 ast_verb(3,
"Playing '%s' (escape_digits=%s) (timeout %d)\n", argv[2], edigits, timeout);
2039 if ( !strchr(edigits,res) )
2043 ast_agi_send(agi->
fd, chan,
"200 result=%d endpos=%ld\n", res, sample_offset);
2056 if (argc < 4 || argc > 5)
2058 if (sscanf(argv[2],
"%30d", &num) != 1)
2073 if (sscanf(argv[2],
"%30d", &num) != 1)
2103 if (sscanf(argv[2],
"%30d", &num) != 1)
2118 if (sscanf(argv[2],
"%30d", &num) != 1)
2131 const char *
format, *zone = NULL;
2140 if (!strcasecmp(chan->
language,
"de")) {
2141 format =
"A dBY HMS";
2143 format =
"ABdY 'digits/at' IMp";
2177 int res, max, timeout;
2183 timeout = atoi(argv[3]);
2187 max = atoi(argv[4]);
2228 if (sscanf(argv[2],
"%30d", &pri) != 1) {
2244 struct timeval start;
2245 long sample_offset = 0;
2254 char *silencestr = NULL;
2261 if (sscanf(argv[5],
"%30d", &ms) != 1)
2265 silencestr = strchr(argv[6],
's');
2266 if ((argc > 7) && (!silencestr))
2267 silencestr = strchr(argv[7],
's');
2268 if ((argc > 8) && (!silencestr))
2269 silencestr = strchr(argv[8],
's');
2272 if (strlen(silencestr) > 2) {
2273 if ((silencestr[0] ==
's') && (silencestr[1] ==
'=')) {
2277 silence = atoi(silencestr);
2304 if ((argc >6) && (sscanf(argv[6],
"%30ld", &sample_offset) != 1) && (!strchr(argv[6],
'=')))
2307 if ((argc > 7) && (!strchr(argv[7],
'=')))
2313 ast_agi_send(agi->
fd, chan,
"200 result=%d (randomerror) endpos=%ld\n", res, sample_offset);
2338 ast_agi_send(agi->
fd, chan,
"200 result=%d (waitfor) endpos=%ld\n", res,sample_offset);
2345 ast_agi_send(agi->
fd, chan,
"200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);
2378 totalsilence = dspsilence;
2382 if (totalsilence > silence) {
2405 ast_agi_send(agi->
fd, chan,
"200 result=%d (timeout) endpos=%ld\n", res, sample_offset);
2422 struct timeval whentohangup = { 0, 0 };
2426 if (sscanf(argv[2],
"%30lf", &timeout) != 1)
2431 whentohangup.tv_sec = timeout;
2432 whentohangup.tv_usec = (timeout - whentohangup.tv_sec) * 1000000.0;
2449 }
else if (argc == 2) {
2469 int res, workaround;
2475 ast_verb(3,
"AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] :
"");
2482 char *compat =
ast_alloca(strlen(argv[2]) * 2 + 1), *cptr;
2484 for (cptr = compat, vptr = argv[2]; *vptr; vptr++) {
2488 }
else if (*vptr ==
'|') {
2495 res =
pbx_exec(chan, app_to_exec, compat);
2497 res =
pbx_exec(chan, app_to_exec, argc == 2 ?
"" : argv[2]);
2515 char *l = NULL, *n = NULL;
2540 }
else if (argc == 3) {
2567 char tempstr[1024] =
"";
2573 if (!
ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] ==
')')) {
2574 ret =
ast_func_read(chan, argv[2], tempstr,
sizeof(tempstr)) ? NULL : tempstr;
2591 if (argc != 4 && argc != 5) {
2629 sscanf(argv[2],
"%30d", &level);
2697 if ((argc < 3) || (argc > 4)) {
2706 ast_agi_send(agi->
fd, chan,
"200 result=%c\n", num_deleted > 0 ?
'0' :
'1');
2714 e->
command =
"agi set debug [on|off]";
2716 "Usage: agi set debug [on|off]\n"
2717 " Enables/disables dumping of AGI transactions for\n"
2718 " debugging purposes.\n";
2728 if (strncasecmp(a->
argv[3],
"off", 3) == 0) {
2730 }
else if (strncasecmp(a->
argv[3],
"on", 2) == 0) {
2735 ast_cli(a->
fd,
"AGI Debugging %sabled\n", agidebug ?
"En" :
"Dis");
2750 if (!strncasecmp(argv[2],
"on", 2))
2752 else if (!strncasecmp(argv[2],
"off", 3))
2900 char dtmf = 0, tmp[4096] =
"", *buf = tmp;
2901 int timeout = 0, offset = 0, res = 0, i = 0;
2902 long current_offset = 0;
2903 const char *reason = NULL;
2906 size_t left =
sizeof(tmp);
2907 time_t start = 0, current;
2918 timeout = atoi(argv[3]);
2922 offset = atoi(argv[4]);
2957 if ((timeout > 0) && (start > 0)) {
2959 if ((current - start) >= timeout) {
2978 switch (speech->
state) {
3022 if (!strcasecmp(reason,
"speech")) {
3031 ast_agi_send(agi->
fd, chan,
"200 result=1 (speech) endpos=%ld results=%d %s\n", current_offset, i, tmp);
3032 }
else if (!strcasecmp(reason,
"dtmf")) {
3033 ast_agi_send(agi->
fd, chan,
"200 result=1 (digit) digit=%c endpos=%ld\n", dtmf, current_offset);
3034 }
else if (!strcasecmp(reason,
"hangup") || !strcasecmp(reason,
"timeout")) {
3035 ast_agi_send(agi->
fd, chan,
"200 result=1 (%s) endpos=%ld\n", reason, current_offset);
3037 ast_agi_send(agi->
fd, chan,
"200 result=0 endpos=%ld\n", current_offset);
3050 { {
"database",
"del", NULL },
handle_dbdel, NULL, NULL, 1 },
3052 { {
"database",
"get", NULL },
handle_dbget, NULL, NULL, 1 },
3053 { {
"database",
"put", NULL },
handle_dbput, NULL, NULL, 1 },
3103 ast_join(matchstr,
sizeof(matchstr), match);
3105 ast_cli(fd,
"%5.5s %30.30s %s\n",
"Dead",
"Command",
"Description");
3111 if ((e->
cmda[0])[0] ==
'_')
3114 if (match && strncasecmp(matchstr, fullcmd, strlen(matchstr)))
3127 ast_join(fullcmd,
sizeof(fullcmd), cmd->cmda);
3139 #ifndef HAVE_NULLSAFE_PRINTF
3140 if (!cmd->summary) {
3149 if (!cmd->seealso) {
3161 ast_verb(2,
"AGI Command '%s' registered\n",fullcmd);
3172 int unregistered = 0;
3175 ast_join(fullcmd,
sizeof(fullcmd), cmd->cmda);
3189 *((
char **) &e->
summary) = NULL;
3190 *((
char **) &e->
usage) = NULL;
3191 *((
char **) &e->
syntax) = NULL;
3192 *((
char **) &e->
seealso) = NULL;
3202 ast_verb(2,
"AGI Command '%s' unregistered\n",fullcmd);
3205 return unregistered;
3210 unsigned int i, x = 0;
3212 for (i = 0; i <
len; i++) {
3221 for (; x > 0; x--) {
3243 for (i = 0; i <
len; i++) {
3265 for (y = 0; match && cmds[y]; y++) {
3269 if (!e->
cmda[y] && !exact)
3276 if (strcasecmp(e->
cmda[y], cmds[y]))
3281 if ((exact > -1) && e->
cmda[y])
3294 int x = 0, quoted = 0, escaped = 0, whitespace = 1;
3306 if (quoted && whitespace) {
3315 if (!quoted && !escaped) {
3361 const char *ami_res;
3367 "SubEvent: Start\r\n"
3370 "Command: %s\r\n", chan->
name, command_id, ami_cmd);
3373 if (c && (!dead || (dead && c->
dead))) {
3383 res = c->
handler(chan, agi, argc, argv);
3392 ami_res =
"Failure";
3397 ami_res =
"Success";
3401 ami_res =
"Unknown Result";
3410 "ResultCode: %d\r\n"
3411 "Result: %s\r\n", chan->
name, command_id, ami_cmd, resultcode, ami_res);
3415 ast_agi_send(agi->
fd, chan,
"520 Invalid command syntax. Proper usage not available.\n");
3417 ast_agi_send(agi->
fd, chan,
"520-Invalid command syntax. Proper usage follows:\n");
3431 ast_agi_send(agi->
fd, chan,
"511 Command Not Permitted on a dead channel\n");
3437 "ResultCode: 511\r\n"
3438 "Result: Command not permitted on a dead channel\r\n", chan->
name, command_id, ami_cmd);
3446 "ResultCode: 510\r\n"
3447 "Result: Invalid or unknown command\r\n", chan->
name, command_id, ami_cmd);
3466 const char *sighup_str;
3473 if (!(readf = fdopen(agi->
ctrl,
"r"))) {
3475 if (send_sighup && pid > -1)
3490 }
else if (agi->
fast) {
3514 if (!returnstatus) {
3526 }
else if (outfd > -1) {
3527 size_t len =
sizeof(buf);
3535 res = fgets(buf + buflen, len, readf);
3538 if (ferror(readf) && ((
errno != EINTR) && (
errno != EAGAIN)))
3540 if (res != NULL && !agi->
fast)
3542 buflen = strlen(buf);
3543 if (buflen && buf[buflen - 1] ==
'\n')
3545 len =
sizeof(buf) - buflen;
3547 ast_verbose(
"AGI Rx << temp buffer %s - errno %s\nNo \\n received, checking again.\n", buf, strerror(
errno));
3552 ast_verb(3,
"<%s>AGI Script %s completed, returning %d\n", chan->
name, request, returnstatus);
3554 waitpid(pid, status, 0);
3561 if (*buf && strncasecmp(buf,
"failure", 7) == 0) {
3567 buflen = strlen(buf);
3568 if (buflen && buf[buflen - 1] ==
'\n') {
3569 buf[buflen - 1] =
'\0';
3575 switch (cmd_status) {
3599 if (kill(pid, SIGHUP)) {
3604 waitpid(pid, status, WNOHANG);
3605 }
else if (agi->
fast) {
3610 return returnstatus;
3621 e->
command =
"agi show commands [topic]";
3623 "Usage: agi show commands [topic] <topic>\n"
3624 " When called with a topic as an argument, displays usage\n"
3625 " information on the given command. If called without a\n"
3626 " topic, it provides a list of AGI commands.\n";
3645 size_t synlen, desclen, seealsolen, stxlen;
3655 snprintf(info,
sizeof(info),
"\n -= Info about agi '%s' =- ", fullcmd);
3662 if (!seealso || !description || !synopsis) {
3664 goto return_cleanup;
3678 if (!synopsis || !description || !seealso) {
3680 goto return_cleanup;
3691 goto return_cleanup;
3695 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,
3696 desctitle, description, syntitle, synopsis, deadtitle, deadcontent,
3697 seealsotitle, seealso);
3708 ast_cli(a->
fd,
"No such command '%s'.\n", fullcmd);
3727 fprintf(htmlfile,
"%s",
"<");
3730 fprintf(htmlfile,
"%s",
">");
3733 fprintf(htmlfile,
"%s",
"&");
3736 fprintf(htmlfile,
"%s",
""");
3739 fprintf(htmlfile,
"%c", *cur);
3754 if (!(htmlfile = fopen(filename,
"wt")))
3757 fprintf(htmlfile,
"<HTML>\n<HEAD>\n<TITLE>AGI Commands</TITLE>\n</HEAD>\n");
3758 fprintf(htmlfile,
"<BODY>\n<CENTER><B><H1>AGI Commands</H1></B></CENTER>\n\n");
3759 fprintf(htmlfile,
"<TABLE BORDER=\"0\" CELLSPACING=\"10\">\n");
3763 char *tempstr, *stringp;
3765 if (!command->
cmda[0])
3768 if ((command->
cmda[0])[0] ==
'_')
3772 fprintf(htmlfile,
"<TR><TD><TABLE BORDER=\"1\" CELLPADDING=\"5\" WIDTH=\"100%%\">\n");
3773 fprintf(htmlfile,
"<TR><TH ALIGN=\"CENTER\"><B>%s - %s</B></TH></TR>\n", fullcmd, command->
summary);
3779 tempstr =
strsep(&stringp,
"\n");
3781 fprintf(htmlfile,
"<TR><TD ALIGN=\"CENTER\">");
3783 fprintf(htmlfile,
"</TD></TR>\n");
3784 fprintf(htmlfile,
"<TR><TD ALIGN=\"CENTER\">\n");
3786 while ((tempstr =
strsep(&stringp,
"\n")) != NULL) {
3788 fprintf(htmlfile,
"<BR>\n");
3790 fprintf(htmlfile,
"</TD></TR>\n");
3791 fprintf(htmlfile,
"</TABLE></TD></TR>\n\n");
3795 fprintf(htmlfile,
"</TABLE>\n</BODY>\n</HTML>\n");
3806 "Usage: agi dump html <filename>\n"
3807 " Dumps the AGI command list in HTML format to the given\n"
3828 int fds[2], efd = -1, pid = -1;
3839 ast_debug(3,
"Hungup channel detected, running agi in dead mode.\n");
3840 memset(&agi, 0,
sizeof(agi));
3864 if (fds[1] != fds[0])
3901 int readformat, res;
3904 ast_log(
LOG_ERROR,
"EAGI cannot be run on a dead/hungup channel, please use AGI.\n");
3934 #ifdef TEST_FRAMEWORK
3939 { {
"testnoop", NULL },
handle_noop, NULL, NULL, 0 };
3943 info->name =
"null_agi_docs";
3944 info->category =
"/res/agi/";
3945 info->summary =
"AGI command with no documentation";
3946 info->description =
"Test whether an AGI command with no documentation will crash Asterisk";
3957 #ifndef HAVE_NULLSAFE_PRINTF
3959 if (noop_command.
usage == NULL) {
3963 if (noop_command.
syntax == NULL) {
const char *const summary
#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[])
union ast_frame_subclass subclass
const char *const seealso
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[])
struct agi_command::@140 list
#define AST_CLI_DEFINE(fn, txt,...)
char * str
Subscriber phone number (Malloced)
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.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
int(*const handler)(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static void agi_destroy_commands_cb(void *data)
char * str
Subscriber phone number (Malloced)
void ast_module_unref(struct ast_module *)
struct ast_party_caller caller
Channel Caller ID information.
char * strsep(char **str, const char *delims)
struct ast_app * pbx_findapp(const char *app)
Look up an application.
int ast_safe_fork(int stop_reaper)
Common routine to safely fork without a chance of a signal handler firing badly in the child...
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[])
const ast_string_field uniqueid
String manipulation functions.
static struct agi_cmd * get_agi_cmd(struct ast_channel *chan)
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.
static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
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.
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.
int ast_db_get(const char *family, const char *key, char *out, int outlen)
Get key value specified by family/key.
#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.
struct ast_party_name name
Subscriber name.
int ast_agi_register(struct ast_module *mod, agi_command *cmd)
Registers an AGI command.
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
void ast_dsp_free(struct ast_dsp *dsp)
int ast_agi_register_multiple(struct ast_module *mod, struct agi_command *cmd, unsigned int len)
Registers a group of AGI commands, provided as an array of struct agi_command entries.
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.
Convenient Signal Processing routines.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
char context[AST_MAX_CONTEXT]
AGI Extension interfaces - Asterisk Gateway Interface.
#define ast_set_flag(p, flag)
descriptor for a cli entry.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
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.
static int add_agi_cmd(struct ast_channel *chan, const char *cmd_buff, const char *cmd_id)
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
void ast_verbose(const char *fmt,...)
struct ast_dsp * ast_dsp_new(void)
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.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define ast_compat_res_agi
void ast_safe_fork_cleanup(void)
Common routine to cleanup after fork'ed process is complete (if reaping was stopped) ...
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.
#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.
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
enum ast_cc_service_type service
#define AST_TEST_REGISTER(cb)
Structure for a data store type.
char * str
Subscriber name (Malloced)
struct ast_speech_result * ast_speech_results_get(struct ast_speech *speech)
Get speech recognition results.
static int speech_streamfile(struct ast_channel *chan, const char *filename, const char *preflang, int offset)
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[])
struct ast_str * ast_str_create(size_t init_len)
Create a malloc'ed dynamic length string.
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)
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
char * ast_uri_encode(const char *string, char *outbuf, int buflen, int do_special_char)
Turn text string to URI-encoded XX version.
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.
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.
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
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.
static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], int *efd)
ast_doc_src
From where the documentation come from, this structure is useful for use it inside application/functi...
#define ast_verb(level,...)
struct agi_cmd::@321 entry
static int handle_speechset(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
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.
int ast_send_image(struct ast_channel *chan, const char *filename)
Sends an image.
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_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
off_t ast_tellstream(struct ast_filestream *fs)
Tell where we are in a stream.
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, plus a null char.
struct ast_party_id id
Caller party ID.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
const char * ast_config_AST_CONFIG_FILE
SAY_EXTERN int(* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date)
int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
get values from config variables.
int ast_set_read_format(struct ast_channel *chan, format_t format)
Sets read format on channel chan Set read format for channel to whichever component of "format" is be...
#define ast_debug(level,...)
Log a DEBUG message.
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_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.
struct ast_party_dialed::@155 number
Dialed/Called number.
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_str_make_space(struct ast_str **buf, size_t new_len)
#define ast_test_status_update(a, b, c...)
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[])
#define ast_manager_register_xml(a, b, c)
Register a manager callback using XML documentation to describe the manager.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_poll(a, b, c)
static void setup_env(struct ast_channel *chan, char *request, int fd, int enhanced, int argc, char *argv[])
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...
#define AST_RWLIST_TRAVERSE
static int handle_setcallerid(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
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[])
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
static char * handle_cli_agi_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct sched_context * sched
static struct ast_cli_entry cli_agi[]
int(* timingfunc)(const void *data)
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
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...
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)
#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...
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set threshold value for silence.
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
struct ast_party_dialed dialed
Dialed/Called information.
const char * ast_config_AST_DATA_DIR
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define ast_strdupa(s)
duplicate a string in memory from the stack
static int agi_exec_full(struct ast_channel *chan, const char *data, int enhanced, int dead)
char * ast_getformatname(format_t format)
Get the name of a format.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
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.
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
#define AST_TEST_UNREGISTER(cb)
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 setenv(const char *name, const char *value, int overwrite)
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 ani2
Automatic Number Identification 2 (Info Digits)
SAY_EXTERN int(* ast_say_character_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_character_str_full)
enum ast_channel_state _state
static int write_htmldump(const char *filename)
const ast_string_field name
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
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static int handle_sayalpha(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
struct ast_datastore * ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
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.
const char * ast_config_AST_MONITOR_DIR
static int handle_saytime(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[])
void ast_join(char *s, size_t len, const char *const w[])
int ast_closestream(struct ast_filestream *f)
Closes a stream.
void ast_close_fds_above_n(int n)
Common routine for child processes, to close all fds prior to exec(2)
int ast_agi_unregister_multiple(struct ast_module *mod, struct agi_command *cmd, unsigned int len)
Unregisters a group of AGI commands, provided as an array of struct agi_command entries.
Asterisk XML Documentation API.
static void suspend(struct cc_core_instance *core_instance)
static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
void ast_cdr_setapp(struct ast_cdr *cdr, const char *app, const char *data)
Set the last executed application.
static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf, int dead)
const char * ast_config_AST_SPOOL_DIR
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[])
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[])
static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_truncstream(struct ast_filestream *fs)
Trunc stream at current location.
static struct agi_commands agi_commands
int ast_sched_runq(struct sched_context *con)
Runs the queue.
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int ctrlfd)
Wait for a digit Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to mon...
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...
int ast_srv_lookup(struct srv_context **context, const char *service, const char **host, unsigned short *port)
Retrieve set of SRV lookups, in order.
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)
Return non-zero if this is silence. Updates "totalsilence" with the total number of seconds of silenc...
int transit_network_select
Transit Network Select.
struct hostent * ast_gethostbyname(const char *host, struct ast_hostent *hp)
Thread-safe gethostbyname function to use in Asterisk.
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd)
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
#define AST_FORMAT_SLINEAR
#define ast_channel_ref(c)
Increase channel reference count.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
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)
Standard Command Line Interface.
static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
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
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"...
int ast_cli_register_multiple(struct ast_cli_entry *e, int len)
Register multiple commands.
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)
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[])
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
int ast_sched_wait(struct sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place Determine the number of s...
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[])
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
const ast_string_field accountcode
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.
#define AST_TEST_DEFINE(hdr)
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)
static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
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.
#define AST_APP_ARG(name)
Define an application argument.
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)
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.
unsigned char valid
TRUE if the name information is valid/present.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
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]
SAY_EXTERN int(* ast_say_time)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_time)
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)
struct ast_filestream * stream
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...
static enum agi_result launch_script(struct ast_channel *chan, char *script, char *argv[], int *fds, int *efd, int *opid)
Say numbers and dates (maybe words one day too)
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define manager_event(category, event, contents,...)
External routines may send asterisk manager events this way.
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.
static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static struct hostent * hp
static struct ast_datastore_info agi_commands_datastore_info
const char * ast_config_AST_VAR_DIR
static snd_pcm_format_t format
union ast_frame::@172 data
struct ast_channel_tech * tech
static int match(struct sockaddr_in *sin, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
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.
static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int unload_module(void)
unsigned char valid
TRUE if the number information is valid/present.
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
const ast_string_field language
int ast_agi_unregister(struct ast_module *mod, agi_command *cmd)
Unregisters an AGI command.
int ast_agi_send(int fd, struct ast_channel *chan, char *fmt,...)
Sends a string of text to an application connected via AGI.
char exten[AST_MAX_EXTENSION]
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 If both parameters are NULL, the entire database will be purged...
#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[])
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.
int ast_manager_unregister(char *action)
Unregister a registered manager command.
struct ast_speech * ast_speech_new(const char *engine_name, int formats)
Create a new speech structure.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define ast_mutex_unlock(a)
int ast_sendtext(struct ast_channel *chan, const char *text)
Sends text to a channel.
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[])
struct ast_module * ast_module_ref(struct ast_module *)
struct ast_party_number number
Subscriber phone number.