summaryrefslogtreecommitdiff
path: root/res/res_stasis_playback.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-07-19 19:35:21 +0000
committerJonathan Rose <jrose@digium.com>2013-07-19 19:35:21 +0000
commit17c546173fe1f24749af4643f19b40be180803de (patch)
tree46d8cf430d12142587196703c732d5e9ce9bba8e /res/res_stasis_playback.c
parent5a8f32703c445f7d09b5e029e85d76692626a67f (diff)
ARI: Bridge Playback, Bridge Record
Adds a new channel driver for creating channels for specific purposes in bridges, primarily to act as either recorders or announcers. Adds ARI commands for playing announcements to ever participant in a bridge as well as for recording a bridge. This patch also includes some documentation/reponse fixes to related ARI models such as playback controls. (closes issue ASTERISK-21592) Reported by: Matt Jordan (closes issue ASTERISK-21593) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2670/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_stasis_playback.c')
-rw-r--r--res/res_stasis_playback.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c
index 5b55ebc51..483aff8c2 100644
--- a/res/res_stasis_playback.c
+++ b/res/res_stasis_playback.c
@@ -64,6 +64,7 @@ struct stasis_app_playback {
AST_STRING_FIELD(id); /*!< Playback unique id */
AST_STRING_FIELD(media); /*!< Playback media uri */
AST_STRING_FIELD(language); /*!< Preferred language */
+ AST_STRING_FIELD(target); /*!< Playback device uri */
);
/*! Control object for the channel we're playing back to */
struct stasis_app_control *control;
@@ -263,9 +264,31 @@ static void playback_dtor(void *obj)
ast_string_field_free_memory(playback);
}
+static void set_target_uri(
+ struct stasis_app_playback *playback,
+ enum stasis_app_playback_target_type target_type,
+ const char *target_id)
+{
+ const char *type = NULL;
+ switch (target_type) {
+ case STASIS_PLAYBACK_TARGET_CHANNEL:
+ type = "channel";
+ break;
+ case STASIS_PLAYBACK_TARGET_BRIDGE:
+ type = "bridge";
+ break;
+ }
+
+ ast_assert(type != NULL);
+
+ ast_string_field_build(playback, target, "%s:%s", type, target_id);
+}
+
struct stasis_app_playback *stasis_app_control_play_uri(
struct stasis_app_control *control, const char *uri,
- const char *language, int skipms, long offsetms)
+ const char *language, const char *target_id,
+ enum stasis_app_playback_target_type target_type,
+ int skipms, long offsetms)
{
RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
char id[AST_UUID_STR_LEN];
@@ -290,6 +313,7 @@ struct stasis_app_playback *stasis_app_control_play_uri(
ast_string_field_set(playback, id, id);
ast_string_field_set(playback, media, uri);
ast_string_field_set(playback, language, language);
+ set_target_uri(playback, target_type, target_id);
playback->control = control;
playback->skipms = skipms;
playback->offsetms = offsetms;
@@ -342,9 +366,10 @@ struct ast_json *stasis_app_playback_to_json(
return NULL;
}
- json = ast_json_pack("{s: s, s: s, s: s, s: s}",
+ json = ast_json_pack("{s: s, s: s, s: s, s: s, s: s}",
"id", playback->id,
"media_uri", playback->media,
+ "target_uri", playback->target,
"language", playback->language,
"state", state_to_string(playback->state));