mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
ARI: Add tones playback resource
Adds a tones URI type to the playback resource. The tone can be specified by name (from indications.conf) or by a tone pattern. In addition, tonezone can be specified in the URI (by appending ;tonezone=<zone>). Tones must be stopped manually in order for a stasis control to move on from playback of the tone. Tones may be paused, resumed, restarted, and stopped. They may not be rewound or fast forwarded (tones can't be controlled in a way that lets you skip around from note to note and pausing and resuming will also restart the tone from the beginning). Tests are currently in development for this feature (https://reviewboard.asterisk.org/r/3428/). (closes issue ASTERISK-23433) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3427/ ........ Merged revisions 412535 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -48,6 +48,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/stringfields.h"
|
||||
#include "asterisk/uuid.h"
|
||||
#include "asterisk/say.h"
|
||||
#include "asterisk/indications.h"
|
||||
|
||||
/*! Number of hash buckets for playback container. Keep it prime! */
|
||||
#define PLAYBACK_BUCKETS 127
|
||||
@@ -60,6 +61,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#define NUMBER_URI_SCHEME "number:"
|
||||
#define DIGITS_URI_SCHEME "digits:"
|
||||
#define CHARACTERS_URI_SCHEME "characters:"
|
||||
#define TONE_URI_SCHEME "tone:"
|
||||
|
||||
/*! Container of all current playbacks */
|
||||
static struct ao2_container *playbacks;
|
||||
@@ -323,6 +325,9 @@ static void play_on_channel(struct stasis_app_playback *playback,
|
||||
} else if (ast_begins_with(playback->media, CHARACTERS_URI_SCHEME)) {
|
||||
res = ast_say_character_str(chan, playback->media + strlen(CHARACTERS_URI_SCHEME),
|
||||
stop, playback->language, AST_SAY_CASE_NONE);
|
||||
} else if (ast_begins_with(playback->media, TONE_URI_SCHEME)) {
|
||||
playback->controllable = 1;
|
||||
res = ast_control_tone(chan, playback->media + strlen(TONE_URI_SCHEME));
|
||||
} else {
|
||||
/* Play URL */
|
||||
ast_log(LOG_ERROR, "Attempted to play URI '%s' on channel '%s' but scheme is unsupported",
|
||||
|
Reference in New Issue
Block a user