55 if (!strcmp(reason,
"normal")) {
57 }
else if (!strcmp(reason,
"busy")) {
59 }
else if (!strcmp(reason,
"congestion")) {
61 }
else if (!strcmp(reason,
"no_answer")) {
63 }
else if (!strcmp(reason,
"timeout")) {
65 }
else if (!strcmp(reason,
"rejected")) {
67 }
else if (!strcmp(reason,
"unallocated")) {
69 }
else if (!strcmp(reason,
"normal_unspecified")) {
71 }
else if (!strcmp(reason,
"number_incomplete")) {
73 }
else if (!strcmp(reason,
"codec_mismatch")) {
75 }
else if (!strcmp(reason,
"interworking")) {
77 }
else if (!strcmp(reason,
"failure")) {
79 }
else if(!strcmp(reason,
"answered_elsewhere")) {
133 "Channel in invalid state");
154 const char *channel_id)
161 if (control ==
NULL) {
167 "Channel not found");
172 "Channel not in Stasis application");
194 if (control ==
NULL) {
209 context = snapshot->dialplan->context;
219 if (sscanf(args->
label,
"%30d", &ipri) != 1) {
227 ast_debug(3,
"Numeric value provided for label, jumping to that priority\n");
231 ast_log(
AST_LOG_ERROR,
"Invalid priority label '%s' specified for extension %s in context: %s\n",
232 args->
label, exten, context);
242 ipri = snapshot->dialplan->priority + 1;
269 "Failed to switch Stasis applications");
297 "Required parameter 'endpoint' not provided.");
302 if (!(resource = strchr(tech,
'/')) || !(tech_len = resource - tech)) {
304 "Endpoint parameter '%s' does not contain tech/resource", args->
endpoint);
311 "No resource provided in endpoint parameter '%s'", args->
endpoint);
316 if (!chan_snapshot) {
318 "Unable to find channel snapshot for '%s'", args->
channel_id);
322 if (strncasecmp(chan_snapshot->base->type, tech, tech_len)) {
324 "Endpoint technology '%s' does not match channel technology '%s'",
325 tech, chan_snapshot->base->type);
331 "Failed to redirect channel");
345 if (control ==
NULL) {
355 response, 500,
"Internal Server Error",
356 "Failed to answer channel");
370 if (control ==
NULL) {
390 if (control ==
NULL) {
412 if (control ==
NULL) {
422 response, 400,
"Bad Request",
423 "Direction is required");
429 }
else if (!strcmp(args->
direction,
"out")) {
431 }
else if (!strcmp(args->
direction,
"both")) {
435 response, 400,
"Bad Request",
436 "Invalid direction specified");
454 if (control ==
NULL) {
464 response, 400,
"Bad Request",
465 "Direction is required");
471 }
else if (!strcmp(args->
direction,
"out")) {
473 }
else if (!strcmp(args->
direction,
"both")) {
477 response, 400,
"Bad Request",
478 "Invalid direction specified");
494 if (control ==
NULL) {
504 response, 400,
"Bad Request",
521 if (control ==
NULL) {
542 if (control ==
NULL) {
563 if (control ==
NULL) {
583 if (control ==
NULL) {
603 if (control ==
NULL) {
623 if (control ==
NULL) {
637 const char *args_channel_id,
638 const char **args_media,
639 size_t args_media_count,
640 const char *args_lang,
643 const char *args_playback_id,
656 if (control ==
NULL) {
668 response, 404,
"Not Found",
669 "Channel not found");
673 if (args_skipms < 0) {
675 response, 400,
"Bad Request",
676 "skipms cannot be negative");
680 if (args_offsetms < 0) {
682 response, 400,
"Bad Request",
683 "offsetms cannot be negative");
687 language =
S_OR(args_lang, snapshot->base->language);
693 response, 500,
"Internal Server Error",
694 "Failed to queue media for playback");
702 response, 500,
"Internal Server Error",
710 response, 500,
"Internal Server Error",
759 size_t uri_name_maxlen;
765 response, 400,
"Bad Request",
766 "max_duration_seconds cannot be negative");
772 response, 400,
"Bad Request",
773 "max_silence_seconds cannot be negative");
778 if (control ==
NULL) {
786 response, 500,
"Internal Server Error",
800 response, 400,
"Bad Request",
801 "terminateOn invalid");
807 response, 400,
"Bad Request",
814 response, 422,
"Unprocessable Entity",
815 "specified format is unknown on this system");
820 if (recording ==
NULL) {
827 response, 500,
"Internal Server Error",
828 "Error parsing request");
832 "Recording '%s' already exists and can not be overwritten",
837 response, 500,
"Internal Server Error",
842 response, 400,
"Bad Request",
843 "Recording name invalid");
847 "Unrecognized recording error: %s\n",
850 response, 500,
"Internal Server Error",
851 "Internal Server Error");
857 uri_name_maxlen = strlen(args->
name) * 3;
858 uri_encoded_name =
ast_malloc(uri_name_maxlen);
859 if (!uri_encoded_name) {
861 response, 500,
"Internal Server Error",
869 uri_encoded_name) == -1) {
870 recording_url =
NULL;
872 response, 500,
"Internal Server Error",
880 response, 500,
"Internal Server Error",
897 response, 404,
"Not Found",
898 "Channel not found");
917 response, 404,
"Not Found",
918 "Channel not found");
924 "The reason and reason_code can't both be specified");
930 if (sscanf(args->
reason_code,
"%30d", &cause) != 1) {
932 response, 400,
"Invalid Reason Code",
933 "Invalid reason for hangup reason code provided");
941 response, 400,
"Invalid Reason",
942 "Invalid reason for hangup reason provided");
1064 const char *args_extension,
1065 const char *args_context,
1067 const char *args_label,
1068 const char *args_app,
1069 const char *args_app_args,
1070 const char *args_caller_id,
1073 const char *args_channel_id,
1074 const char *args_other_channel_id,
1075 const char *args_originator,
1076 const char *args_formats,
1080 char *dialdevice =
NULL;
1082 char *caller_id =
NULL;
1091 .uniqueid2 = args_other_channel_id,
1106 "Endpoint must be specified");
1112 "Originator and formats can't both be specified");
1117 if ((stuff = strchr(dialtech,
'/'))) {
1124 "Invalid endpoint specified");
1149 origination =
ast_calloc(1,
sizeof(*origination) + 1);
1161 if (sscanf(args_label,
"%30d", &ipri) != 1) {
1165 ast_log(
AST_LOG_ERROR,
"Requested label: %s can not be found in context: %s\n", args_label, args_context);
1170 ast_debug(3,
"Numeric value provided for label, jumping to that priority\n");
1174 ast_log(
AST_LOG_ERROR,
"Invalid priority label '%s' specified for extension %s in context: %s\n",
1175 args_label, args_extension, args_context);
1184 origination->
priority = args_priority ? args_priority : 1;
1187 origination->
appdata[0] =
'\0';
1190 "Application or extension must be specified");
1209 if (args_timeout > 0) {
1211 }
else if (args_timeout == -1) {
1230 response, 400,
"Bad Request",
1231 "Provided originator channel was not found");
1256 response, 400,
"Bad Request",
1257 "Provided format (%s) was not found", format_name);
1275 "Channel with given unique ID already exists");
1317 connected.
id.
name.
str = (
char *) cid_name;
1383 "Only string values in the 'variables' object allowed");
1490 response, 400,
"Bad Request",
1491 "Variable name is required");
1497 response, 400,
"Bad Request",
1498 "Channel ID is required");
1505 response, 404,
"Channel Not Found",
1506 "Provided channel was not found");
1520 response, 500,
"Error With Function",
1521 "Unable to read provided function");
1527 response, 404,
"Variable Not Found",
1528 "Provided variable was not found");
1551 response, 400,
"Bad Request",
1552 "Variable name is required");
1557 if (control ==
NULL) {
1564 response, 400,
"Bad Request",
1565 "Failed to execute function");
1573 const char *args_channel_id,
1574 const char *args_spy,
1575 const char *args_whisper,
1576 const char *args_app,
1577 const char *args_app_args,
1578 const char *args_snoop_id,
1590 }
else if (!strcmp(args_spy,
"both")) {
1592 }
else if (!strcmp(args_spy,
"out")) {
1594 }
else if (!strcmp(args_spy,
"in")) {
1598 response, 400,
"Bad Request",
1599 "Invalid direction specified for spy");
1605 }
else if (!strcmp(args_whisper,
"both")) {
1607 }
else if (!strcmp(args_whisper,
"out")) {
1609 }
else if (!strcmp(args_whisper,
"in")) {
1613 response, 400,
"Bad Request",
1614 "Invalid direction specified for whisper");
1620 response, 400,
"Bad Request",
1621 "Direction must be specified for at least spy or whisper");
1625 response, 400,
"Bad Request",
1626 "Application name is required");
1633 response, 404,
"Channel Not Found",
1634 "Provided channel was not found");
1640 if (snoop ==
NULL) {
1642 response, 500,
"Internal error",
1643 "Snoop channel could not be created");
1718 .
type =
"ARI Dialstring",
1742 if (!datastore->
data) {
1775 return datastore->
data;
1788 char *dialdevice =
NULL;
1811 "Originator and formats can't both be specified");
1817 "Endpoint must be specified");
1821 chan_data =
ast_calloc(1,
sizeof(*chan_data));
1840 if ((stuff = strchr(dialtech,
'/'))) {
1847 "Invalid endpoint specified");
1874 response, 400,
"Bad Request",
1875 "Provided format (%s) was not found", format_name);
1896 chan_data->
chan =
ast_request(dialtech, request_cap, &assignedids, originator, dialdevice, &cause);
1899 if (!chan_data->
chan) {
1902 "Channel with given unique ID already exists");
1949 if (control ==
NULL) {
1959 "Callee not found");
1966 "Channel is not in the 'Down' state");
1986 "Dialing a channel not created by ARI");
2041 "Channel not found");
2050 "Channel's tech not found");
2058 "Unsupported channel type");
2066 "RTP info not found");
2074 "Statistics not found");
2088 size_t endpoint_len;
2093 endpoint_len = strlen(
"UnicastRTP/") + strlen(args->
external_host) + 1;
2095 snprintf(endpoint, endpoint_len,
"UnicastRTP/%s", args->
external_host);
2132 size_t endpoint_len;
2137 endpoint_len = strlen(
"AudioSocket/") + strlen(args->
external_host) + 1 + strlen(args->
data) + 1;
2140 snprintf(endpoint, endpoint_len,
"AudioSocket/%s/%s", args->
external_host, args->
data);
2180 char *external_host;
2233 }
else if (strcasecmp(args->
encapsulation,
"audiosocket") == 0 && strcasecmp(args->
transport,
"tcp") == 0) {
2237 response, 501,
"Not Implemented",
2238 "The encapsulation and/or transport is not supported");
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
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.
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.
int presentation
Q.931 encoded presentation-indicator encoded field.
Stasis Application Recording API. See StasisApplication API" for detailed documentation.
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
#define ast_channel_lock(chan)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
Local proxy channel special access.
stasis_app_snoop_direction
Directions for audio stream flow.
char * str
Subscriber phone number (Malloced)
struct ast_json * ast_json_ref(struct ast_json *value)
Increase refcount on value.
int ast_dial_destroy(struct ast_dial *dial)
Destroys a dialing structure.
Structure used for origination.
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.
Asterisk main include file. File version handling, generic pbx functions.
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.
void * ast_dial_get_user_data(struct ast_dial *dial)
Return the user data on a dial structure.
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.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
Main dialing structure. Contains global options, channels being dialed, and more! ...
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
static void external_media_rtp_udp(struct ast_ari_channels_external_media_args *args, struct ast_variable *variables, struct ast_ari_response *response)
#define ast_pthread_create_detached(a, b, c, d)
struct ast_party_id id
Connected party ID.
void ast_dial_set_global_timeout(struct ast_dial *dial, int timeout)
Set the maximum time (globally) allowed for trying to ring phones.
#define ast_channel_unref(c)
Decrease channel reference count.
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...
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...
struct ast_json * 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.
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_party_name name
Subscriber name.
Audio stream in from the channel.
#define AST_CAUSE_UNALLOCATED
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
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
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.
#define ast_set_flag(p, flag)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
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).
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)
const char * other_channel_id
int ast_ari_channels_create_parse_body(struct ast_json *body, struct ast_ari_channels_create_args *args)
Body parsing function for /channels/create.
Structure for variables, used for configurations and for channel variables.
char * ast_uri_encode(const char *string, char *outbuf, int buflen, struct ast_flags spec)
Turn text string to URI-encoded XX version.
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.
Structure representing a snapshot of channel state.
void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars)
adds a list of channel variables to a channel
void ast_ari_channels_get(struct ast_variable *headers, struct ast_ari_channels_get_args *args, struct ast_ari_response *response)
Channel details.
int stasis_app_control_ring_stop(struct stasis_app_control *control)
Stop locally generated ringing on the channel associated with this control.
Structure to pass both assignedid values to channel drivers.
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_hold(struct stasis_app_control *control)
Place the channel associated with the control on hold.
void stasis_app_control_silence_stop(struct stasis_app_control *control)
Stop playing silence to a channel.
Structure for a data store type.
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.
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.
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)
ast_channel_state
ast_channel states
char * str
Subscriber name (Malloced)
struct ast_json * stasis_app_playback_to_json(const struct stasis_app_playback *playback)
Convert a playback to its JSON representation.
int priority
Dialplan priority.
static void * ari_channel_thread(void *data)
Thread that owns stasis-created channel.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
const char * other_channel_id
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
void ast_ari_channels_record(struct ast_variable *headers, struct ast_ari_channels_record_args *args, struct ast_ari_response *response)
Start a recording.
Generated file - declares stubs to be implemented in res/ari/resource_channels.c. ...
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
static int convert_reason_to_hangup_code(const char *reason)
Return the corresponded hangup code of the given reason.
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.
Audio stream to AND from the channel.
struct varshead * ast_channel_varshead(struct ast_channel *chan)
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
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.
char stasis_app_recording_termination_parse(const char *str)
Parse a string into the recording termination enum.
struct ast_json * variables
#define AST_CAUSE_NO_USER_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.
#define AST_CAUSE_INVALID_NUMBER_FORMAT
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_...
struct ast_datastore_info dialstring_info
#define AST_MUTE_DIRECTION_WRITE
#define AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED
void ast_free_ptr(void *ptr)
free() wrapper
static char cid_num[AST_MAX_EXTENSION]
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
#define ast_verb(level,...)
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.
Structure containing callbacks for Stasis message sanitization.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
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.
static char * restore_dialstring(struct ast_channel *chan)
Retrieve the dialstring from the channel datastore.
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_asprintf(ret, fmt,...)
A wrapper for asprintf()
struct ast_channel * ast_local_get_peer(struct ast_channel *ast)
Get the other local channel in the pair.
#define ast_strlen_zero(foo)
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.
static int json_to_ast_variables(struct ast_ari_response *response, struct ast_json *json_variables, struct ast_variable **variables)
void ast_dial_set_user_data(struct ast_dial *dial, void *user_data)
Set user data on a dial structure.
Conversion failed because invalid value type supplied.
struct ast_json * ast_json_channel_vars(struct varshead *channelvars)
Construct a JSON object from a ast_var_t list.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
void ast_ari_channels_unmute(struct ast_variable *headers, struct ast_ari_channels_unmute_args *args, struct ast_ari_response *response)
Unmute a channel.
const char * stasis_app_playback_get_id(struct stasis_app_playback *playback)
Gets the unique id of a playback object.
struct ast_json * stasis_app_recording_to_json(const struct stasis_app_recording *recording)
Construct a JSON model of a recording.
Configuration File Parser.
char exten[AST_MAX_EXTENSION]
Dialplan extension.
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
const char * other_channel_id
#define ast_debug(level,...)
Log a DEBUG message.
int ast_ari_channels_originate_parse_body(struct ast_json *body, struct ast_ari_channels_originate_args *args)
Body parsing function for /channels.
void ast_ari_channels_create(struct ast_variable *headers, struct ast_ari_channels_create_args *args, struct ast_ari_response *response)
Create channel.
ast_dial_result
List of return codes for dial run API calls.
int ast_sockaddr_split_hostport(char *str, char **host, char **port, int flags)
Splits a string into its host and port components.
#define STASIS_APP_RECORDING_TERMINATE_INVALID
#define AST_MUTE_DIRECTION_READ
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.
static int save_dialstring(struct ast_channel *chan, const char *dialstring)
Save dialstring onto a channel datastore.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
void ast_ari_channels_answer(struct ast_variable *headers, struct ast_ari_channels_answer_args *args, struct ast_ari_response *response)
Answer a channel.
#define AST_CAUSE_ANSWERED_ELSEWHERE
#define AST_MAX_EXTENSION
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
void ast_ari_response_ok(struct ast_ari_response *response, struct ast_json *message)
Fill in an OK (200) ast_ari_response.
#define ast_channel_cleanup(c)
Cleanup a channel reference.
#define ao2_ref(o, delta)
int stasis_app_control_dial(struct stasis_app_control *control, const char *dialstring, unsigned int timeout)
Dial a channel.
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
Audio stream out to the channel.
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.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define AST_CAUSE_NOANSWER
static char language[MAX_LANGUAGE]
#define ast_malloc(len)
A wrapper for malloc()
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_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_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().
Structure to describe a channel "technology", ie a channel driver See for examples: ...
char context[AST_MAX_CONTEXT]
Dialplan context.
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
struct ao2_container * ast_channel_cache_all(void)
Core PBX routines and definitions.
struct ast_json * ast_json_array_create(void)
Create a empty JSON array.
enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async)
Execute dialing synchronously or asynchronously.
int ast_json_array_append(struct ast_json *array, struct ast_json *value)
Append to an array.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
const char * ast_channel_uniqueid(const struct ast_channel *chan)
ast_frame_type
Frame types.
struct ast_channel * chan
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.
#define AST_CAUSE_FAILURE
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
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}.
struct ast_str * stasis_stuff
struct stasis_message_sanitizer * stasis_app_get_sanitizer(void)
Get the Stasis message sanitizer for app_stasis applications.
struct ast_json * variables
enum ast_record_if_exists stasis_app_recording_if_exists_parse(const char *str)
Parse a string into the if_exists enum.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int stasis_app_control_ring(struct stasis_app_control *control)
Indicate ringing to the channel associated with this control.
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.
#define AST_CAUSE_NORMAL_UNSPECIFIED
int stasis_app_control_redirect(struct stasis_app_control *control, const char *endpoint)
Redirect a channel in res_stasis to a particular endpoint.
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.
Connected Line/Party information.
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_party_dialed * ast_channel_dialed(struct ast_channel *chan)
#define ao2_iterator_next(iter)
struct ast_channel_snapshot * stasis_app_control_get_snapshot(const struct stasis_app_control *control)
Returns the most recent snapshot for the associated channel.
struct ast_channel * ast_dial_answered(struct ast_dial *dial)
Return channel that answered.
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.
char appdata[0]
Application data to pass to Stasis application.
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.
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.
Conversion failed because of allocation failure. (Out Of Memory)
#define ast_channel_unlock(chan)
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.
void stasis_app_control_unhold(struct stasis_app_control *control)
Remove the channel associated with the control from hold.
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
#define ast_calloc(num, len)
A wrapper for calloc()
struct ast_dial * ast_dial_create(void)
New dialing structure.
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.
struct ast_channel * ast_dial_get_channel(struct ast_dial *dial, int num)
Get the dialing channel, if prerun has been executed.
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).
enum stasis_app_subscribe_res stasis_app_subscribe_channel(const char *app_name, struct ast_channel *chan)
Directly subscribe an application to a channel.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
struct stasis_app_recording_options * stasis_app_recording_options_create(const char *name, const char *format)
Allocate a recording options object.
void ast_ari_response_no_content(struct ast_ari_response *response)
Fill in a No Content (204) ast_ari_response.
enum ast_channel_state state
struct ast_format * ast_get_format_for_file_ext(const char *file_ext)
Get the ast_format associated with the given file extension.
#define AST_CAUSE_INTERWORKING
#define ast_string_field_build(x, field, fmt, args...)
Set a field to a complex (built) value.
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.
struct ast_json * message
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.
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
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.
static char cid_name[AST_MAX_EXTENSION]
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
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.
struct ast_channel * ast_dial_answered_steal(struct ast_dial *dial)
Steal the channel that answered.
void ast_ari_channels_mute(struct ast_variable *headers, struct ast_ari_channels_mute_args *args, struct ast_ari_response *response)
Mute a channel.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
int transit_network_select
Transit Network Select.
#define AST_MAX_PUBLIC_UNIQUEID
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.
Stasis Application Playback API. See StasisApplication API" for detailed documentation.
char * strsep(char **str, const char *delims)
int ast_max_forwards_decrement(struct ast_channel *chan)
Decrement the max forwards count for a particular channel.
const char * ast_str_retrieve_variable(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, struct varshead *headp, const char *var)
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.
#define ast_channel_ref(c)
Increase channel reference count.
static void * ari_originate_dial(void *data)
Thread which dials and executes upon answer.
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...
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_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 S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
ast_app: A registered application
const char * ast_channel_name(const struct ast_channel *chan)
Stasis Application Snoop API. See StasisApplication API" for detailed documentation.
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)
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.
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
int stasis_app_control_answer(struct stasis_app_control *control)
Answer the channel associated with this control.
static void chan_data_destroy(struct ari_channel_thread_data *chan_data)
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
Internal Asterisk hangup causes.
const char * ast_channel_language(const struct ast_channel *chan)
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.
Abstract JSON element (object, array, string, int, ...).
void stasis_app_control_silence_start(struct stasis_app_control *control)
Start playing silence to a 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.
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.
const struct ast_flags ast_uri_http
#define ast_datastore_alloc(info, uid)
Stasis Application API. See Stasis Application API for detailed documentation.
unsigned char valid
TRUE if the name information is valid/present.
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.
static char context[AST_MAX_CONTEXT]
static void external_media_audiosocket_tcp(struct ast_ari_channels_external_media_args *args, struct ast_variable *variables, struct ast_ari_response *response)
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
enum ast_channel_error ast_channel_errno(void)
Get error code for latest channel operation.
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 stasis_app_control_moh_stop(struct stasis_app_control *control)
Stop playing music on hold to a channel (does not affect hold status)
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
struct ast_app * pbx_findapp(const char *app)
Look up an application.
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.
#define AST_CAUSE_CALL_REJECTED
struct ast_rtp_glue * ast_rtp_instance_get_glue(const char *type)
Get the RTP glue that binds a channel to the RTP engine.
void ast_channel_priority_set(struct ast_channel *chan, int value)
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Pluggable RTP Architecture.
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL
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 ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
ast_json_to_ast_vars_code
unsigned char valid
TRUE if the number information is valid/present.
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
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.
#define AST_CAUSE_CONGESTION
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_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
Copy the source redirecting information to the destination redirecting.
struct stasis_app_recording * stasis_app_control_record(struct stasis_app_control *control, struct stasis_app_recording_options *options)
Record media from a channel.
const char * ast_channel_musicclass(const struct ast_channel *chan)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
const char * terminate_on
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
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_party_number number
Subscriber phone number.
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.