Asterisk - The Open Source Telephony Project GIT-master-d856a3e
|
Implementation for ARI stubs. More...
#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/pbx.h"
#include "asterisk/bridge.h"
#include "asterisk/callerid.h"
#include "asterisk/stasis_app.h"
#include "asterisk/stasis_app_playback.h"
#include "asterisk/stasis_app_recording.h"
#include "asterisk/stasis_app_snoop.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/causes.h"
#include "asterisk/format_cache.h"
#include "asterisk/core_local.h"
#include "asterisk/dial.h"
#include "asterisk/max_forwards.h"
#include "asterisk/rtp_engine.h"
#include "resource_channels.h"
#include <limits.h>
#include "asterisk/config.h"
#include "asterisk/netsock2.h"
Go to the source code of this file.
Data Structures | |
struct | ari_channel_thread_data |
struct | ari_origination |
Structure used for origination. More... | |
Functions | |
static void * | ari_channel_thread (void *data) |
Thread that owns stasis-created channel. More... | |
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 | 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) |
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) |
static void * | ari_originate_dial (void *data) |
Thread which dials and executes upon answer. More... | |
void | ast_ari_channels_answer (struct ast_variable *headers, struct ast_ari_channels_answer_args *args, struct ast_ari_response *response) |
Answer a channel. More... | |
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. More... | |
void | ast_ari_channels_create (struct ast_variable *headers, struct ast_ari_channels_create_args *args, struct ast_ari_response *response) |
Create channel. More... | |
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. More... | |
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. More... | |
void | ast_ari_channels_get (struct ast_variable *headers, struct ast_ari_channels_get_args *args, struct ast_ari_response *response) |
Channel details. More... | |
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. More... | |
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. More... | |
void | ast_ari_channels_hold (struct ast_variable *headers, struct ast_ari_channels_hold_args *args, struct ast_ari_response *response) |
Hold a channel. More... | |
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. More... | |
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. More... | |
void | ast_ari_channels_mute (struct ast_variable *headers, struct ast_ari_channels_mute_args *args, struct ast_ari_response *response) |
Mute a channel. More... | |
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). More... | |
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). More... | |
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. More... | |
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. More... | |
void | ast_ari_channels_record (struct ast_variable *headers, struct ast_ari_channels_record_args *args, struct ast_ari_response *response) |
Start a recording. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | ast_ari_channels_unmute (struct ast_variable *headers, struct ast_ari_channels_unmute_args *args, struct ast_ari_response *response) |
Unmute a channel. More... | |
static void | chan_data_destroy (struct ari_channel_thread_data *chan_data) |
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. More... | |
static int | convert_reason_to_hangup_code (const char *reason) |
Return the corresponded hangup code of the given reason. More... | |
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 | external_media_rtp_udp (struct ast_ari_channels_external_media_args *args, struct ast_variable *variables, struct ast_ari_response *response) |
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. More... | |
static int | json_to_ast_variables (struct ast_ari_response *response, struct ast_json *json_variables, struct ast_variable **variables) |
static char * | restore_dialstring (struct ast_channel *chan) |
Retrieve the dialstring from the channel datastore. More... | |
static int | save_dialstring (struct ast_channel *chan, const char *dialstring) |
Save dialstring onto a channel datastore. More... | |
Variables | |
struct ast_datastore_info | dialstring_info |
Implementation for ARI stubs.
Definition in file resource_channels.c.
|
static |
Thread that owns stasis-created channel.
The channel enters into a Stasis application immediately upon creation. In this way, the channel can be manipulated by the Stasis application. Once the channel exits the Stasis application, it is hung up.
Definition at line 1698 of file resource_channels.c.
References ast_log, ast_str_buffer(), ari_channel_thread_data::chan, chan_data_destroy(), LOG_ERROR, NULL, pbx_exec(), pbx_findapp(), and ari_channel_thread_data::stasis_stuff.
Referenced by ast_ari_channels_create().
|
static |
Definition at line 1063 of file resource_channels.c.
References ao2_cleanup, ao2_ref, ari_origination::appdata, ari_originate_dial(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_response_ok(), ast_callerid_parse(), ast_calloc, ast_channel_cleanup, ast_channel_connected(), ast_channel_errno(), AST_CHANNEL_ERROR_ID_EXISTS, ast_channel_flags(), ast_channel_get_by_name(), ast_channel_lock, ast_channel_ref, ast_channel_set_connected_line(), ast_channel_snapshot_get_latest(), ast_channel_snapshot_to_json(), ast_channel_uniqueid(), ast_channel_unlock, ast_channel_unref, ast_copy_string(), ast_debug, ast_dial_append(), ast_dial_create(), ast_dial_destroy(), ast_dial_get_channel(), ast_dial_prerun(), ast_dial_set_global_timeout(), ast_dial_set_user_data(), ast_findlabel_extension(), AST_FLAG_ORIGINATED, ast_format_cache_get, ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_free, ast_is_shrinkable_phonenumber(), ast_local_get_peer(), ast_log, AST_LOG_ERROR, AST_MAX_PUBLIC_UNIQUEID, ast_party_connected_line_set_init(), AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED, ast_pthread_create_detached, ast_set_callerid(), ast_set_flag, ast_set_variables(), ast_shrink_phone_number(), ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_str_size(), ast_strdupa, ast_strip(), ast_strlen_zero(), connected, ari_origination::context, ari_origination::exten, NULL, ari_origination::priority, RAII_VAR, S_OR, ast_channel::snapshot, stasis_app_subscribe_channel(), strsep(), thread, ast_assigned_ids::uniqueid, and ast_assigned_ids::uniqueid2.
Referenced by ast_ari_channels_originate(), ast_ari_channels_originate_with_id(), external_media_audiosocket_tcp(), and external_media_rtp_udp().
|
static |
Definition at line 636 of file resource_channels.c.
References ao2_cleanup, ast_ari_response_created(), ast_ari_response_error(), ast_asprintf, ast_assert, ast_free, channel_state_invalid(), find_control(), language, NULL, RAII_VAR, S_OR, stasis_app_control_get_snapshot(), stasis_app_control_play_uri(), stasis_app_playback_get_id(), stasis_app_playback_to_json(), and STASIS_PLAYBACK_TARGET_CHANNEL.
Referenced by ast_ari_channels_play(), and ast_ari_channels_play_with_id().
|
static |
Definition at line 1572 of file resource_channels.c.
References ao2_cleanup, ast_ari_response_error(), ast_ari_response_ok(), ast_assert, ast_channel_cleanup, ast_channel_get_by_name(), ast_channel_snapshot_get_latest(), ast_channel_snapshot_to_json(), ast_channel_uniqueid(), ast_strlen_zero(), NULL, RAII_VAR, stasis_app_control_snoop(), STASIS_SNOOP_DIRECTION_BOTH, STASIS_SNOOP_DIRECTION_IN, STASIS_SNOOP_DIRECTION_NONE, and STASIS_SNOOP_DIRECTION_OUT.
Referenced by ast_ari_channels_snoop_channel(), and ast_ari_channels_snoop_channel_with_id().
|
static |
Thread which dials and executes upon answer.
Definition at line 1013 of file resource_channels.c.
References app, ari_origination::appdata, ast_channel_context_set(), ast_channel_exten_set(), ast_channel_name(), ast_channel_priority_set(), ast_dial_answered(), ast_dial_answered_steal(), ast_dial_destroy(), ast_dial_get_user_data(), AST_DIAL_RESULT_ANSWERED, ast_dial_run(), ast_free, ast_log, ast_pbx_run(), ast_strlen_zero(), ast_verb, ari_origination::context, end, ari_origination::exten, LOG_ERROR, LOG_WARNING, NULL, pbx_exec(), pbx_findapp(), and ari_origination::priority.
Referenced by ari_channels_handle_originate_with_id().
void ast_ari_channels_answer | ( | struct ast_variable * | headers, |
struct ast_ari_channels_answer_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Answer a channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 338 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_answer().
Referenced by ast_ari_channels_answer_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 180 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, ast_debug, ast_findlabel_extension(), ast_log, AST_LOG_ERROR, ast_strlen_zero(), channel_state_invalid(), voicemailpwcheck::context, find_control(), NULL, RAII_VAR, S_OR, stasis_app_control_continue(), and stasis_app_control_get_snapshot().
Referenced by ast_ari_channels_continue_in_dialplan_cb().
void ast_ari_channels_create | ( | struct ast_variable * | headers, |
struct ast_ari_channels_create_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Create channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 1778 of file resource_channels.c.
References ao2_bump, ao2_cleanup, ao2_ref, args, ari_channel_thread(), ast_ari_channels_create_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_response_ok(), ast_calloc, ast_channel_cleanup, ast_channel_errno(), AST_CHANNEL_ERROR_ID_EXISTS, ast_channel_get_by_name(), ast_channel_nativeformats(), ast_channel_snapshot_get_latest(), ast_channel_snapshot_to_json(), ast_channel_uniqueid(), ast_format_cache_get, ast_format_cap_alloc, ast_format_cap_append, ast_format_cap_append_by_type(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_json_object_get(), AST_MEDIA_TYPE_AUDIO, ast_pthread_create_detached, ast_request(), ast_set_variables(), ast_str_append(), ast_str_create, ast_strdupa, ast_strip(), ast_strlen_zero(), ast_variables_destroy(), ari_channel_thread_data::chan, chan_data_destroy(), json_to_ast_variables(), NULL, RAII_VAR, save_dialstring(), stasis_app_subscribe_channel(), ari_channel_thread_data::stasis_stuff, strsep(), thread, ast_assigned_ids::uniqueid, and ast_assigned_ids::uniqueid2.
Referenced by ast_ari_channels_create_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 1939 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_response_no_content(), ast_channel_adsicpe_set(), ast_channel_caller(), ast_channel_cleanup, ast_channel_connected(), ast_channel_datastore_inherit(), ast_channel_dialed(), ast_channel_get_by_name(), ast_channel_inherit_variables(), ast_channel_language(), ast_channel_lock, ast_channel_lock_both, ast_channel_musicclass(), ast_channel_redirecting(), ast_channel_req_accountcodes(), AST_CHANNEL_REQUESTOR_BRIDGE_PEER, ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_channel_transfercapability(), ast_channel_transfercapability_set(), ast_channel_unlock, ast_connected_line_copy_from_caller(), ast_max_forwards_decrement(), ast_party_redirecting_copy(), AST_STATE_DOWN, AST_STATE_RESERVED, ast_strdupa, ast_strlen_zero(), find_control(), NULL, RAII_VAR, restore_dialstring(), stasis_app_control_dial(), and ast_party_dialed::transit_network_select.
Referenced by ast_ari_channels_dial_cb().
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.
Create a channel to an External Media source/sink.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 2185 of file resource_channels.c.
References args, ast_ari_channels_external_media_parse_body(), ast_ari_response_error(), ast_assert, ast_json_object_get(), ast_sockaddr_split_hostport(), ast_strdupa, ast_strlen_zero(), external_media_audiosocket_tcp(), external_media_rtp_udp(), json_to_ast_variables(), NULL, and PARSE_PORT_REQUIRE.
Referenced by ast_ari_channels_external_media_cb().
void ast_ari_channels_get | ( | struct ast_variable * | headers, |
struct ast_ari_channels_get_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Channel details.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 888 of file resource_channels.c.
References ao2_ref, args, ast_ari_response_error(), ast_ari_response_ok(), ast_channel_snapshot_get_latest(), ast_channel_snapshot_to_json(), and NULL.
Referenced by ast_ari_channels_get_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 1472 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_response_ok(), ast_assert, ast_channel_cleanup, ast_channel_get_by_name(), ast_free, ast_func_read2(), ast_json_pack(), ast_json_ref(), ast_json_unref(), ast_str_buffer(), ast_str_create, ast_str_retrieve_variable(), ast_strlen_zero(), NULL, RAII_VAR, S_OR, and value.
Referenced by ast_ari_channels_get_channel_var_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 907 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_no_content(), AST_CAUSE_NORMAL, ast_channel_get_by_name(), ast_channel_hangupcause_set(), ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, ast_strlen_zero(), convert_reason_to_hangup_code(), NULL, and RAII_VAR.
Referenced by ast_ari_channels_hangup_cb().
void ast_ari_channels_hold | ( | struct ast_variable * | headers, |
struct ast_ari_channels_hold_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Hold a channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 514 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_hold().
Referenced by ast_ari_channels_hold_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 956 of file resource_channels.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_ari_response_alloc_failed(), ast_ari_response_ok(), ast_channel_cache_all(), ast_channel_snapshot_to_json(), ast_json_array_append(), ast_json_array_create(), ast_json_ref(), ast_json_unref(), stasis_message_sanitizer::channel_snapshot, NULL, RAII_VAR, and stasis_app_get_sanitizer().
Referenced by ast_ari_channels_list_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 256 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_no_content(), find_control(), NULL, RAII_VAR, and stasis_app_control_move().
Referenced by ast_ari_channels_move_cb().
void ast_ari_channels_mute | ( | struct ast_variable * | headers, |
struct ast_ari_channels_mute_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Mute a channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 403 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_no_content(), AST_FRAME_VOICE, AST_MUTE_DIRECTION_READ, AST_MUTE_DIRECTION_WRITE, ast_strlen_zero(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_mute().
Referenced by ast_ari_channels_mute_cb().
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).
The new channel is created immediately and a snapshot of it returned. If a Stasis application is provided it will be automatically subscribed to the originated channel for further events and updates.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 1433 of file resource_channels.c.
References args, ari_channels_handle_originate_with_id(), ast_ari_channels_originate_parse_body(), ast_channel_cleanup, ast_json_object_get(), ast_variables_destroy(), json_to_ast_variables(), and NULL.
Referenced by ast_ari_channels_originate_cb().
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).
The new channel is created immediately and a snapshot of it returned. If a Stasis application is provided it will be automatically subscribed to the originated channel for further events and updates.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 1394 of file resource_channels.c.
References args, ari_channels_handle_originate_with_id(), ast_ari_channels_originate_with_id_parse_body(), ast_channel_cleanup, ast_json_object_get(), ast_variables_destroy(), json_to_ast_variables(), and NULL.
Referenced by ast_ari_channels_originate_with_id_cb().
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.
The media URI may be any of a number of URI's. Currently sound:, recording:, number:, digits:, characters:, and tone: URI's are supported. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.)
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 718 of file resource_channels.c.
References args, and ari_channels_handle_play().
Referenced by ast_ari_channels_play_cb().
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.
The media URI may be any of a number of URI's. Currently sound:, recording:, number:, digits:, characters:, and tone: URI's are supported. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.)
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 733 of file resource_channels.c.
References args, and ari_channels_handle_play().
Referenced by ast_ari_channels_play_with_id_cb().
void ast_ari_channels_record | ( | struct ast_variable * | headers, |
struct ast_ari_channels_record_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Start a recording.
Record audio from a channel. Note that this will not capture audio sent to the channel. The bridge itself has a record feature if that's what you want.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 748 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_created(), ast_ari_response_error(), ast_asprintf, ast_assert, ast_free, ast_get_format_for_file_ext(), ast_log, ast_malloc, AST_RECORD_IF_EXISTS_ERROR, ast_string_field_build, ast_uri_encode(), ast_uri_http, errno, find_control(), LOG_WARNING, NULL, options, RAII_VAR, stasis_app_control_record(), stasis_app_recording_if_exists_parse(), stasis_app_recording_options_create(), STASIS_APP_RECORDING_TERMINATE_INVALID, stasis_app_recording_termination_parse(), and stasis_app_recording_to_json().
Referenced by ast_ari_channels_record_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 276 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_no_content(), ast_channel_snapshot_get_latest(), ast_strdupa, ast_strlen_zero(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_redirect().
Referenced by ast_ari_channels_redirect_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 363 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_ring().
Referenced by ast_ari_channels_ring_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 383 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_ring_stop().
Referenced by ast_ari_channels_ring_stop_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 2028 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_ok(), ast_channel_cleanup, ast_channel_get_by_name(), ast_channel_lock, ast_channel_tech(), ast_channel_unlock, ast_rtp_instance_get_glue(), ast_rtp_instance_get_stats_all_json(), ast_rtp_glue::get_rtp_info, NULL, RAII_VAR, and ast_channel_tech::type.
Referenced by ast_ari_channels_rtpstatistics_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 487 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_no_content(), ast_strlen_zero(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_dtmf().
Referenced by ast_ari_channels_send_dtmf_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 1541 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_no_content(), ast_assert, ast_strlen_zero(), find_control(), NULL, RAII_VAR, and stasis_app_control_set_channel_var().
Referenced by ast_ari_channels_set_channel_var_cb().
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.
Snoop (spy/whisper) on a specific channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 1651 of file resource_channels.c.
References args, and ari_channels_handle_snoop_channel().
Referenced by ast_ari_channels_snoop_channel_cb().
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.
Snoop (spy/whisper) on a specific channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 1665 of file resource_channels.c.
References args, and ari_channels_handle_snoop_channel().
Referenced by ast_ari_channels_snoop_channel_with_id_cb().
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.
Using media operations such as /play on a channel playing MOH in this manner will suspend MOH without resuming automatically. If continuing music on hold is desired, the stasis application must reinitiate music on hold.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 556 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_moh_start().
Referenced by ast_ari_channels_start_moh_cb().
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.
Using media operations such as /play on a channel playing silence in this manner will suspend silence without resuming automatically.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 596 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_silence_start().
Referenced by ast_ari_channels_start_silence_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 576 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_moh_stop().
Referenced by ast_ari_channels_stop_moh_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 616 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_silence_stop().
Referenced by ast_ari_channels_stop_silence_cb().
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.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 535 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_no_content(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_unhold().
Referenced by ast_ari_channels_unhold_cb().
void ast_ari_channels_unmute | ( | struct ast_variable * | headers, |
struct ast_ari_channels_unmute_args * | args, | ||
struct ast_ari_response * | response | ||
) |
Unmute a channel.
headers | HTTP headers | |
args | Swagger parameters | |
[out] | response | HTTP response |
Definition at line 445 of file resource_channels.c.
References ao2_cleanup, args, ast_ari_response_error(), ast_ari_response_no_content(), AST_FRAME_VOICE, AST_MUTE_DIRECTION_READ, AST_MUTE_DIRECTION_WRITE, ast_strlen_zero(), channel_state_invalid(), find_control(), NULL, RAII_VAR, and stasis_app_control_unmute().
Referenced by ast_ari_channels_unmute_cb().
|
static |
Definition at line 1684 of file resource_channels.c.
References ast_free, ast_hangup(), ari_channel_thread_data::chan, and ari_channel_thread_data::stasis_stuff.
Referenced by ari_channel_thread(), and ast_ari_channels_create().
|
static |
Ensure channel is in a state that allows operation to be performed.
Since Asterisk 14, it has been possible for down channels, as well as unanswered outbound channels to enter Stasis. While some operations are fine to perform on such channels, operations that
are invalid. This function can be used to determine if the channel is in an appropriate state.
control | The app control |
response | Response to fill in if there is an error |
0 | Channel is in a valid state. Continue on! |
non-zero | Channel is in an invalid state. Bail! |
Definition at line 108 of file resource_channels.c.
References ao2_ref, ast_ari_response_error(), AST_STATE_DOWN, AST_STATE_RESERVED, AST_STATE_RINGING, stasis_app_control_get_snapshot(), and ast_channel_snapshot::state.
Referenced by ari_channels_handle_play(), ast_ari_channels_answer(), ast_ari_channels_continue_in_dialplan(), ast_ari_channels_hold(), ast_ari_channels_mute(), ast_ari_channels_redirect(), ast_ari_channels_ring(), ast_ari_channels_ring_stop(), ast_ari_channels_send_dtmf(), ast_ari_channels_start_moh(), ast_ari_channels_start_silence(), ast_ari_channels_stop_moh(), ast_ari_channels_stop_silence(), ast_ari_channels_unhold(), and ast_ari_channels_unmute().
|
static |
Return the corresponded hangup code of the given reason.
Definition at line 53 of file resource_channels.c.
References AST_CAUSE_ANSWERED_ELSEWHERE, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, AST_CAUSE_BUSY, AST_CAUSE_CALL_REJECTED, AST_CAUSE_CONGESTION, AST_CAUSE_FAILURE, AST_CAUSE_INTERWORKING, AST_CAUSE_INVALID_NUMBER_FORMAT, AST_CAUSE_NO_USER_RESPONSE, AST_CAUSE_NOANSWER, AST_CAUSE_NORMAL, AST_CAUSE_NORMAL_UNSPECIFIED, and AST_CAUSE_UNALLOCATED.
Referenced by ast_ari_channels_hangup().
|
static |
Definition at line 2132 of file resource_channels.c.
References args, ari_channels_handle_originate_with_id(), ast_alloca, ast_ari_response_error(), ast_channel_lock, ast_channel_unlock, ast_channel_unref, ast_channel_varshead(), ast_json_channel_vars(), ast_json_object_set(), AST_LIST_EMPTY, ast_strlen_zero(), ast_variables_destroy(), ast_ari_response::message, and NULL.
Referenced by ast_ari_channels_external_media().
|
static |
Definition at line 2084 of file resource_channels.c.
References args, ari_channels_handle_originate_with_id(), ast_asprintf, ast_channel_lock, ast_channel_unlock, ast_channel_unref, ast_channel_varshead(), ast_free, ast_json_channel_vars(), ast_json_object_set(), AST_LIST_EMPTY, ast_variables_destroy(), ast_ari_response::message, and NULL.
Referenced by ast_ari_channels_external_media().
|
static |
Finds the control object for a channel, filling the response with an error, if appropriate.
[out] | response | Response to fill with an error if control is not found. |
channel_id | ID of the channel to lookup. |
NULL | if control object does not exist. |
Definition at line 152 of file resource_channels.c.
References ao2_cleanup, ao2_ref, ast_ari_response_error(), ast_assert, ast_channel_get_by_name(), NULL, RAII_VAR, and stasis_app_control_find_by_channel_id().
Referenced by ari_channels_handle_play(), ast_ari_channels_answer(), ast_ari_channels_continue_in_dialplan(), ast_ari_channels_dial(), ast_ari_channels_hold(), ast_ari_channels_move(), ast_ari_channels_mute(), ast_ari_channels_record(), ast_ari_channels_redirect(), ast_ari_channels_ring(), ast_ari_channels_ring_stop(), ast_ari_channels_send_dtmf(), ast_ari_channels_set_channel_var(), ast_ari_channels_start_moh(), ast_ari_channels_start_silence(), ast_ari_channels_stop_moh(), ast_ari_channels_stop_silence(), ast_ari_channels_unhold(), and ast_ari_channels_unmute().
|
static |
Definition at line 1373 of file resource_channels.c.
References ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_json_to_ast_variables(), AST_JSON_TO_AST_VARS_CODE_INVALID_TYPE, AST_JSON_TO_AST_VARS_CODE_OOM, AST_JSON_TO_AST_VARS_CODE_SUCCESS, ast_log, and AST_LOG_ERROR.
Referenced by ast_ari_channels_create(), ast_ari_channels_external_media(), ast_ari_channels_originate(), and ast_ari_channels_originate_with_id().
|
static |
Retrieve the dialstring from the channel datastore.
chan | Channel that was previously created in ARI |
NULL | Failed to find datastore |
non-NULL | The dialstring |
Definition at line 1766 of file resource_channels.c.
References ast_channel_datastore_find(), ast_datastore::data, dialstring_info, and NULL.
Referenced by ast_ari_channels_dial().
|
static |
Save dialstring onto a channel datastore.
This will later be retrieved when it comes time to actually dial the channel
chan | The channel on which to save the dialstring |
dialstring | The dialstring to save |
0 | on success. |
-1 | on error. |
Definition at line 1732 of file resource_channels.c.
References ast_channel_datastore_add(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), ast_strdup, ast_datastore::data, dialstring_info, and NULL.
Referenced by ast_ari_channels_create().
struct ast_datastore_info dialstring_info |
Definition at line 1717 of file resource_channels.c.
Referenced by restore_dialstring(), and save_dialstring().