Asterisk - The Open Source Telephony Project
18.5.0
|
Stasis Application Playback API. See StasisApplication API" for detailed documentation. More...
#include "asterisk/stasis_app.h"
Go to the source code of this file.
Functions | |
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. More... | |
struct stasis_app_playback * | stasis_app_playback_find_by_id (const char *id) |
Finds the playback object with the given id. More... | |
const char * | stasis_app_playback_get_id (struct stasis_app_playback *playback) |
Gets the unique id of a playback object. More... | |
enum stasis_app_playback_state | stasis_app_playback_get_state (struct stasis_app_playback *playback) |
Gets the current state of a playback operation. More... | |
enum stasis_playback_oper_results | stasis_app_playback_operation (struct stasis_app_playback *playback, enum stasis_app_playback_media_operation operation) |
Controls the media for a given playback operation. More... | |
struct stasis_message_type * | stasis_app_playback_snapshot_type (void) |
Message type for playback updates. The data is an ast_channel_blob. More... | |
struct ast_json * | stasis_app_playback_to_json (const struct stasis_app_playback *playback) |
Convert a playback to its JSON representation. More... | |
Stasis Application Playback API. See StasisApplication API" for detailed documentation.
Definition in file stasis_app_playback.h.
Valid operation for controlling a playback.
Definition at line 57 of file stasis_app_playback.h.
State of a playback operation
Definition at line 37 of file stasis_app_playback.h.
Enumerator | |
---|---|
STASIS_PLAYBACK_TARGET_CHANNEL | The target is a channel |
STASIS_PLAYBACK_TARGET_BRIDGE | The target is a bridge |
Definition at line 74 of file stasis_app_playback.h.
Enumerator | |
---|---|
STASIS_PLAYBACK_OPER_OK | |
STASIS_PLAYBACK_OPER_FAILED | |
STASIS_PLAYBACK_OPER_NOT_PLAYING |
Definition at line 145 of file stasis_app_playback.h.
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.
Note that the file isn't the full path to the file. Asterisk's internal playback mechanism will automagically select the best format based on the available codecs for the channel.
control | Control for res_stasis . |
media | Array of const char * media files to play. |
media_count | The number of media files in media . |
language | Selects the file based on language. |
target_id | ID of the target bridge or channel. |
target_type | What the target type is |
skipms | Number of milliseconds to skip for forward/reverse operations. |
offsetms | Number of milliseconds to skip before playing. |
id | ID to assign the new playback or NULL for default. |
NULL
on error. Definition at line 471 of file res_stasis_playback.c.
References ao2_bump, ao2_link, ao2_ref, ast_debug, ast_free, ast_log, ast_malloc, ast_string_field_set, ast_strlen_zero, AST_VECTOR_APPEND, AST_VECTOR_GET, LOG_ERROR, NULL, play_uri(), playback_create(), PLAYBACK_DEFAULT_SKIPMS, playback_publish(), remove_from_playbacks(), set_target_uri(), skipms, stasis_app_control_get_channel_id(), stasis_app_send_command_async(), and STASIS_PLAYBACK_STATE_QUEUED.
Referenced by ari_bridges_play_helper(), and ari_channels_handle_play().
struct stasis_app_playback* stasis_app_playback_find_by_id | ( | const char * | id | ) |
Finds the playback object with the given id.
id | Id of the playback object to find. |
NULL
if id not found. Definition at line 550 of file res_stasis_playback.c.
References ao2_find, and OBJ_KEY.
Referenced by ast_ari_playbacks_control(), ast_ari_playbacks_get(), ast_ari_playbacks_stop(), and play_on_channel_in_bridge().
const char* stasis_app_playback_get_id | ( | struct stasis_app_playback * | playback | ) |
Gets the unique id of a playback object.
playback | Playback control object. |
NULL
if playback ic NULL
Definition at line 543 of file res_stasis_playback.c.
References stasis_app_playback::id.
Referenced by ari_bridges_play_helper(), and ari_channels_handle_play().
enum stasis_app_playback_state stasis_app_playback_get_state | ( | struct stasis_app_playback * | playback | ) |
Gets the current state of a playback operation.
playback | Playback control object. |
Definition at line 536 of file res_stasis_playback.c.
References lock, and SCOPED_AO2LOCK.
enum stasis_playback_oper_results stasis_app_playback_operation | ( | struct stasis_app_playback * | playback, |
enum stasis_app_playback_media_operation | operation | ||
) |
Controls the media for a given playback operation.
playback | Playback control object. |
control | Media control operation. |
STASIS_PLAYBACK_OPER_OK
on success. Definition at line 708 of file res_stasis_playback.c.
References ast_assert, ast_log, lock, LOG_ERROR, operations, SCOPED_AO2LOCK, STASIS_PLAYBACK_MEDIA_OP_MAX, STASIS_PLAYBACK_OPER_FAILED, STASIS_PLAYBACK_OPER_NOT_PLAYING, STASIS_PLAYBACK_OPER_OK, STASIS_PLAYBACK_STATE_MAX, and STASIS_PLAYBACK_STATE_PLAYING.
Referenced by ast_ari_playbacks_control(), and ast_ari_playbacks_stop().
struct stasis_message_type* stasis_app_playback_snapshot_type | ( | void | ) |
Message type for playback updates. The data is an ast_channel_blob.
Referenced by load_module(), playback_publish(), playback_to_json(), and unload_module().
struct ast_json* stasis_app_playback_to_json | ( | const struct stasis_app_playback * | playback | ) |
Convert a playback to its JSON representation.
playback | The playback object to convert to JSON |
Definition at line 555 of file res_stasis_playback.c.
References ast_json_pack(), ast_json_ref(), ast_json_unref(), AST_VECTOR_GET, AST_VECTOR_SIZE, stasis_app_playback::id, stasis_app_playback::language, stasis_app_playback::media, NULL, RAII_VAR, state_to_string(), and stasis_app_playback::target.
Referenced by ari_bridges_play_helper(), ari_channels_handle_play(), ast_ari_playbacks_get(), and playback_publish().