1384#define MAX_CMD_LEN 80
1385#define AGI_NANDFS_RETRY 3
1386#define AGI_BUF_LEN 2048
1387#define SRV_PREFIX "_agi._tcp."
1397#define TONE_BLOCK_SIZE 200
1400#define MAX_AGI_CONNECT 2000
1402#define AGI_PORT 4573
1405#define ASYNC_AGI_BREAK 3
1424 if (!channel_string || !event_string) {
1479#define AGI_BUF_INITSIZE 256
1562 ast_log(
LOG_ERROR,
"Huh? Async AGI datastore disappeared on Channel %s!\n",
1629 agi_cmds_list =
ast_calloc(1,
sizeof(*agi_cmds_list));
1630 if (!agi_cmds_list) {
1635 datastore->
data = agi_cmds_list;
1658 e->
usage =
"Usage: agi exec <channel name> <app and arguments> [id]\n"
1659 " Add AGI command to the execute queue of the specified channel in Async AGI\n";
1672 ast_cli(
a->fd,
"Channel %s does not exist.\n",
a->argv[2]);
1678 if (
add_agi_cmd(chan,
a->argv[3], (
a->argc > 4 ?
a->argv[4] :
""))) {
1718 snprintf(
buf,
sizeof(
buf),
"Channel %s does not exist.", channel);
1801#define AGI_BUF_SIZE 1024
1802#define AMI_BUF_SIZE 2048
1841 async_agi.
fd = fds[1];
1842 async_agi.
ctrl = fds[1];
1843 async_agi.
audio = -1;
1849 setup_env(chan,
"async", fds[1], 0, argc, argv);
1853 ast_log(
LOG_ERROR,
"Failed to read from Async AGI pipe on channel %s: %s\n",
1856 goto async_agi_abort;
1858 agi_buffer[res] =
'\0';
1880 goto async_agi_done;
1894 ast_log(
LOG_ERROR,
"Failed to read from Async AGI pipe on channel %s: %s\n",
1898 goto async_agi_done;
1905 agi_buffer[res] =
'\0';
1921 switch (cmd_status) {
1926 goto async_agi_done;
1932 goto async_agi_done;
1957 returnstatus = cmd_status;
1958 goto async_agi_done;
1990 return returnstatus;
2009 struct pollfd pfds[1];
2013 reslen =
sizeof(conresult);
2015 pfds[0].fd = netsockfd;
2016 pfds[0].events = POLLOUT;
2019 if (
errno != EINTR) {
2021 ast_log(
LOG_WARNING,
"FastAGI connection to '%s' timed out after MAX_AGI_CONNECT (%d) milliseconds.\n",
2031 if (getsockopt(pfds[0].fd, SOL_SOCKET, SO_ERROR, &conresult, &reslen) < 0) {
2051 char *host, *script;
2052 int num_addrs = 0, i = 0;
2059 if ((script = strchr(host,
'/'))) {
2070 for (i = 0; i < num_addrs; i++) {
2097 if (i == num_addrs) {
2103 if (
errno != EINTR) {
2143 char *host, *script;
2148 char resolved_uri[1024];
2149 const char *srvhost;
2150 unsigned short srvport;
2153 if (strlen(agiurl) < 7) {
2160 if ((script = strchr(host,
'/'))) {
2166 if (strchr(host,
':')) {
2174 snprintf(resolved_uri,
sizeof(resolved_uri),
"agi://%s:%d/%s", srvhost, srvport, script);
2177 ast_log(
LOG_WARNING,
"AGI request failed for host '%s' (%s:%d)\n", host, srvhost, srvport);
2198 int pid, toast[2], fromast[2], audio[2], res;
2202 *safe_fork_called = 0;
2204 if (!strncasecmp(script,
"agi://", 6)) {
2207 if (!strncasecmp(script,
"hagi://", 7)) {
2210 if (!strncasecmp(script,
"agi:async",
sizeof(
"agi:async") - 1)) {
2214 if (script[0] !=
'/') {
2220 if (stat(script, &st)) {
2229 if (pipe(fromast)) {
2258 *safe_fork_called = 1;
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)
2790 const char *format, *zone =
NULL;
2800 format =
"A dBY HMS";
2802 format =
"ABdY 'digits/at' IMp";
2836 int res,
max, timeout;
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;
2921 if (sscanf(argv[5],
"%30d", &ms) != 1)
2925 silencestr = strchr(argv[6],
's');
2926 if ((argc > 7) && (!silencestr))
2927 silencestr = strchr(argv[7],
's');
2928 if ((argc > 8) && (!silencestr))
2929 silencestr = strchr(argv[8],
's');
2932 if (strlen(silencestr) > 2) {
2933 if ((silencestr[0] ==
's') && (silencestr[1] ==
'=')) {
2937 silence = atoi(silencestr);
2971 if ((argc > 6 && sscanf(argv[6],
"%30ld", &sample_offset) != 1 && !
ast_begins_with(argv[6],
"s="))
2979 ast_agi_send(agi->
fd, chan,
"200 result=%d (randomerror) endpos=%ld\n", res, sample_offset);
3008 ast_agi_send(agi->
fd, chan,
"200 result=%d (waitfor) endpos=%ld\n", res,sample_offset);
3018 ast_agi_send(agi->
fd, chan,
"200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);
3054 totalsilence = dspsilence;
3058 if (totalsilence > silence) {
3082 ast_agi_send(agi->
fd, chan,
"200 result=%d (timeout) endpos=%ld\n", res, sample_offset);
3102 struct timeval whentohangup = { 0, 0 };
3106 if (sscanf(argv[2],
"%30lf", &timeout) != 1)
3111 whentohangup.tv_sec = timeout;
3112 whentohangup.tv_usec = (timeout - whentohangup.tv_sec) * 1000000.0;
3131 }
else if (argc == 2) {
3151 int res, workaround;
3153 const char *agi_exec_full_str;
3160 ast_verb(3,
"AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] :
"");
3180 res =
pbx_exec(chan, app_to_exec, argc == 2 ?
"" : argv[2]);
3222 }
else if (argc == 3) {
3256 char tempstr[1024] =
"";
3262 if (!
ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] ==
')')) {
3280 if (argc != 4 && argc != 5) {
3318 sscanf(argv[2],
"%30d", &level);
3386 if ((argc < 3) || (argc > 4)) {
3395 ast_agi_send(agi->
fd, chan,
"200 result=%c\n", num_deleted > 0 ?
'0' :
'1');
3403 e->
command =
"agi set debug [on|off]";
3405 "Usage: agi set debug [on|off]\n"
3406 " Enables/disables dumping of AGI transactions for\n"
3407 " debugging purposes.\n";
3414 if (
a->argc != e->
args)
3417 if (strncasecmp(
a->argv[3],
"off", 3) == 0) {
3419 }
else if (strncasecmp(
a->argv[3],
"on", 2) == 0) {
3439 if (!strncasecmp(argv[2],
"on", 2))
3441 else if (!strncasecmp(argv[2],
"off", 3))
3597 char dtmf = 0,
tmp[4096] =
"", *
buf =
tmp;
3598 int timeout = 0, offset = 0, res = 0, i = 0;
3599 long current_offset = 0;
3600 const char *reason =
NULL;
3603 size_t left =
sizeof(
tmp);
3615 timeout = atoi(argv[3]);
3619 offset = atoi(argv[4]);
3654 if ((timeout > 0) && (start > 0)) {
3656 if ((
current - start) >= timeout) {
3677 switch (speech->
state) {
3722 if (!strcasecmp(reason,
"speech")) {
3731 ast_agi_send(agi->
fd, chan,
"200 result=1 (speech) endpos=%ld results=%d %s\n", current_offset, i,
tmp);
3732 }
else if (!strcasecmp(reason,
"dtmf")) {
3733 ast_agi_send(agi->
fd, chan,
"200 result=1 (digit) digit=%c endpos=%ld\n", dtmf, current_offset);
3734 }
else if (!strcasecmp(reason,
"hangup") || !strcasecmp(reason,
"timeout")) {
3735 ast_agi_send(agi->
fd, chan,
"200 result=1 (%s) endpos=%ld\n", reason, current_offset);
3737 ast_agi_send(agi->
fd, chan,
"200 result=0 endpos=%ld\n", current_offset);
3805 ast_cli(fd,
"%5.5s %30.30s %s\n",
"Dead",
"Command",
"Description");
3811 if ((e->
cmda[0])[0] ==
'_')
3814 if (
match && strncasecmp(matchstr, fullcmd, strlen(matchstr)))
3827 ast_join(fullcmd,
sizeof(fullcmd), cmd->cmda);
3839#ifndef HAVE_NULLSAFE_PRINTF
3840 if (!cmd->summary) {
3849 if (!cmd->seealso) {
3859 ast_verb(5,
"AGI Command '%s' registered\n",fullcmd);
3870 int unregistered = 0;
3873 ast_join(fullcmd,
sizeof(fullcmd), cmd->cmda);
3898 ast_verb(5,
"AGI Command '%s' unregistered\n",fullcmd);
3900 return unregistered;
3905 unsigned int i, x = 0;
3907 for (i = 0; i <
len; i++) {
3916 for (; x > 0; x--) {
3938 for (i = 0; i <
len; i++) {
3960 for (y = 0;
match && cmds[y]; y++) {
3964 if (!e->
cmda[y] && !exact)
3971 if (strcasecmp(e->
cmda[y], cmds[y]))
3976 if ((exact > -1) && e->
cmda[y])
3989 int x = 0, quoted = 0, escaped = 0, whitespace = 1;
4001 if (quoted && whitespace) {
4010 if (!quoted && !escaped) {
4054 "CommandId", command_id,
4056 "ResultCode", result_code,
4068 const char *ami_res;
4074 "CommandId", command_id,
4075 "Command", ami_cmd);
4081 ami_res =
"Invalid or unknown command";
4092 res =
c->handler(chan, agi, argc, argv);
4101 ast_agi_send(agi->
fd, chan,
"520 Invalid command syntax. Proper usage not available.\n");
4103 ast_agi_send(agi->
fd, chan,
"520-Invalid command syntax. Proper usage follows:\n");
4110 ami_res =
"Failure";
4118 ami_res =
"Success";
4125 ami_res =
"Success";
4132 ami_res =
"Unknown Result";
4140 ami_res =
"Command Not Permitted on a dead channel or intercept routine";
4167 const char *sighup_str;
4168 const char *exit_on_hangup_str;
4177 exit_on_hangup =
ast_true(exit_on_hangup_str);
4180 if (!(readf = fdopen(agi->
ctrl,
"r"))) {
4182 if (send_sighup && pid > -1)
4197 }
else if (agi->
fast) {
4201 if (exit_on_hangup) {
4206 if (dead || in_intercept) {
4224 if (!returnstatus) {
4236 }
else if (outfd > -1) {
4237 size_t len =
sizeof(
buf);
4245 res = fgets(
buf + buflen,
len, readf);
4248 if (ferror(readf) && ((
errno != EINTR) && (
errno != EAGAIN)))
4252 buflen = strlen(
buf);
4253 if (buflen &&
buf[buflen - 1] ==
'\n')
4255 len =
sizeof(
buf) - buflen;
4257 ast_verbose(
"AGI Rx << temp buffer %s - errno %s\nNo \\n received, checking again.\n",
buf, strerror(
errno));
4271 if (*
buf && strncasecmp(
buf,
"failure", 7) == 0) {
4277 buflen = strlen(
buf);
4278 if (buflen &&
buf[buflen - 1] ==
'\n') {
4279 buf[buflen - 1] =
'\0';
4285 switch (cmd_status) {
4310 if (kill(pid, SIGHUP)) {
4315 waitpid(pid,
status, WNOHANG);
4316 }
else if (agi->
fast) {
4321 return returnstatus;
4332 e->
command =
"agi show commands [topic]";
4334 "Usage: agi show commands [topic] <topic>\n"
4335 " When called with a topic as an argument, displays usage\n"
4336 " information on the given command. If called without a\n"
4337 " topic, it provides a list of AGI commands.\n";
4341 if (
a->argc < e->
args - 1 || (
a->argc >= e->
args && strcasecmp(
a->argv[e->
args - 1],
"topic")))
4343 if (
a->argc > e->
args - 1) {
4355 size_t synlen, desclen, seealsolen, stxlen;
4365 snprintf(
info,
sizeof(
info),
"\n -= Info about agi '%s' =- ", fullcmd);
4374 goto return_cleanup;
4390 goto return_cleanup;
4401 goto return_cleanup;
4405 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,
4406 desctitle, description, syntitle,
synopsis, deadtitle, deadcontent,
4418 ast_cli(
a->fd,
"No such command '%s'.\n", fullcmd);
4437 fprintf(htmlfile,
"%s",
"<");
4440 fprintf(htmlfile,
"%s",
">");
4443 fprintf(htmlfile,
"%s",
"&");
4446 fprintf(htmlfile,
"%s",
""");
4449 fprintf(htmlfile,
"%c", *cur);
4464 if (!(htmlfile = fopen(filename,
"wt")))
4467 fprintf(htmlfile,
"<HTML>\n<HEAD>\n<TITLE>AGI Commands</TITLE>\n</HEAD>\n");
4468 fprintf(htmlfile,
"<BODY>\n<CENTER><B><H1>AGI Commands</H1></B></CENTER>\n\n");
4469 fprintf(htmlfile,
"<TABLE BORDER=\"0\" CELLSPACING=\"10\">\n");
4473 char *tempstr, *stringp;
4475 if (!command->
cmda[0])
4478 if ((command->
cmda[0])[0] ==
'_')
4482 fprintf(htmlfile,
"<TR><TD><TABLE BORDER=\"1\" CELLPADDING=\"5\" WIDTH=\"100%%\">\n");
4483 fprintf(htmlfile,
"<TR><TH ALIGN=\"CENTER\"><B>%s - %s</B></TH></TR>\n", fullcmd, command->
summary);
4489 tempstr =
strsep(&stringp,
"\n");
4491 fprintf(htmlfile,
"<TR><TD ALIGN=\"CENTER\">");
4493 fprintf(htmlfile,
"</TD></TR>\n");
4494 fprintf(htmlfile,
"<TR><TD ALIGN=\"CENTER\">\n");
4496 while ((tempstr =
strsep(&stringp,
"\n")) !=
NULL) {
4498 fprintf(htmlfile,
"<BR>\n");
4500 fprintf(htmlfile,
"</TD></TR>\n");
4501 fprintf(htmlfile,
"</TABLE></TD></TR>\n\n");
4505 fprintf(htmlfile,
"</TABLE>\n</BODY>\n</HTML>\n");
4516 "Usage: agi dump html <filename>\n"
4517 " Dumps the AGI command list in HTML format to the given\n"
4523 if (
a->argc != e->
args + 1)
4527 ast_cli(
a->fd,
"Could not create file '%s'\n",
a->argv[e->
args]);
4530 ast_cli(
a->fd,
"AGI HTML commands dumped to: %s\n",
a->argv[e->
args]);
4538 int fds[2], efd = -1, pid = -1;
4539 int safe_fork_called = 0;
4550 ast_debug(3,
"Hungup channel detected, running agi in dead mode.\n");
4551 memset(&agi, 0,
sizeof(agi));
4575 if (fds[1] != fds[0])
4580 if (safe_fork_called) {
4617 const char *requested_format_name;
4620 ast_log(
LOG_ERROR,
"EAGI cannot be run on a dead/hungup channel, please use AGI.\n");
4625 if (requested_format_name) {
4627 if (requested_format) {
4628 ast_verb(3,
"<%s> Setting EAGI audio pipe format to %s\n",
4631 ast_log(
LOG_ERROR,
"Could not find requested format: %s\n", requested_format_name);
4667#ifdef TEST_FRAMEWORK
4676 info->name =
"null_agi_docs";
4677 info->category =
"/res/agi/";
4678 info->summary =
"AGI command with no documentation";
4679 info->description =
"Test whether an AGI command with no documentation will crash Asterisk";
4690#ifndef HAVE_NULLSAFE_PRINTF
4757 .
requires =
"res_speech",
AGI Extension interfaces - Asterisk Gateway Interface.
Asterisk version information.
const char * ast_get_version(void)
Retrieve the Asterisk version string.
Persistent data storage (akin to *doze registry)
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
int ast_db_deltree(const char *family, const char *keytree)
Delete one or more entries in astdb.
static struct ast_str * prompt
Asterisk main include file. File version handling, generic pbx functions.
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_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s,...
enum ast_cc_service_type service
static void suspend(struct cc_core_instance *core_instance)
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
static int request(void *obj)
General Asterisk PBX channel definitions.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
const char * ast_channel_name(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.
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
const char * ast_channel_data(const struct ast_channel *chan)
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
Clear a flag on a channel.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
#define ast_channel_lock(chan)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
struct ast_silence_generator * ast_channel_start_silence_generator(struct ast_channel *chan)
Starts a silence generator on the given channel.
int ast_recvchar(struct ast_channel *chan, int timeout)
Receives a text character from a channel.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
int ast_channel_get_intercept_mode(void)
Am I currently running an intercept dialplan routine.
int ast_channel_priority(const struct ast_channel *chan)
void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state)
Stops a previously-started silence generator on the given channel.
#define ast_channel_ref(c)
Increase channel reference count.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_accountcode(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
int ast_check_hangup_locked(struct ast_channel *chan)
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
int ast_sendtext(struct ast_channel *chan, const char *text)
Sends text to 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.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_party_dialed * ast_channel_dialed(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.
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
@ AST_SOFTHANGUP_EXPLICIT
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
const char * ast_channel_language(const struct ast_channel *chan)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
int ast_channel_streamid(const struct ast_channel *chan)
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
@ AST_FLAG_DISABLE_WORKAROUNDS
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
int ast_answer(struct ast_channel *chan)
Answer a channel.
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
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...
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.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
char * ast_complete_channels(const char *line, const char *word, int pos, int state, int rpos)
Command completion for the list of active channels.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Convenient Signal Processing routines.
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set the minimum average magnitude threshold to determine talking by the DSP.
void ast_dsp_free(struct ast_dsp *dsp)
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
Process the audio frame for silence.
int ast_dsp_get_threshold_from_settings(enum threshold which)
Get silence threshold from dsp.conf.
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
void ast_verbose(const char *fmt,...)
Generic File Format Support. Should be included by clients of the file handling routines....
off_t ast_tellstream(struct ast_filestream *fs)
Tell where we are in a stream.
struct ast_filestream * ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
Opens stream for use in seeking, playing.
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd)
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
Writes a frame to a stream.
int ast_seekstream(struct ast_filestream *fs, off_t sample_offset, int whence)
Seeks into stream.
int ast_stream_rewind(struct ast_filestream *fs, off_t ms)
Rewind stream ms.
int ast_applystream(struct ast_channel *chan, struct ast_filestream *s)
Applies a open stream to a channel.
struct ast_filestream * ast_openvstream(struct ast_channel *chan, const char *filename, const char *preflang)
Opens stream for use in seeking, playing.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
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_truncstream(struct ast_filestream *fs)
Trunc stream at current location.
int ast_closestream(struct ast_filestream *f)
Closes a stream.
int ast_playstream(struct ast_filestream *s)
Play a open stream on a channel.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
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.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
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.
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,...
General Asterisk channel definitions for image handling.
int ast_send_image(struct ast_channel *chan, const char *filename)
Sends an image.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd)
Full version with audiofd and controlfd. NOTE: returns '2' on ctrlfd available, not '1' like other fu...
void ast_safe_fork_cleanup(void)
Common routine to cleanup after fork'ed process is complete (if reaping was stopped)
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_safe_fork(int stop_reaper)
Common routine to safely fork without a chance of a signal handler firing badly in the child.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
void ast_close_fds_above_n(int n)
Common routine for child processes, to close all fds prior to exec(2)
int setenv(const char *name, const char *value, int overwrite)
char * strsep(char **str, const char *delims)
@ AST_CONTROL_STREAM_STOP
#define ast_debug(level,...)
Log a DEBUG message.
void ast_child_verbose(int level, const char *fmt,...)
#define ast_verb(level,...)
struct ast_json * ast_json_string_create(const char *value)
Construct a JSON string from value.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
int ast_json_object_set(struct ast_json *object, const char *key, struct ast_json *value)
Set a field in a JSON object.
#define AST_RWLIST_REMOVE_CURRENT
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_RWLIST_TRAVERSE_SAFE_END
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_RWLIST_TRAVERSE
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Asterisk locking-related definitions:
#define ast_mutex_unlock(a)
#define ast_mutex_lock(a)
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
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.
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define ast_module_unref(mod)
Release a reference to the module.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_module_running_ref(mod)
Hold a reference to the module if it is running.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
int ast_connect(int sockfd, const struct ast_sockaddr *addr)
Wrapper around connect(2) that uses struct ast_sockaddr.
static char * ast_sockaddr_stringify(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() with default format.
#define ast_sockaddr_port(addr)
Get the port number of a socket address.
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.
#define ast_sockaddr_set_port(addr, port)
Sets the port number of a socket address.
Wrapper for network related headers, masking differences between various operating systems....
#define AST_OPTIONAL_API_NAME(name)
Expands to the name of the implementation function.
#define ast_opt_transmit_silence
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_KEY_DIR
const char * ast_config_AST_MODULE_DIR
const char * ast_config_AST_RUN_DIR
const char * ast_config_AST_DATA_DIR
const char * ast_config_AST_CONFIG_DIR
const char * ast_config_AST_SPOOL_DIR
const char * ast_config_AST_AGI_DIR
const char * ast_config_AST_VAR_DIR
const char * ast_config_AST_CONFIG_FILE
const char * ast_config_AST_MONITOR_DIR
const char * ast_config_AST_LOG_DIR
Core PBX routines and definitions.
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.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
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_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len)
executes a read operation on a function
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.
struct ast_app * pbx_findapp(const char *app)
Look up an application.
#define ast_poll(a, b, c)
static int handle_speechcreate(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int parse_args(char *s, int *max, const char *argv[])
static struct ast_cli_entry cli_agi[]
static struct ast_manager_event_blob * agi_exec_start_to_ami(struct stasis_message *message)
static int handle_getdata(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_asyncagi_break(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static void setup_env(struct ast_channel *chan, char *request, int fd, int enhanced, int argc, char *argv[])
static agi_command * find_command(const char *const cmds[], int exact)
static void agi_destroy_commands_cb(void *data)
static struct ast_manager_event_blob * agi_async_end_to_ami(struct stasis_message *message)
int AST_OPTIONAL_API_NAME() ast_agi_unregister_multiple(struct agi_command *cmd, unsigned int len)
Unregisters a group of AGI commands, provided as an array of struct agi_command entries.
static enum agi_result launch_ha_netscript(char *agiurl, char *argv[], int *fds)
static int handle_dbdeltree(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_speechactivategrammar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_setcontext(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static char * handle_cli_agi_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static enum agi_result async_agi_read_frame(struct ast_channel *chan)
static int handle_speechunloadgrammar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_dbput(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_setvariable(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)
static int handle_sayphonetic(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int AST_OPTIONAL_API_NAME() ast_agi_unregister(agi_command *cmd)
Unregisters an AGI command.
static int eagi_exec(struct ast_channel *chan, const char *data)
static struct ast_manager_event_blob * agi_channel_to_ami(const char *type, struct stasis_message *message)
static enum agi_result launch_netscript(char *agiurl, char *argv[], int *fds)
static int handle_noop(struct ast_channel *chan, AGI *agi, int arg, const char *const argv[])
static int handle_saydigits(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_tddmode(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int write_htmldump(const char *filename)
static int handle_speechloadgrammar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static enum agi_result launch_script(struct ast_channel *chan, char *script, int argc, char *argv[], int *fds, int *efd, int *opid, int *safe_fork_called)
static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int add_agi_cmd(struct ast_channel *chan, const char *cmd_buff, const char *cmd_id)
static struct ast_manager_event_blob * agi_async_exec_to_ami(struct stasis_message *message)
static int agi_exec_full(struct ast_channel *chan, const char *data, int enhanced, int dead)
static struct ast_threadstorage agi_buf
static int handle_dbdel(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_speechset(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int speech_streamfile(struct ast_channel *chan, const char *filename, const char *preflang, int offset)
static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi, int pid, int *status, int dead, int argc, char *argv[])
static char * handle_cli_agi_dump_html(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int handle_sendimage(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int add_to_agi(struct ast_channel *chan)
static int agi_exec(struct ast_channel *chan, const char *data)
static int get_agi_cmd(struct ast_channel *chan, struct agi_cmd **cmd)
Retrieve the list head to the requested channel's AGI datastore.
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
int AST_OPTIONAL_API_NAME() ast_agi_register(struct ast_module *mod, agi_command *cmd)
Registers an AGI command.
static int handle_autohangup(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_setmusic(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_setextension(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 struct ast_manager_event_blob * agi_async_start_to_ami(struct stasis_message *message)
static int handle_dbget(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static struct agi_command commands[]
AGI commands list.
static int handle_saynumber(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
Say number in various language syntaxes.
static char * handle_cli_agi_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_getvariablefull(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_connection(const char *agiurl, const struct ast_sockaddr addr, const int netsockfd)
static int handle_setcallerid(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
@ AGI_RESULT_SUCCESS_ASYNC
@ AGI_RESULT_SUCCESS_FAST
static void publish_async_exec_end(struct ast_channel *chan, int command_id, const char *command, int result_code, const char *result)
static int load_module(void)
static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static enum agi_result launch_asyncagi(struct ast_channel *chan, int argc, char *argv[], int *efd)
static int handle_speechdestroy(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static struct agi_commands agi_commands
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 int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_answer(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
STASIS_MESSAGE_TYPE_DEFN_LOCAL(agi_exec_start_type,.to_ami=agi_exec_start_to_ami,)
static int unload_module(void)
static char * help_workhorse(int fd, const char *const match[])
static int handle_sendtext(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_recvchar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf, int dead)
static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int AST_OPTIONAL_API_NAME() ast_agi_send(int fd, struct ast_channel *chan, char *fmt,...)
Sends a string of text to an application connected via AGI.
static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
int AST_OPTIONAL_API_NAME() 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.
static const struct ast_datastore_info agi_commands_datastore_info
static int handle_speechdeactivategrammar(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static int handle_channelstatus(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static void free_agi_cmd(struct agi_cmd *cmd)
static int deadagi_exec(struct ast_channel *chan, const char *data)
static int handle_sayalpha(struct ast_channel *chan, AGI *agi, int argc, const char *const argv[])
static void write_html_escaped(FILE *htmlfile, char *str)
Convert string to use HTML escaped characters.
static void to_ami(struct ast_sip_subscription *sub, struct ast_str **buf)
Say numbers and dates (maybe words one day too)
SAY_EXTERN int(* ast_say_date)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_date)
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.
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)
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)
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.
SAY_EXTERN int(* ast_say_time)(struct ast_channel *chan, time_t t, const char *ints, const char *lang) SAY_INIT(ast_say_time)
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)
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
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.
Generic Speech Recognition API.
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name)
Deactivate a grammar on a speech structure.
int ast_speech_grammar_unload(struct ast_speech *speech, const char *grammar_name)
Unload a grammar.
void ast_speech_start(struct ast_speech *speech)
Indicate to the speech engine that audio is now going to start being written.
int ast_speech_write(struct ast_speech *speech, void *data, int len)
Write audio to the speech engine.
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value)
Change an engine specific attribute.
struct ast_speech * ast_speech_new(const char *engine_name, const struct ast_format_cap *formats)
Create a new speech structure.
int ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
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)
int ast_speech_grammar_activate(struct ast_speech *speech, const char *grammar_name)
Activate a grammar on a speech structure.
int ast_speech_change_state(struct ast_speech *speech, int state)
Change state of a speech structure.
@ AST_SPEECH_STATE_NOT_READY
struct ast_speech_result * ast_speech_results_get(struct ast_speech *speech)
Get speech recognition results.
Support for DNS SRV records, used in to locate SIP services.
void ast_srv_cleanup(struct srv_context **context)
Cleanup resources associated with ast_srv_lookup.
int ast_srv_lookup(struct srv_context **context, const char *service, const char **host, unsigned short *port)
Retrieve set of SRV lookups, in order.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
String manipulation functions.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
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 S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#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_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
Parse a time (integer) string.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int ast_build_string(char **buffer, size_t *space, const char *fmt,...)
Build a string in a buffer, designed to be called repeatedly.
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
#define ast_str_make_space(buf, new_len)
void ast_str_update(struct ast_str *buf)
Update the length of the buffer, after using ast_str merely as a buffer.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
static int force_inline attribute_pure ast_begins_with(const char *str, const char *prefix)
Checks whether a string begins with another.
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
#define ast_join(s, len, w)
Join an array of strings into a single string.
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
struct agi_cmd::@422 entry
struct agi_command::@181 list
const char *const summary
const char *const seealso
const char *const cmda[AST_MAX_CMD_LEN]
struct ast_speech * speech
ast_app: A registered application
Blob of data associated with a channel.
struct ast_channel_snapshot * snapshot
Structure representing a snapshot of channel state.
enum ast_channel_state state
Main Channel structure associated with a channel.
descriptor for a cli entry.
int args
This gets set in ast_cli_register()
Structure for a data store type.
Structure for a data store object.
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
struct ast_filestream * vfs
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
Abstract JSON element (object, array, string, int, ...).
Struct containing info for an AMI event to send out.
Socket address structure.
struct sockaddr_storage ss
struct ast_speech_result * results
Support for dynamic strings.
In case you didn't read that giant block of text above the mansession_session struct,...
Handy terminal functions for vt* terms.
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
Colorize a specified string by adding terminal color codes.
#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_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
#define AST_TEST_DEFINE(hdr)
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int error(const char *format,...)
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
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.
char * ast_uri_encode(const char *string, char *outbuf, int buflen, struct ast_flags spec)
Turn text string to URI-encoded XX version.
#define ast_socket_nonblock(domain, type, protocol)
Create a non-blocking socket.
#define ast_clear_flag(p, flag)
long int ast_random(void)
const struct ast_flags ast_uri_http
#define ast_fd_set_flags(fd, flags)
Set flags on the given file descriptor.
#define ast_set_flag(p, flag)
Asterisk XML Documentation API.
char * ast_xmldoc_build_description(const char *type, const char *name, const char *module)
Generate description documentation from XML.
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_synopsis(const char *type, const char *name, const char *module)
Generate synopsis documentation from XML.
ast_doc_src
From where the documentation come from, this structure is useful for use it inside application/functi...
char * ast_xmldoc_build_seealso(const char *type, const char *name, const char *module)
Parse the <see-also> node content.
char * ast_xmldoc_printable(const char *bwinput, int withcolors)
Colorize and put delimiters (instead of tags) to the xmldoc output.