56    if (!strcmp(reason, 
"normal")) {
 
   58    } 
else if (!strcmp(reason, 
"busy")) {
 
   60    } 
else if (!strcmp(reason, 
"congestion")) {
 
   62    } 
else if (!strcmp(reason, 
"no_answer")) {
 
   64    } 
else if (!strcmp(reason, 
"timeout")) {
 
   66    } 
else if (!strcmp(reason, 
"rejected")) {
 
   68    } 
else if (!strcmp(reason, 
"unallocated")) {
 
   70    } 
else if (!strcmp(reason, 
"normal_unspecified")) {
 
   72    } 
else if (!strcmp(reason, 
"number_incomplete")) {
 
   74    } 
else if (!strcmp(reason, 
"codec_mismatch")) {
 
   76    } 
else if (!strcmp(reason, 
"interworking")) {
 
   78    } 
else if (!strcmp(reason, 
"failure")) {
 
   80    } 
else if(!strcmp(reason, 
"answered_elsewhere")) {
 
 
  134            "Channel in invalid state");
 
 
  155    const char *channel_id)
 
  162    if (control == 
NULL) {
 
  168                   "Channel not found");
 
  173               "Channel not in Stasis application");
 
 
  195    if (control == 
NULL) {
 
  210        context = snapshot->dialplan->context;
 
  211        exten = 
S_OR(
args->extension, snapshot->dialplan->exten);
 
  213        context = 
args->context;
 
  220        if (sscanf(
args->label, 
"%30d", &ipri) != 1) {
 
  228            ast_debug(3, 
"Numeric value provided for label, jumping to that priority\n");
 
  232            ast_log(
AST_LOG_ERROR, 
"Invalid priority label '%s' specified for extension %s in context: %s\n",
 
  233                    args->label, exten, context);
 
  238    } 
else if (
args->priority) {
 
  240        ipri = 
args->priority;
 
  243        ipri = snapshot->dialplan->priority + 1;
 
 
  270            "Failed to switch Stasis applications");
 
 
  298            "Required parameter 'endpoint' not provided.");
 
  303    if (!(resource = strchr(tech, 
'/')) || !(tech_len = resource - tech)) {
 
  305            "Endpoint parameter '%s' does not contain tech/resource", 
args->endpoint);
 
  312            "No resource provided in endpoint parameter '%s'", 
args->endpoint);
 
  317    if (!chan_snapshot) {
 
  319            "Unable to find channel snapshot for '%s'", 
args->channel_id);
 
  323    if (strncasecmp(chan_snapshot->base->type, tech, tech_len)) {
 
  325            "Endpoint technology '%s' does not match channel technology '%s'",
 
  326            tech, chan_snapshot->base->type);
 
  332            "Failed to redirect channel");
 
 
  346    if (control == 
NULL) {
 
  356            response, 500, 
"Internal Server Error",
 
  357            "Failed to answer channel");
 
 
  371    if (control == 
NULL) {
 
 
  391    if (control == 
NULL) {
 
 
  411    if (control == 
NULL) {
 
 
  433    if (control == 
NULL) {
 
  443            response, 400, 
"Bad Request",
 
  444            "Direction is required");
 
  448    if (!strcmp(
args->direction, 
"in")) {
 
  450    } 
else if (!strcmp(
args->direction, 
"out")) {
 
  452    } 
else if (!strcmp(
args->direction, 
"both")) {
 
  456            response, 400, 
"Bad Request",
 
  457            "Invalid direction specified");
 
 
  475    if (control == 
NULL) {
 
  485            response, 400, 
"Bad Request",
 
  486            "Direction is required");
 
  490    if (!strcmp(
args->direction, 
"in")) {
 
  492    } 
else if (!strcmp(
args->direction, 
"out")) {
 
  494    } 
else if (!strcmp(
args->direction, 
"both")) {
 
  498            response, 400, 
"Bad Request",
 
  499            "Invalid direction specified");
 
 
  515    if (control == 
NULL) {
 
  525            response, 400, 
"Bad Request",
 
 
  542    if (control == 
NULL) {
 
 
  563    if (control == 
NULL) {
 
 
  584    if (control == 
NULL) {
 
 
  604    if (control == 
NULL) {
 
 
  624    if (control == 
NULL) {
 
 
  644    if (control == 
NULL) {
 
 
  658    const char *args_channel_id,
 
  659    const char **args_media,
 
  660    size_t args_media_count,
 
  661    const char *args_lang,
 
  664    const char *args_playback_id,
 
  677    if (control == 
NULL) {
 
  689            response, 404, 
"Not Found",
 
  690            "Channel not found");
 
  694    if (args_skipms < 0) {
 
  696            response, 400, 
"Bad Request",
 
  697            "skipms cannot be negative");
 
  701    if (args_offsetms < 0) {
 
  703            response, 400, 
"Bad Request",
 
  704            "offsetms cannot be negative");
 
  714            response, 500, 
"Internal Server Error",
 
  715            "Failed to queue media for playback");
 
  723            response, 500, 
"Internal Server Error",
 
  731            response, 500, 
"Internal Server Error",
 
 
  780    size_t uri_name_maxlen;
 
  784    if (
args->max_duration_seconds < 0) {
 
  786            response, 400, 
"Bad Request",
 
  787            "max_duration_seconds cannot be negative");
 
  791    if (
args->max_silence_seconds < 0) {
 
  793            response, 400, 
"Bad Request",
 
  794            "max_silence_seconds cannot be negative");
 
  799    if (control == 
NULL) {
 
  807            response, 500, 
"Internal Server Error",
 
  811    options->max_silence_seconds = 
args->max_silence_seconds;
 
  812    options->max_duration_seconds = 
args->max_duration_seconds;
 
  821            response, 400, 
"Bad Request",
 
  822            "terminateOn invalid");
 
  828            response, 400, 
"Bad Request",
 
  835            response, 422, 
"Unprocessable Entity",
 
  836            "specified format is unknown on this system");
 
  841    if (recording == 
NULL) {
 
  848                response, 500, 
"Internal Server Error",
 
  849                "Error parsing request");
 
  853                "Recording '%s' already exists and can not be overwritten",
 
  858                response, 500, 
"Internal Server Error",
 
  863                response, 400, 
"Bad Request",
 
  864                "Recording name invalid");
 
  868                "Unrecognized recording error: %s\n",
 
  871                response, 500, 
"Internal Server Error",
 
  872                "Internal Server Error");
 
  878    uri_name_maxlen = strlen(
args->name) * 3;
 
  879    uri_encoded_name = 
ast_malloc(uri_name_maxlen);
 
  880    if (!uri_encoded_name) {
 
  882            response, 500, 
"Internal Server Error",
 
  890            uri_encoded_name) == -1) {
 
  891        recording_url = 
NULL;
 
  893            response, 500, 
"Internal Server Error",
 
  901            response, 500, 
"Internal Server Error",
 
 
  918            response, 404, 
"Not Found",
 
  919            "Channel not found");
 
 
  938            response, 404, 
"Not Found",
 
  939            "Channel not found");
 
  945            "The reason and reason_code can't both be specified");
 
  951        if (sscanf(
args->reason_code, 
"%30d", &cause) != 1) {
 
  953                response, 400, 
"Invalid Reason Code",
 
  954                "Invalid reason for hangup reason code provided");
 
  962                response, 400, 
"Invalid Reason",
 
  963                "Invalid reason for hangup reason provided");
 
 
 1085    const char *args_extension,
 
 1086    const char *args_context,
 
 1088    const char *args_label,
 
 1089    const char *args_app,
 
 1090    const char *args_app_args,
 
 1091    const char *args_caller_id,
 
 1094    const char *args_channel_id,
 
 1095    const char *args_other_channel_id,
 
 1096    const char *args_originator,
 
 1097    const char *args_formats,
 
 1101    char *dialdevice = 
NULL;
 
 1103    char *caller_id = 
NULL;
 
 1104    char *cid_num = 
NULL;
 
 1105    char *cid_name = 
NULL;
 
 1112        .uniqueid2 = args_other_channel_id,
 
 1127            "Endpoint must be specified");
 
 1133            "Originator and formats can't both be specified");
 
 1138    if ((stuff = strchr(dialtech, 
'/'))) {
 
 1145            "Invalid endpoint specified");
 
 1170        origination = 
ast_calloc(1, 
sizeof(*origination) + 1);
 
 1182            if (sscanf(args_label, 
"%30d", &ipri) != 1) {
 
 1186                    ast_log(
AST_LOG_ERROR, 
"Requested label: %s can not be found in context: %s\n", args_label, args_context);
 
 1191                ast_debug(3, 
"Numeric value provided for label, jumping to that priority\n");
 
 1195                ast_log(
AST_LOG_ERROR, 
"Invalid priority label '%s' specified for extension %s in context: %s\n",
 
 1196                        args_label, args_extension, args_context);
 
 1205            origination->
priority = args_priority ? args_priority : 1;
 
 1208        origination->
appdata[0] = 
'\0';
 
 1211            "Application or extension must be specified");
 
 1230    if (args_timeout > 0) {
 
 1232    } 
else if (args_timeout == -1) {
 
 1251                response, 400, 
"Bad Request",
 
 1252                "Provided originator channel was not found");
 
 1277                        response, 400, 
"Bad Request",
 
 1278                        "Provided format (%s) was not found", format_name);
 
 1296                "Channel with given unique ID already exists");
 
 1333            connected.id.number.str = (
char *) cid_num;
 
 1338            connected.id.name.str = (
char *) cid_name;
 
 
 1404            "Only string values in the 'variables' object allowed");
 
 
 1423    if (
args->variables) {
 
 1446        args->other_channel_id,
 
 
 1462    if (
args->variables) {
 
 1485        args->other_channel_id,
 
 
 1511            response, 400, 
"Bad Request",
 
 1512            "Variable name is required");
 
 1518            response, 400, 
"Bad Request",
 
 1519            "Channel ID is required");
 
 1526            response, 404, 
"Channel Not Found",
 
 1527            "Provided channel was not found");
 
 1538    if (
args->variable[strlen(
args->variable) - 1] == 
')') {
 
 1541                response, 500, 
"Error With Function",
 
 1542                "Unable to read provided function");
 
 1548                response, 404, 
"Variable Not Found",
 
 1549                "Provided variable was not found");
 
 
 1572            response, 400, 
"Bad Request",
 
 1573            "Variable name is required");
 
 1578    if (control == 
NULL) {
 
 1585            response, 400, 
"Bad Request",
 
 1586            "Failed to execute function");
 
 
 1594    const char *args_channel_id,
 
 1595    const char *args_spy,
 
 1596    const char *args_whisper,
 
 1597    const char *args_app,
 
 1598    const char *args_app_args,
 
 1599    const char *args_snoop_id,
 
 1611    } 
else if (!strcmp(args_spy, 
"both")) {
 
 1613    } 
else if (!strcmp(args_spy, 
"out")) {
 
 1615    } 
else if (!strcmp(args_spy, 
"in")) {
 
 1619            response, 400, 
"Bad Request",
 
 1620            "Invalid direction specified for spy");
 
 1626    } 
else if (!strcmp(args_whisper, 
"both")) {
 
 1628    } 
else if (!strcmp(args_whisper, 
"out")) {
 
 1630    } 
else if (!strcmp(args_whisper, 
"in")) {
 
 1634            response, 400, 
"Bad Request",
 
 1635            "Invalid direction specified for whisper");
 
 1641            response, 400, 
"Bad Request",
 
 1642            "Direction must be specified for at least spy or whisper");
 
 1646            response, 400, 
"Bad Request",
 
 1647            "Application name is required");
 
 1654            response, 404, 
"Channel Not Found",
 
 1655            "Provided channel was not found");
 
 1661    if (snoop == 
NULL) {
 
 1663            response, 500, 
"Internal error",
 
 1664            "Snoop channel could not be created");
 
 
 1739    .
type = 
"ARI Dialstring",
 
 
 1763    if (!datastore->
data) {
 
 
 1796    return datastore->
data;
 
 
 1809    char *dialdevice = 
NULL;
 
 1816    if (
args->variables) {
 
 1832            "Originator and formats can't both be specified");
 
 1838            "Endpoint must be specified");
 
 1842    chan_data = 
ast_calloc(1, 
sizeof(*chan_data));
 
 1861    if ((stuff = strchr(dialtech, 
'/'))) {
 
 1868            "Invalid endpoint specified");
 
 1898                        response, 400, 
"Bad Request",
 
 1899                        "Provided format (%s) was not found", format_name);
 
 1920    chan_data->
chan = 
ast_request(dialtech, request_cap, &assignedids, originator, dialdevice, &cause);
 
 1923    if (!chan_data->
chan) {
 
 1926                "Channel with given unique ID already exists");
 
 
 1973    if (control == 
NULL) {
 
 1985            "Callee not found");
 
 1992            "Channel is not in the 'Down' state");
 
 2012            "Dialing a channel not created by ARI");
 
 
 2067            "Channel not found");
 
 2076            "Channel's tech not found");
 
 2084            "Unsupported channel type");
 
 2092            "RTP info not found");
 
 2100            "Statistics not found");
 
 
 2119            args->external_host,
 
 2120            args->format) == -1) {
 
 
 2171        args->external_host, 
args->data) == -1) {
 
 
 2217            args->external_host,
 
 2218            args->format) == -1) {
 
 
 2262    char *external_host;
 
 2269    if (
args->variables) {
 
 2286        args->transport = 
"udp";
 
 2290        args->encapsulation = 
"rtp";
 
 2294            ast_ari_response_error(response, 400, 
"Bad Request", 
"encapsulation must be 'none' for websocket transport");
 
 2308            ast_ari_response_error(response, 400, 
"Bad Request", 
"transport must be 'tcp' for audiosocket encapsulation");
 
 2314        args->connection_type = 
"client";
 
 2318            ast_ari_response_error(response, 400, 
"Bad Request", 
"'server' connection_type can only be used with the websocket transport");
 
 2325            ast_ari_response_error(response, 400, 
"Bad Request", 
"external_host is required for all but websocket server connections");
 
 2329            args->external_host = 
"INCOMING";
 
 2339                ast_ari_response_error(response, 400, 
"Bad Request", 
"external_host must be a valid websocket_client connection id.");
 
 2346            ast_ari_response_error(response, 400, 
"Bad Request", 
"external_host must be <host>:<port> for all transports other than websocket");
 
 2357        args->direction = 
"both";
 
 2360    if (strcasecmp(
args->encapsulation, 
"rtp") == 0 && strcasecmp(
args->transport, 
"udp") == 0) {
 
 2363                response, 500, 
"Internal Server Error",
 
 2364                "An internal error prevented this request from being handled");
 
 2366    } 
else if (strcasecmp(
args->encapsulation, 
"audiosocket") == 0 && strcasecmp(
args->transport, 
"tcp") == 0) {
 
 2369                response, 500, 
"Internal Server Error",
 
 2370                "An internal error prevented this request from being handled");
 
 2372    } 
else if (strcasecmp(
args->encapsulation, 
"none") == 0 && strcasecmp(
args->transport, 
"websocket") == 0) {
 
 2375                response, 500, 
"Internal Server Error",
 
 2376                "An internal error prevented this request from being handled");
 
 2380            response, 501, 
"Not Implemented",
 
 2381            "The encapsulation and/or transport is not supported");
 
 
 2392    if (control == 
NULL) {
 
 2400            "Callee not found");
 
 2409    if (strcasecmp(
args->states, 
"channel_progress") == 0) {
 
 2411    } 
else if (strcasecmp(
args->states, 
"channel_answered") == 0) {
 
 2413    } 
else if (strcasecmp(
args->states, 
"channel_unavailable") == 0) {
 
 2415    } 
else if (strcasecmp(
args->states, 
"channel_declined") == 0) {
 
 
void ast_ari_response_created(struct ast_ari_response *response, const char *url, struct ast_json *message)
Fill in a Created (201) ast_ari_response.
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
void ast_ari_response_ok(struct ast_ari_response *response, struct ast_json *message)
Fill in an OK (200) ast_ari_response.
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
void ast_ari_response_no_content(struct ast_ari_response *response)
Fill in a No Content (204) ast_ari_response.
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_iterator_next(iter)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#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.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
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,...
int ast_is_shrinkable_phonenumber(const char *exten)
Check if a string consists only of digits and + # ( ) - . (meaning it can be cleaned with ast_shrink_...
#define AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED
Internal Asterisk hangup causes.
#define AST_CAUSE_CONGESTION
#define AST_CAUSE_UNALLOCATED
#define AST_CAUSE_INTERWORKING
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL
#define AST_CAUSE_INVALID_NUMBER_FORMAT
#define AST_CAUSE_FAILURE
#define AST_CAUSE_NO_USER_RESPONSE
#define AST_CAUSE_CALL_REJECTED
#define AST_CAUSE_ANSWERED_ELSEWHERE
#define AST_CAUSE_NORMAL_UNSPECIFIED
#define AST_CAUSE_NOANSWER
static char language[MAX_LANGUAGE]
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
const char * ast_channel_name(const struct ast_channel *chan)
#define AST_MAX_PUBLIC_UNIQUEID
enum ast_channel_error ast_channel_errno(void)
Get error code for latest channel operation.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
struct varshead * ast_channel_varshead(struct ast_channel *chan)
@ AST_CHANNEL_REQUESTOR_BRIDGE_PEER
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Set the connected line information in the Asterisk channel.
const char * ast_channel_musicclass(const struct ast_channel *chan)
#define ast_channel_lock(chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars)
adds a list of channel variables to a channel
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
@ AST_CHANNEL_ERROR_ID_EXISTS
#define ast_channel_ref(c)
Increase channel reference count.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
#define AST_MUTE_DIRECTION_READ
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.
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
struct ast_channel * ast_channel_get_by_name(const char *search)
Find a channel by name or uniqueid.
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
#define ast_channel_unref(c)
Decrease channel reference count.
const char * ast_channel_language(const struct ast_channel *chan)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
#define AST_MUTE_DIRECTION_WRITE
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation.
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
void ast_channel_priority_set(struct ast_channel *chan, int value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
#define ast_channel_cleanup(c)
Cleanup a channel reference.
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
struct ast_channel * ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel.
@ AST_SOFTHANGUP_EXPLICIT
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
void ast_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
Copy the source redirecting information to the destination redirecting.
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.
ast_channel_state
ast_channel states
Local proxy channel special access.
struct ast_channel * ast_local_get_peer(struct ast_channel *ast)
Get the other local channel in the pair.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
ast_dial_result
List of return codes for dial run API calls.
@ AST_DIAL_RESULT_ANSWERED
int ast_dial_append(struct ast_dial *dial, const char *tech, const char *device, const struct ast_assigned_ids *assignedids)
Append a channel.
struct ast_dial * ast_dial_create(void)
New dialing structure.
struct ast_channel * ast_dial_answered(struct ast_dial *dial)
Return channel that answered.
void ast_dial_set_user_data(struct ast_dial *dial, void *user_data)
Set user data on a dial structure.
int ast_dial_prerun(struct ast_dial *dial, struct ast_channel *chan, struct ast_format_cap *cap)
Request all appended channels, but do not dial.
void ast_dial_set_global_timeout(struct ast_dial *dial, int timeout)
Set the maximum time (globally) allowed for trying to ring phones.
enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async)
Execute dialing synchronously or asynchronously.
struct ast_channel * ast_dial_answered_steal(struct ast_dial *dial)
Steal the channel that answered.
void * ast_dial_get_user_data(struct ast_dial *dial)
Return the user data on a dial structure.
struct ast_channel * ast_dial_get_channel(struct ast_dial *dial, int num)
Get the dialing channel, if prerun has been executed.
int ast_dial_destroy(struct ast_dial *dial)
Destroys a dialing structure.
Generic File Format Support. Should be included by clients of the file handling routines....
struct ast_format * ast_get_format_for_file_ext(const char *file_ext)
Get the ast_format associated with the given file extension.
struct ao2_container * ast_channel_cache_all(void)
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object,...
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
@ AST_RECORD_IF_EXISTS_ERROR
Configuration File Parser.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
@ AST_TRANSFER_UNAVAILABLE
ast_frame_type
Frame types.
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
int ast_json_array_append(struct ast_json *array, struct ast_json *value)
Append to an array.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct ast_json * ast_json_array_create(void)
Create a empty JSON array.
struct ast_json * ast_json_ref(struct ast_json *value)
Increase refcount on value.
int ast_json_object_set(struct ast_json *object, const char *key, struct ast_json *value)
Set a field in a JSON object.
ast_json_to_ast_vars_code
@ AST_JSON_TO_AST_VARS_CODE_INVALID_TYPE
Conversion failed because invalid value type supplied.
@ AST_JSON_TO_AST_VARS_CODE_SUCCESS
Conversion successful.
@ AST_JSON_TO_AST_VARS_CODE_OOM
Conversion failed because of allocation failure. (Out Of Memory)
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
enum ast_json_to_ast_vars_code ast_json_to_ast_variables(struct ast_json *json_variables, struct ast_variable **variables)
Convert a ast_json list of key/value pair tuples into a ast_variable list.
struct ast_json * ast_json_channel_vars(struct varshead *channelvars)
Construct a JSON object from a ast_var_t list.
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
int ast_max_forwards_decrement(struct ast_channel *chan)
Decrement the max forwards count for a particular channel.
int ast_sockaddr_split_hostport(char *str, char **host, char **port, int flags)
Splits a string into its host and port components.
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.
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
int ast_func_read2(struct ast_channel *chan, const char *function, struct ast_str **str, ssize_t maxlen)
executes a read operation on a function
const char * ast_str_retrieve_variable(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, struct varshead *headp, const char *var)
struct ast_app * pbx_findapp(const char *app)
Look up an application.
static int save_dialstring(struct ast_channel *chan, const char *dialstring)
Save dialstring onto a channel datastore.
void ast_ari_channels_mute(struct ast_variable *headers, struct ast_ari_channels_mute_args *args, struct ast_ari_response *response)
Mute a channel.
void ast_ari_channels_snoop_channel_with_id(struct ast_variable *headers, struct ast_ari_channels_snoop_channel_with_id_args *args, struct ast_ari_response *response)
Start snooping.
void ast_ari_channels_continue_in_dialplan(struct ast_variable *headers, struct ast_ari_channels_continue_in_dialplan_args *args, struct ast_ari_response *response)
Exit application; continue execution in the dialplan.
void ast_ari_channels_start_moh(struct ast_variable *headers, struct ast_ari_channels_start_moh_args *args, struct ast_ari_response *response)
Play music on hold to a channel.
static int external_media_audiosocket_tcp(struct ast_ari_channels_external_media_args *args, struct ast_variable *variables, struct ast_ari_response *response)
static int channel_state_invalid(struct stasis_app_control *control, struct ast_ari_response *response)
Ensure channel is in a state that allows operation to be performed.
void ast_ari_channels_stop_moh(struct ast_variable *headers, struct ast_ari_channels_stop_moh_args *args, struct ast_ari_response *response)
Stop playing music on hold to a channel.
void ast_ari_channels_move(struct ast_variable *headers, struct ast_ari_channels_move_args *args, struct ast_ari_response *response)
Move the channel from one Stasis application to another.
static char * restore_dialstring(struct ast_channel *chan)
Retrieve the dialstring from the channel datastore.
void ast_ari_channels_send_dtmf(struct ast_variable *headers, struct ast_ari_channels_send_dtmf_args *args, struct ast_ari_response *response)
Send provided DTMF to a given channel.
void ast_ari_channels_unmute(struct ast_variable *headers, struct ast_ari_channels_unmute_args *args, struct ast_ari_response *response)
Unmute a channel.
void ast_ari_channels_dial(struct ast_variable *headers, struct ast_ari_channels_dial_args *args, struct ast_ari_response *response)
Dial a created channel.
static void * ari_originate_dial(void *data)
Thread which dials and executes upon answer.
void ast_ari_channels_create(struct ast_variable *headers, struct ast_ari_channels_create_args *args, struct ast_ari_response *response)
Create channel.
static int json_to_ast_variables(struct ast_ari_response *response, struct ast_json *json_variables, struct ast_variable **variables)
void ast_ari_channels_list(struct ast_variable *headers, struct ast_ari_channels_list_args *args, struct ast_ari_response *response)
List all active channels in Asterisk.
static void ari_channels_handle_snoop_channel(const char *args_channel_id, const char *args_spy, const char *args_whisper, const char *args_app, const char *args_app_args, const char *args_snoop_id, struct ast_ari_response *response)
void ast_ari_channels_get(struct ast_variable *headers, struct ast_ari_channels_get_args *args, struct ast_ari_response *response)
Channel details.
static void * ari_channel_thread(void *data)
Thread that owns stasis-created channel.
void ast_ari_channels_snoop_channel(struct ast_variable *headers, struct ast_ari_channels_snoop_channel_args *args, struct ast_ari_response *response)
Start snooping.
struct ast_datastore_info dialstring_info
void ast_ari_channels_transfer_progress(struct ast_variable *headers, struct ast_ari_channels_transfer_progress_args *args, struct ast_ari_response *response)
Inform the channel about the progress of the attended/blind transfer.
void ast_ari_channels_ring(struct ast_variable *headers, struct ast_ari_channels_ring_args *args, struct ast_ari_response *response)
Indicate ringing to a channel.
void ast_ari_channels_play(struct ast_variable *headers, struct ast_ari_channels_play_args *args, struct ast_ari_response *response)
Start playback of media.
void ast_ari_channels_stop_silence(struct ast_variable *headers, struct ast_ari_channels_stop_silence_args *args, struct ast_ari_response *response)
Stop playing silence to a channel.
void ast_ari_channels_external_media(struct ast_variable *headers, struct ast_ari_channels_external_media_args *args, struct ast_ari_response *response)
Start an External Media session.
static void ari_channels_handle_play(const char *args_channel_id, const char **args_media, size_t args_media_count, const char *args_lang, int args_offsetms, int args_skipms, const char *args_playback_id, struct ast_ari_response *response)
void ast_ari_channels_ring_stop(struct ast_variable *headers, struct ast_ari_channels_ring_stop_args *args, struct ast_ari_response *response)
Stop ringing indication on a channel if locally generated.
void ast_ari_channels_progress(struct ast_variable *headers, struct ast_ari_channels_progress_args *args, struct ast_ari_response *response)
Indicate progress on a channel.
void ast_ari_channels_start_silence(struct ast_variable *headers, struct ast_ari_channels_start_silence_args *args, struct ast_ari_response *response)
Play silence to a channel.
static struct ast_channel * ari_channels_handle_originate_with_id(const char *args_endpoint, const char *args_extension, const char *args_context, long args_priority, const char *args_label, const char *args_app, const char *args_app_args, const char *args_caller_id, int args_timeout, struct ast_variable *variables, const char *args_channel_id, const char *args_other_channel_id, const char *args_originator, const char *args_formats, struct ast_ari_response *response)
static int convert_reason_to_hangup_code(const char *reason)
Return the corresponded hangup code of the given reason.
void ast_ari_channels_unhold(struct ast_variable *headers, struct ast_ari_channels_unhold_args *args, struct ast_ari_response *response)
Remove a channel from hold.
void ast_ari_channels_originate(struct ast_variable *headers, struct ast_ari_channels_originate_args *args, struct ast_ari_response *response)
Create a new channel (originate).
void ast_ari_channels_redirect(struct ast_variable *headers, struct ast_ari_channels_redirect_args *args, struct ast_ari_response *response)
Redirect the channel to a different location.
static int external_media_websocket(struct ast_ari_channels_external_media_args *args, struct ast_variable *variables, struct ast_ari_response *response)
void ast_ari_channels_record(struct ast_variable *headers, struct ast_ari_channels_record_args *args, struct ast_ari_response *response)
Start a recording.
static void chan_data_destroy(struct ari_channel_thread_data *chan_data)
void ast_ari_channels_set_channel_var(struct ast_variable *headers, struct ast_ari_channels_set_channel_var_args *args, struct ast_ari_response *response)
Set the value of a channel variable or function.
static int external_media_rtp_udp(struct ast_ari_channels_external_media_args *args, struct ast_variable *variables, struct ast_ari_response *response)
void ast_ari_channels_hold(struct ast_variable *headers, struct ast_ari_channels_hold_args *args, struct ast_ari_response *response)
Hold a channel.
void ast_ari_channels_answer(struct ast_variable *headers, struct ast_ari_channels_answer_args *args, struct ast_ari_response *response)
Answer a channel.
void ast_ari_channels_play_with_id(struct ast_variable *headers, struct ast_ari_channels_play_with_id_args *args, struct ast_ari_response *response)
Start playback of media and specify the playbackId.
void ast_ari_channels_rtpstatistics(struct ast_variable *headers, struct ast_ari_channels_rtpstatistics_args *args, struct ast_ari_response *response)
RTP stats on a channel.
void ast_ari_channels_get_channel_var(struct ast_variable *headers, struct ast_ari_channels_get_channel_var_args *args, struct ast_ari_response *response)
Get the value of a channel variable or function.
static struct stasis_app_control * find_control(struct ast_ari_response *response, const char *channel_id)
Finds the control object for a channel, filling the response with an error, if appropriate.
void ast_ari_channels_originate_with_id(struct ast_variable *headers, struct ast_ari_channels_originate_with_id_args *args, struct ast_ari_response *response)
Create a new channel (originate with id).
void ast_ari_channels_hangup(struct ast_variable *headers, struct ast_ari_channels_hangup_args *args, struct ast_ari_response *response)
Delete (i.e. hangup) a channel.
Generated file - declares stubs to be implemented in res/ari/resource_channels.c.
int ast_ari_channels_originate_with_id_parse_body(struct ast_json *body, struct ast_ari_channels_originate_with_id_args *args)
Body parsing function for /channels/{channelId}.
int ast_ari_channels_create_parse_body(struct ast_json *body, struct ast_ari_channels_create_args *args)
Body parsing function for /channels/create.
int ast_ari_channels_external_media_parse_body(struct ast_json *body, struct ast_ari_channels_external_media_args *args)
Body parsing function for /channels/externalMedia.
int ast_ari_channels_originate_parse_body(struct ast_json *body, struct ast_ari_channels_originate_args *args)
Body parsing function for /channels.
Pluggable RTP Architecture.
struct ast_json * ast_rtp_instance_get_stats_all_json(struct ast_rtp_instance *instance)
Retrieve statistics about an RTP instance in json format.
struct ast_rtp_glue * ast_rtp_instance_get_glue(const char *type)
Get the RTP glue that binds a channel to the RTP engine.
Stasis Application API. See Stasis Application API for detailed documentation.
struct stasis_message_sanitizer * stasis_app_get_sanitizer(void)
Get the Stasis message sanitizer for app_stasis applications.
void stasis_app_control_moh_start(struct stasis_app_control *control, const char *moh_class)
Play music on hold to a channel (does not affect hold status)
int stasis_app_control_unmute(struct stasis_app_control *control, unsigned int direction, enum ast_frame_type frametype)
Unmute the channel associated with this control.
void stasis_app_control_unhold(struct stasis_app_control *control)
Remove the channel associated with the control from hold.
void stasis_app_control_silence_start(struct stasis_app_control *control)
Start playing silence to a channel.
void stasis_app_control_silence_stop(struct stasis_app_control *control)
Stop playing silence to a channel.
int stasis_app_control_continue(struct stasis_app_control *control, const char *context, const char *extension, int priority)
Exit res_stasis and continue execution in the dialplan.
int stasis_app_control_redirect(struct stasis_app_control *control, const char *endpoint)
Redirect a channel in res_stasis to a particular endpoint.
void stasis_app_control_moh_stop(struct stasis_app_control *control)
Stop playing music on hold to a channel (does not affect hold status)
int stasis_app_control_move(struct stasis_app_control *control, const char *app_name, const char *app_args)
Exit res_stasis and move to another Stasis application.
int stasis_app_control_mute(struct stasis_app_control *control, unsigned int direction, enum ast_frame_type frametype)
Mute the channel associated with this control.
enum stasis_app_subscribe_res stasis_app_subscribe_channel(const char *app_name, struct ast_channel *chan)
Directly subscribe an application to a channel.
int stasis_app_control_dtmf(struct stasis_app_control *control, const char *dtmf, int before, int between, unsigned int duration, int after)
Send DTMF to the channel associated with this control.
void stasis_app_control_hold(struct stasis_app_control *control)
Place the channel associated with the control on hold.
struct stasis_app_control * stasis_app_control_find_by_channel_id(const char *channel_id)
Returns the handler for the channel with the given id.
int stasis_app_control_ring_stop(struct stasis_app_control *control)
Stop locally generated ringing on the channel associated with this control.
int stasis_app_control_dial(struct stasis_app_control *control, const char *dialstring, unsigned int timeout)
Dial a channel.
struct ast_channel_snapshot * stasis_app_control_get_snapshot(const struct stasis_app_control *control)
Returns the most recent snapshot for the associated channel.
int stasis_app_control_set_channel_var(struct stasis_app_control *control, const char *variable, const char *value)
Set a variable on the channel associated with this control to value.
int stasis_app_control_ring(struct stasis_app_control *control)
Indicate ringing to the channel associated with this control.
int stasis_app_control_progress(struct stasis_app_control *control)
Indicate progress to the channel associated with this control.
int stasis_app_control_answer(struct stasis_app_control *control)
Answer the channel associated with this control.
Stasis Application Playback API. See StasisApplication API" for detailed documentation.
@ STASIS_PLAYBACK_TARGET_CHANNEL
struct stasis_app_playback * stasis_app_control_play_uri(struct stasis_app_control *control, const char **media, size_t media_count, const char *language, const char *target_id, enum stasis_app_playback_target_type target_type, int skipms, long offsetms, const char *id)
Play a file to the control's channel.
struct ast_json * stasis_app_playback_to_json(const struct stasis_app_playback *playback)
Convert a playback to its JSON representation.
const char * stasis_app_playback_get_id(struct stasis_app_playback *playback)
Gets the unique id of a playback object.
Stasis Application Recording API. See StasisApplication API" for detailed documentation.
struct stasis_app_recording_options * stasis_app_recording_options_create(const char *name, const char *format)
Allocate a recording options object.
struct ast_json * stasis_app_recording_to_json(const struct stasis_app_recording *recording)
Construct a JSON model of a recording.
struct stasis_app_recording * stasis_app_control_record(struct stasis_app_control *control, struct stasis_app_recording_options *options)
Record media from a channel.
enum ast_record_if_exists stasis_app_recording_if_exists_parse(const char *str)
Parse a string into the if_exists enum.
#define STASIS_APP_RECORDING_TERMINATE_INVALID
char stasis_app_recording_termination_parse(const char *str)
Parse a string into the recording termination enum.
Stasis Application Snoop API. See StasisApplication API" for detailed documentation.
struct ast_channel * stasis_app_control_snoop(struct ast_channel *chan, enum stasis_app_snoop_direction spy, enum stasis_app_snoop_direction whisper, const char *app, const char *app_args, const char *snoop_id)
Create a snoop on the provided channel.
stasis_app_snoop_direction
Directions for audio stream flow.
@ STASIS_SNOOP_DIRECTION_IN
Audio stream in from the channel.
@ STASIS_SNOOP_DIRECTION_OUT
Audio stream out to the channel.
@ STASIS_SNOOP_DIRECTION_NONE
No direction.
@ STASIS_SNOOP_DIRECTION_BOTH
Audio stream to AND from the channel.
struct ast_json * ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot, const struct stasis_message_sanitizer *sanitize)
Build a JSON object from a ast_channel_snapshot.
#define ast_string_field_build(x, field, fmt, args...)
Set a field to a complex (built) value.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
int ast_strings_equal(const char *str1, const char *str2)
Compare strings for equality checking for NULL.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
size_t attribute_pure ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
struct ast_str * stasis_stuff
struct ast_channel * chan
Structure used for origination.
char appdata[0]
Application data to pass to Stasis application.
char exten[AST_MAX_EXTENSION]
Dialplan extension.
char context[AST_MAX_CONTEXT]
Dialplan context.
int priority
Dialplan priority.
ast_app: A registered application
struct ast_json * message
Structure to pass both assignedid values to channel drivers.
Structure representing a snapshot of channel state.
enum ast_channel_state state
Structure to describe a channel "technology", ie a channel driver See for examples:
Main Channel structure associated with a channel.
struct ast_channel_snapshot * snapshot
Structure for a data store type.
Structure for a data store object.
Main dialing structure. Contains global options, channels being dialed, and more!
Abstract JSON element (object, array, string, int, ...).
Connected Line/Party information.
int transit_network_select
Transit Network Select.
enum ast_rtp_glue_result(* get_rtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance)
Callback for retrieving the RTP instance carrying audio.
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
Structure containing callbacks for Stasis message sanitization.
int(* channel_snapshot)(const struct ast_channel_snapshot *snapshot)
Callback which determines whether a channel should be sanitized from a message based on the channel's...
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
char * ast_uri_encode(const char *string, char *outbuf, int buflen, struct ast_flags spec)
Turn text string to URI-encoded XX version.
const struct ast_flags ast_uri_http
#define ast_pthread_create_detached(a, b, c, d)
#define ast_set_flag(p, flag)
struct ast_websocket_client * ast_websocket_client_retrieve_by_id(const char *id)
Retrieve a websocket client object by ID.