1549#define MAX_CMD_LEN 80
1550#define AGI_NANDFS_RETRY 3
1551#define AGI_BUF_LEN 2048
1552#define SRV_PREFIX "_agi._tcp."
1562#define TONE_BLOCK_SIZE 200
1565#define MAX_AGI_CONNECT 2000
1567#define AGI_PORT 4573
1570#define ASYNC_AGI_BREAK 3
1589 if (!channel_string || !event_string) {
1644#define AGI_BUF_INITSIZE 256
1727 ast_log(
LOG_ERROR,
"Huh? Async AGI datastore disappeared on Channel %s!\n",
1794 agi_cmds_list =
ast_calloc(1,
sizeof(*agi_cmds_list));
1795 if (!agi_cmds_list) {
1800 datastore->
data = agi_cmds_list;
1823 e->
usage =
"Usage: agi exec <channel name> <app and arguments> [id]\n"
1824 " Add AGI command to the execute queue of the specified channel in Async AGI\n";
1837 ast_cli(
a->fd,
"Channel %s does not exist.\n",
a->argv[2]);
1843 if (
add_agi_cmd(chan,
a->argv[3], (
a->argc > 4 ?
a->argv[4] :
""))) {
1883 snprintf(
buf,
sizeof(
buf),
"Channel %s does not exist.", channel);
1966#define AGI_BUF_SIZE 1024
1967#define AMI_BUF_SIZE 2048
2006 async_agi.
fd = fds[1];
2007 async_agi.
ctrl = fds[1];
2008 async_agi.
audio = -1;
2014 setup_env(chan,
"async", fds[1], 0, argc, argv);
2018 ast_log(
LOG_ERROR,
"Failed to read from Async AGI pipe on channel %s: %s\n",
2021 goto async_agi_abort;
2023 agi_buffer[res] =
'\0';
2045 goto async_agi_done;
2059 ast_log(
LOG_ERROR,
"Failed to read from Async AGI pipe on channel %s: %s\n",
2063 goto async_agi_done;
2070 agi_buffer[res] =
'\0';
2086 switch (cmd_status) {
2091 goto async_agi_done;
2097 goto async_agi_done;
2122 returnstatus = cmd_status;
2123 goto async_agi_done;
2155 return returnstatus;
2174 struct pollfd pfds[1];
2178 reslen =
sizeof(conresult);
2180 pfds[0].fd = netsockfd;
2181 pfds[0].events = POLLOUT;
2184 if (
errno != EINTR) {
2186 ast_log(
LOG_WARNING,
"FastAGI connection to '%s' timed out after MAX_AGI_CONNECT (%d) milliseconds.\n",
2196 if (getsockopt(pfds[0].fd, SOL_SOCKET, SO_ERROR, &conresult, &reslen) < 0) {
2216 char *host, *script;
2217 int num_addrs = 0, i = 0;
2224 if ((script = strchr(host,
'/'))) {
2235 for (i = 0; i < num_addrs; i++) {
2262 if (i == num_addrs) {
2268 if (
errno != EINTR) {
2308 char *host, *script;
2313 char resolved_uri[1024];
2314 const char *srvhost;
2315 unsigned short srvport;
2318 if (strlen(agiurl) < 7) {
2325 if ((script = strchr(host,
'/'))) {
2331 if (strchr(host,
':')) {
2339 snprintf(resolved_uri,
sizeof(resolved_uri),
"agi://%s:%d/%s", srvhost, srvport, script);
2342 ast_log(
LOG_WARNING,
"AGI request failed for host '%s' (%s:%d)\n", host, srvhost, srvport);
2363 int pid, toast[2], fromast[2], audio[2], res;
2367 *safe_fork_called = 0;
2369 if (!strncasecmp(script,
"agi://", 6)) {
2372 if (!strncasecmp(script,
"hagi://", 7)) {
2375 if (!strncasecmp(script,
"agi:async",
sizeof(
"agi:async") - 1)) {
2379 if (script[0] !=
'/') {
2385 if (stat(script, &st)) {
2394 if (pipe(fromast)) {
2423 *safe_fork_called = 1;
2447 dup2(fromast[0], STDIN_FILENO);
2448 dup2(toast[1], STDOUT_FILENO);
2450 dup2(audio[0], STDERR_FILENO + 1);
2452 close(STDERR_FILENO + 1);
2459 execv(script, argv);
2463 fprintf(stdout,
"failure\n");
2467 ast_verb(3,
"Launched AGI Script %s\n", script);
2469 fds[1] = fromast[1];
2514 ast_agi_send(fd, chan,
"agi_enhanced: %s\n", enhanced ?
"1.0" :
"0.0");
2518 ast_agi_send(fd, chan,
"agi_threadid: %ld\n", (
long)pthread_self());
2522 for(count = 1; count < argc; count++)
2523 ast_agi_send(fd, chan,
"agi_arg_%d: %s\n", count, argv[count]);
2553 if (sscanf(argv[3],
"%30d", &to) != 1)
2623 if (!strncasecmp(argv[2],
"on",2)) {
2628 if (!strncasecmp(argv[2],
"mate",4)) {
2631 if (!strncasecmp(argv[2],
"tdd",3)) {
2662 int res = 0,
skipms = 3000;
2668 if (argc < 5 || argc > 10) {
2676 if ((argc > 5) && (sscanf(argv[5],
"%30d", &
skipms) != 1)) {
2692 if (argc > 9 && (sscanf(argv[9],
"%30ld", &offsetms) != 1)) {
2699 if (res > 0 &&
stop && strchr(
stop, res)) {
2701 snprintf(stopkeybuf,
sizeof(stopkeybuf),
"%c", res);
2714 snprintf(offsetbuf,
sizeof(offsetbuf),
"%ld", offsetms);
2717 ast_agi_send(agi->
fd, chan,
"200 result=%d endpos=%ld\n", res, offsetms);
2726 long sample_offset = 0, max_length;
2727 const char *edigits =
"";
2729 if (argc < 4 || argc > 5) {
2737 if ((argc > 4) && (sscanf(argv[4],
"%30ld", &sample_offset) != 1)) {
2742 ast_agi_send(agi->
fd, chan,
"200 result=-1 endpos=%ld\n", sample_offset);
2747 ast_debug(1,
"Ooh, found a video stream, too\n");
2749 ast_verb(3,
"<%s> Playing '%s.%s' (escape_digits=%s) (sample_offset %ld) (language '%s')\n",
2774 ast_agi_send(agi->
fd, chan,
"200 result=%d endpos=%ld\n", res, sample_offset);
2785 long sample_offset = 0, max_length;
2787 const char *edigits =
"";
2789 if ( argc < 4 || argc > 5 )
2796 timeout = atoi(argv[4]);
2803 ast_agi_send(agi->
fd, chan,
"200 result=-1 endpos=%ld\n", sample_offset);
2809 ast_debug(1,
"Ooh, found a video stream, too\n");
2811 ast_verb(3,
"Playing '%s' (escape_digits=%s) (timeout %d)\n", argv[2], edigits, timeout);
2837 if ( !strchr(edigits,res) )
2841 ast_agi_send(agi->
fd, chan,
"200 result=%d endpos=%ld\n", res, sample_offset);
2854 if (argc < 4 || argc > 5)
2856 if (sscanf(argv[2],
"%30d", &num) != 1)
2871 if (sscanf(argv[2],
"%30d", &num) != 1)
2886 if (argc < 4 || argc > 5) {
2891 switch (argv[4][0]) {
2927 if (sscanf(argv[2],
"%30d", &num) != 1)
2942 if (sscanf(argv[2],
"%30d", &num) != 1)
2955 const char *format, *zone =
NULL;
2965 format =
"A dBY HMS";
2967 format =
"ABdY 'digits/at' IMp";
3001 int res,
max, timeout;
3007 timeout = atoi(argv[3]);
3011 max = atoi(argv[4]);
3052 if (sscanf(argv[2],
"%30d", &pri) != 1) {
3068 struct timeval start;
3069 long sample_offset = 0;
3078 char *silencestr =
NULL;
3086 if (sscanf(argv[5],
"%30d", &ms) != 1)
3090 silencestr = strchr(argv[6],
's');
3091 if ((argc > 7) && (!silencestr))
3092 silencestr = strchr(argv[7],
's');
3093 if ((argc > 8) && (!silencestr))
3094 silencestr = strchr(argv[8],
's');
3097 if (strlen(silencestr) > 2) {
3098 if ((silencestr[0] ==
's') && (silencestr[1] ==
'=')) {
3102 silence = atoi(silencestr);
3136 if ((argc > 6 && sscanf(argv[6],
"%30ld", &sample_offset) != 1 && !
ast_begins_with(argv[6],
"s="))
3144 ast_agi_send(agi->
fd, chan,
"200 result=%d (randomerror) endpos=%ld\n", res, sample_offset);
3173 ast_agi_send(agi->
fd, chan,
"200 result=%d (waitfor) endpos=%ld\n", res,sample_offset);
3183 ast_agi_send(agi->
fd, chan,
"200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);
3219 totalsilence = dspsilence;
3223 if (totalsilence > silence) {
3247 ast_agi_send(agi->
fd, chan,
"200 result=%d (timeout) endpos=%ld\n", res, sample_offset);
3267 struct timeval whentohangup = { 0, 0 };
3271 if (sscanf(argv[2],
"%30lf", &timeout) != 1)
3276 whentohangup.tv_sec = timeout;
3277 whentohangup.tv_usec = (timeout - whentohangup.tv_sec) * 1000000.0;
3296 }
else if (argc == 2) {
3316 int res, workaround;
3318 const char *agi_exec_full_str;
3325 ast_verb(3,
"AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] :
"");
3345 res =
pbx_exec(chan, app_to_exec, argc == 2 ?
"" : argv[2]);
3387 }
else if (argc == 3) {
3421 char tempstr[1024] =
"";
3427 if (!
ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] ==
')')) {
3445 if (argc != 4 && argc != 5) {
3483 sscanf(argv[2],
"%30d", &level);
3551 if ((argc < 3) || (argc > 4)) {
3560 ast_agi_send(agi->
fd, chan,
"200 result=%c\n", num_deleted > 0 ?
'0' :
'1');
3568 e->
command =
"agi set debug [on|off]";
3570 "Usage: agi set debug [on|off]\n"
3571 " Enables/disables dumping of AGI transactions for\n"
3572 " debugging purposes.\n";
3579 if (
a->argc != e->
args)
3582 if (strncasecmp(
a->argv[3],
"off", 3) == 0) {
3584 }
else if (strncasecmp(
a->argv[3],
"on", 2) == 0) {
3604 if (!strncasecmp(argv[2],
"on", 2))
3606 else if (!strncasecmp(argv[2],
"off", 3))
3762 char dtmf = 0, tmp[4096] =
"", *
buf = tmp;
3763 int timeout = 0, offset = 0, res = 0, i = 0;
3764 long current_offset = 0;
3765 const char *reason =
NULL;
3768 size_t left =
sizeof(tmp);
3780 timeout = atoi(argv[3]);
3784 offset = atoi(argv[4]);
3819 if ((timeout > 0) && (start > 0)) {
3821 if ((
current - start) >= timeout) {
3842 switch (speech->
state) {
3887 if (!strcasecmp(reason,
"speech")) {
3896 ast_agi_send(agi->
fd, chan,
"200 result=1 (speech) endpos=%ld results=%d %s\n", current_offset, i, tmp);
3897 }
else if (!strcasecmp(reason,
"dtmf")) {
3898 ast_agi_send(agi->
fd, chan,
"200 result=1 (digit) digit=%c endpos=%ld\n", dtmf, current_offset);
3899 }
else if (!strcasecmp(reason,
"hangup") || !strcasecmp(reason,
"timeout")) {
3900 ast_agi_send(agi->
fd, chan,
"200 result=1 (%s) endpos=%ld\n", reason, current_offset);
3902 ast_agi_send(agi->
fd, chan,
"200 result=0 endpos=%ld\n", current_offset);
3970 ast_cli(fd,
"%5.5s %30.30s %s\n",
"Dead",
"Command",
"Description");
3976 if ((e->
cmda[0])[0] ==
'_')
3979 if (
match && strncasecmp(matchstr, fullcmd, strlen(matchstr)))
3992 ast_join(fullcmd,
sizeof(fullcmd), cmd->cmda);
4006#ifndef HAVE_NULLSAFE_PRINTF
4007 if (!cmd->summary) {
4016 if (!cmd->seealso) {
4026 ast_verb(5,
"AGI Command '%s' registered\n",fullcmd);
4037 int unregistered = 0;
4040 ast_join(fullcmd,
sizeof(fullcmd), cmd->cmda);
4069 ast_verb(5,
"AGI Command '%s' unregistered\n",fullcmd);
4071 return unregistered;
4076 unsigned int i, x = 0;
4078 for (i = 0; i <
len; i++) {
4087 for (; x > 0; x--) {
4109 for (i = 0; i <
len; i++) {
4131 for (y = 0;
match && cmds[y]; y++) {
4135 if (!e->
cmda[y] && !exact)
4142 if (strcasecmp(e->
cmda[y], cmds[y]))
4147 if ((exact > -1) && e->
cmda[y])
4160 int x = 0, quoted = 0, escaped = 0, whitespace = 1;
4172 if (quoted && whitespace) {
4181 if (!quoted && !escaped) {
4225 "CommandId", command_id,
4227 "ResultCode", result_code,
4239 const char *ami_res;
4245 "CommandId", command_id,
4246 "Command", ami_cmd);
4252 ami_res =
"Invalid or unknown command";
4263 res =
c->handler(chan, agi, argc, argv);
4272 ast_agi_send(agi->
fd, chan,
"520 Invalid command syntax. Proper usage not available.\n");
4274 ast_agi_send(agi->
fd, chan,
"520-Invalid command syntax. Proper usage follows:\n");
4281 ami_res =
"Failure";
4289 ami_res =
"Success";
4296 ami_res =
"Success";
4303 ami_res =
"Unknown Result";
4311 ami_res =
"Command Not Permitted on a dead channel or intercept routine";
4338 const char *sighup_str;
4339 const char *exit_on_hangup_str;
4348 exit_on_hangup =
ast_true(exit_on_hangup_str);
4351 if (!(readf = fdopen(agi->
ctrl,
"r"))) {
4353 if (send_sighup && pid > -1)
4368 }
else if (agi->
fast) {
4372 if (exit_on_hangup) {
4377 if (dead || in_intercept) {
4395 if (!returnstatus) {
4407 }
else if (outfd > -1) {
4408 size_t len =
sizeof(
buf);
4416 res = fgets(
buf + buflen,
len, readf);
4419 if (ferror(readf) && ((
errno != EINTR) && (
errno != EAGAIN)))
4423 buflen = strlen(
buf);
4424 if (buflen &&
buf[buflen - 1] ==
'\n')
4426 len =
sizeof(
buf) - buflen;
4428 ast_verbose(
"AGI Rx << temp buffer %s - errno %s\nNo \\n received, checking again.\n",
buf, strerror(
errno));
4442 if (*
buf && strncasecmp(
buf,
"failure", 7) == 0) {
4448 buflen = strlen(
buf);
4449 if (buflen &&
buf[buflen - 1] ==
'\n') {
4450 buf[buflen - 1] =
'\0';
4456 switch (cmd_status) {
4481 if (kill(pid, SIGHUP)) {
4486 waitpid(pid,
status, WNOHANG);
4487 }
else if (agi->
fast) {
4492 return returnstatus;
4503 e->
command =
"agi show commands [topic]";
4505 "Usage: agi show commands [topic] <topic>\n"
4506 " When called with a topic as an argument, displays usage\n"
4507 " information on the given command. If called without a\n"
4508 " topic, it provides a list of AGI commands.\n";
4512 if (
a->argc < e->
args - 1 || (
a->argc >= e->
args && strcasecmp(
a->argv[e->
args - 1],
"topic")))
4514 if (
a->argc > e->
args - 1) {
4542 goto return_cleanup;
4546 "%s -= Info about AGI '%s' =- %s\n\n"
4583 ast_cli(
a->fd,
"No such command '%s'.\n", fullcmd);
4602 fprintf(htmlfile,
"%s",
"<");
4605 fprintf(htmlfile,
"%s",
">");
4608 fprintf(htmlfile,
"%s",
"&");
4611 fprintf(htmlfile,
"%s",
""");
4614 fprintf(htmlfile,
"%c", *cur);
4629 if (!(htmlfile = fopen(filename,
"wt")))
4632 fprintf(htmlfile,
"<HTML>\n<HEAD>\n<TITLE>AGI Commands</TITLE>\n</HEAD>\n");
4633 fprintf(htmlfile,
"<BODY>\n<CENTER><B><H1>AGI Commands</H1></B></CENTER>\n\n");
4634 fprintf(htmlfile,
"<TABLE BORDER=\"0\" CELLSPACING=\"10\">\n");
4638 char *tempstr, *stringp;
4640 if (!command->
cmda[0])
4643 if ((command->
cmda[0])[0] ==
'_')
4647 fprintf(htmlfile,
"<TR><TD><TABLE BORDER=\"1\" CELLPADDING=\"5\" WIDTH=\"100%%\">\n");
4648 fprintf(htmlfile,
"<TR><TH ALIGN=\"CENTER\"><B>%s - %s</B></TH></TR>\n", fullcmd, command->
summary);
4654 tempstr =
strsep(&stringp,
"\n");
4656 fprintf(htmlfile,
"<TR><TD ALIGN=\"CENTER\">");
4658 fprintf(htmlfile,
"</TD></TR>\n");
4659 fprintf(htmlfile,
"<TR><TD ALIGN=\"CENTER\">\n");
4661 while ((tempstr =
strsep(&stringp,
"\n")) !=
NULL) {
4663 fprintf(htmlfile,
"<BR>\n");
4665 fprintf(htmlfile,
"</TD></TR>\n");
4666 fprintf(htmlfile,
"</TABLE></TD></TR>\n\n");
4670 fprintf(htmlfile,
"</TABLE>\n</BODY>\n</HTML>\n");
4681 "Usage: agi dump html <filename>\n"
4682 " Dumps the AGI command list in HTML format to the given\n"
4688 if (
a->argc != e->
args + 1)
4692 ast_cli(
a->fd,
"Could not create file '%s'\n",
a->argv[e->
args]);
4695 ast_cli(
a->fd,
"AGI HTML commands dumped to: %s\n",
a->argv[e->
args]);
4703 int fds[2], efd = -1, pid = -1;
4704 int safe_fork_called = 0;
4715 ast_debug(3,
"Hungup channel detected, running agi in dead mode.\n");
4716 memset(&agi, 0,
sizeof(agi));
4740 if (fds[1] != fds[0])
4745 if (safe_fork_called) {
4782 const char *requested_format_name;
4785 ast_log(
LOG_ERROR,
"EAGI cannot be run on a dead/hungup channel, please use AGI.\n");
4790 if (requested_format_name) {
4792 if (requested_format) {
4793 ast_verb(3,
"<%s> Setting EAGI audio pipe format to %s\n",
4796 ast_log(
LOG_ERROR,
"Could not find requested format: %s\n", requested_format_name);
4832#ifdef TEST_FRAMEWORK
4841 info->name =
"null_agi_docs";
4842 info->category =
"/res/agi/";
4843 info->summary =
"AGI command with no documentation";
4844 info->description =
"Test whether an AGI command with no documentation will crash Asterisk";
4855#ifndef HAVE_NULLSAFE_PRINTF
4922 .
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.
int setenv(const char *name, const char *value, int overwrite)
char * strsep(char **str, const char *delims)
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 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_FLAG_DISABLE_WORKAROUNDS
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)
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_SOFTHANGUP_EXPLICIT
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)
@ 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::@425 entry
struct agi_command::@181 list
const char *const summary
const char *const arguments
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.
struct ast_datastore::@216 entry
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.
union ast_frame::@228 data
struct ast_frame_subclass subclass
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.
const char * ast_term_reset(void)
Returns the terminal reset code.
const char * ast_term_color(int fgcolor, int bgcolor)
Return a color sequence string.
#define COLORIZE(fg, bg, str)
#define COLORIZE_FMT
Shortcut macros for coloring a set of text.
#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_arguments(const char *type, const char *name, const char *module)
Generate the [arguments] tag based on type of node ('application', 'function' or 'agi') and name.
char * ast_xmldoc_build_synopsis(const char *type, const char *name, const char *module)
Generate synopsis documentation from XML.
char * ast_xmldoc_build_since(const char *type, const char *name, const char *module)
Parse the <since> node content.
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.