ConfBridge: Make some announcements asynchronous.

Confbridge announcements tend to block a channel while they are being
played. In some circumstances, this is warranted since you want that
particular channel not to hear the announcement (Example: "John Doe has
entered the conference"). For others it makes less sense.

This change first introduces methods for playing sounds asynchronously
into the conference. This is very similar to how synchronous sounds are
played, except the channel initiating the playback does not wait for the
sound to complete before moving on.

Asynchronous announcements are used for two circumstances:
* Sounds played for a user after they have left the bridge
* Sounds that play first to a single user and then the rest of the
  conference (if the channel and conference use the same language)

ASTERISK-26289 #close
Reported by Mark Michelson

Change-Id: Ie486bb3de1646d50894489030326a423e594ab0a
This commit is contained in:
Mark Michelson
2016-08-10 15:14:09 -05:00
parent 1bd571ef75
commit 63feffa126
4 changed files with 375 additions and 41 deletions

View File

@@ -386,6 +386,37 @@ int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data
*/
int play_sound_file(struct confbridge_conference *conference, const char *filename);
/*!
* \brief Play sound file into conference bridge asynchronously
*
* If the initiator parameter is non-NULL, then the playback will wait for
* that initiator channel to get back in the bridge before playing the sound
* file. This way, the initiator has no danger of hearing a "clipped" file.
*
* \param conference The conference bridge to play sound file into
* \param filename Sound file to play
* \param initiator Channel that initiated playback.
*
* \retval 0 success
* \retval -1 failure
*/
int async_play_sound_file(struct confbridge_conference *conference, const char *filename,
struct ast_channel *initiator);
/*!
* \brief Indicate the initiator of an async sound file is ready for it to play.
*
* When playing an async sound file, the initiator is typically either out of the bridge
* or not in a position to hear the queued announcement. This function lets the announcement
* thread know that the initiator is now ready for the sound to play.
*
* If an async announcement was queued and no initiator channel was provided, then this is
* a no-op
*
* \param chan The channel that initiated the async announcement
*/
void async_play_sound_ready(struct ast_channel *chan);
/*! \brief Callback to be called when the conference has become empty
* \param conference The conference bridge
*/