mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +00:00
ARI: Add the ability to play multiple media URIs in a single operation
Many ARI applications will want to play multiple media files in a row to a resource. The most common use case is when building long-ish IVR prompts made up of multiple, smaller sound files. Today, that requires building a small state machine, listening for each PlaybackFinished event, and triggering the next sound file to play. While not especially challenging, it is tedious work. Since requiring developers to write tedious code to do normal activities stinks, this patch adds the ability to play back a list of media files to a resource. Each of the 'play' operations on supported resources (channels and bridges) now accepts a comma delineated list of media URIs to play. A single Playback resource is created as a handle to the entire list. The operation of playing a list is identical to playing a single media URI, save that a new event, PlaybackContinuing, is raised instead of a PlaybackFinished for each non-final media URI. When the entire list is finished being played, a PlaybackFinished event is raised. In order to help inform applications where they are in the list playback, the Playback resource now includes a new, optional attribute, 'next_media_uri', that contains the next URI in the list to be played. It's important to note the following: - If an offset is provided to the 'play' operations, it only applies to the first media URI, as it would be weird to skip n seconds forward in every media resource. - Operations that control the position of the media only affect the current media being played. For example, once a media resource in the list completes, a 'reverse' operation on a subsequent media resource will not start a previously completed media resource at the appropiate offset. - This patch does not add any new operations to control the list. Hopefully, user feedback and/or future patches would add that if people want it. ASTERISK-26022 #close Change-Id: Ie1ea5356573447b8f51f2e7964915ea01792f16f
This commit is contained in:
@@ -1186,6 +1186,24 @@ int ast_ari_validate_peer_status_change(struct ast_json *json);
|
||||
*/
|
||||
ari_validator ast_ari_validate_peer_status_change_fn(void);
|
||||
|
||||
/*!
|
||||
* \brief Validator for PlaybackContinuing.
|
||||
*
|
||||
* Event showing the continuation of a media playback operation from one media URI to the next in the list.
|
||||
*
|
||||
* \param json JSON object to validate.
|
||||
* \returns True (non-zero) if valid.
|
||||
* \returns False (zero) if invalid.
|
||||
*/
|
||||
int ast_ari_validate_playback_continuing(struct ast_json *json);
|
||||
|
||||
/*!
|
||||
* \brief Function pointer to ast_ari_validate_playback_continuing().
|
||||
*
|
||||
* See \ref ast_ari_model_validators.h for more details.
|
||||
*/
|
||||
ari_validator ast_ari_validate_playback_continuing_fn(void);
|
||||
|
||||
/*!
|
||||
* \brief Validator for PlaybackFinished.
|
||||
*
|
||||
@@ -1457,6 +1475,7 @@ ari_validator ast_ari_validate_application_fn(void);
|
||||
* - id: string (required)
|
||||
* - language: string
|
||||
* - media_uri: string (required)
|
||||
* - next_media_uri: string
|
||||
* - state: string (required)
|
||||
* - target_uri: string (required)
|
||||
* DeviceState
|
||||
@@ -1670,6 +1689,11 @@ ari_validator ast_ari_validate_application_fn(void);
|
||||
* - timestamp: Date
|
||||
* - endpoint: Endpoint (required)
|
||||
* - peer: Peer (required)
|
||||
* PlaybackContinuing
|
||||
* - type: string (required)
|
||||
* - application: string (required)
|
||||
* - timestamp: Date
|
||||
* - playback: Playback (required)
|
||||
* PlaybackFinished
|
||||
* - type: string (required)
|
||||
* - application: string (required)
|
||||
|
||||
Reference in New Issue
Block a user