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;
210 exten =
S_OR(
args->extension, snapshot->dialplan->exten);
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",
237 }
else if (
args->priority) {
239 ipri =
args->priority;
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");
427 if (!strcmp(
args->direction,
"in")) {
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");
469 if (!strcmp(
args->direction,
"in")) {
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");
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;
763 if (
args->max_duration_seconds < 0) {
765 response, 400,
"Bad Request",
766 "max_duration_seconds cannot be negative");
770 if (
args->max_silence_seconds < 0) {
772 response, 400,
"Bad Request",
773 "max_silence_seconds cannot be negative");
778 if (control ==
NULL) {
786 response, 500,
"Internal Server Error",
790 options->max_silence_seconds =
args->max_silence_seconds;
791 options->max_duration_seconds =
args->max_duration_seconds;
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;
1083 char *cid_num =
NULL;
1084 char *cid_name =
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");
1312 connected.id.number.str = (
char *) cid_num;
1317 connected.id.name.str = (
char *) cid_name;
1383 "Only string values in the 'variables' object allowed");
1402 if (
args->variables) {
1425 args->other_channel_id,
1441 if (
args->variables) {
1464 args->other_channel_id,
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");
1517 if (
args->variable[strlen(
args->variable) - 1] ==
')') {
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;
1795 if (
args->variables) {
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");
2093 args->external_host,
2094 args->format) == -1) {
2136 size_t endpoint_len;
2146 endpoint_len = strlen(
"AudioSocket/") + strlen(
args->external_host) + 1 + strlen(
args->data) + 1;
2149 snprintf(endpoint, endpoint_len,
"AudioSocket/%s/%s",
args->external_host,
args->data);
2189 char *external_host;
2196 if (
args->variables) {
2229 args->encapsulation =
"rtp";
2232 args->transport =
"udp";
2235 args->connection_type =
"client";
2238 args->direction =
"both";
2241 if (strcasecmp(
args->encapsulation,
"rtp") == 0 && strcasecmp(
args->transport,
"udp") == 0) {
2244 response, 500,
"Internal Server Error",
2245 "An internal error prevented this request from being handled");
2247 }
else if (strcasecmp(
args->encapsulation,
"audiosocket") == 0 && strcasecmp(
args->transport,
"tcp") == 0) {
2251 response, 501,
"Not Implemented",
2252 "The encapsulation and/or transport is not supported");
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.
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#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_party_dialed * ast_channel_dialed(struct ast_channel *chan)
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
#define ast_channel_unref(c)
Decrease channel reference count.
@ AST_SOFTHANGUP_EXPLICIT
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
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
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.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
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.
#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
char * strsep(char **str, const char *delims)
Configuration File Parser.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
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 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_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_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 void external_media_audiosocket_tcp(struct ast_ari_channels_external_media_args *args, struct ast_variable *variables, 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.
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_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.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#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.
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 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)