This patch implements the REST API's for POST /channels/{channelId}/play

and GET /playback/{playbackId}.

This allows an external application to initiate playback of a sound on a
channel while the channel is in the Stasis application.

/play commands are issued asynchronously, and return immediately with
the URL of the associated /playback resource. Playback commands queue up,
playing in succession. The /playback resource shows the state of a
playback operation as enqueued, playing or complete. (Although the
operation will only be in the 'complete' state for a very short time,
since it is almost immediately freed up).

(closes issue ASTERISK-21283)
(closes issue ASTERISK-21586)
Review: https://reviewboard.asterisk.org/r/2531/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
David M. Lee
2013-05-23 20:11:35 +00:00
parent 3464e0919a
commit 10ba6bf8a8
20 changed files with 906 additions and 97 deletions

View File

@@ -54,6 +54,7 @@ struct ast_channel_snapshot {
AST_STRING_FIELD(caller_number); /*!< Caller ID Number */
AST_STRING_FIELD(connected_name); /*!< Connected Line Name */
AST_STRING_FIELD(connected_number); /*!< Connected Line Number */
AST_STRING_FIELD(language); /*!< The default spoken language for the channel */
);
struct timeval creationtime; /*!< The time of channel creation */
@@ -122,6 +123,17 @@ struct stasis_message_type *ast_channel_snapshot_type(void);
struct ast_channel_snapshot *ast_channel_snapshot_create(
struct ast_channel *chan);
/*!
* \since 12
* \brief Get the most recent snapshot for channel with the given \a uniqueid.
*
* \param uniqueid Uniqueid of the snapshot to fetch.
* \return Most recent channel snapshot
* \return \c NULL on error
*/
struct ast_channel_snapshot *ast_channel_snapshot_get_latest(
const char *uniqueid);
/*!
* \since 12
* \brief Creates a \ref ast_channel_blob message.
@@ -140,6 +152,23 @@ struct ast_channel_snapshot *ast_channel_snapshot_create(
struct stasis_message *ast_channel_blob_create(struct ast_channel *chan,
struct stasis_message_type *type, struct ast_json *blob);
/*!
* \since 12
* \brief Create a \ref ast_channel_blob message, pulling channel state from
* the cache.
*
* \param uniqueid Uniqueid of the channel.
* \param type Message type for this blob.
* \param blob JSON object representing the data, or \c NULL for no data. If
* \c NULL, ast_json_null() is put into the object.
*
* \return \ref ast_channel_blob message.
* \return \c NULL on error
*/
struct stasis_message *ast_channel_blob_create_from_cache(
const char *uniqueid, struct stasis_message_type *type,
struct ast_json *blob);
/*!
* \since 12
* \brief Create a \ref ast_multi_channel_blob suitable for a \ref stasis_message.
@@ -221,6 +250,14 @@ struct ast_json *ast_multi_channel_blob_get_json(struct ast_multi_channel_blob *
void ast_multi_channel_blob_add_channel(struct ast_multi_channel_blob *obj,
const char *role, struct ast_channel_snapshot *snapshot);
/*!
* \since 12
* \brief Publish a \ref ast_channel_snapshot for a channel.
*
* \param chan Channel to publish.
*/
void ast_channel_publish_snapshot(struct ast_channel *chan);
/*!
* \since 12
* \brief Publish a \ref ast_channel_varset for a channel.