Playback: Play a sound file. (1.0)
功能:
Play a sound and/or video file
播放一个声音或视频文件
语法:
Playback(filename1[&filename2...][,options])
描述:
播放指定的声音或视频文件(你需要省略文件拓展名)。声音文件默认被保存在/var/lib/asterisk/sounds目录下(该目录路径可以在asterisk.conf被改变)
Plays the specified sound or video file(s) (you need to omit the filename extension). Sound files are stored in the /var/lib/asterisk/sounds directory by default (the directory path can be changed in asterisk.conf).
Playback是一个可以多国语言选择的应用。它将寻找与当前语言相符的子文件夹,(就是使用SetLanguage命令或通道的默认语言编码。如果失败,它将播放没有语言指定的部分)
Playback is Multi-Language-compliant. It will look in a subdirectory corresponding with the current language code (as set by the SetLanguage command, or the channel's default language code. Failing that, it will play the non-language-specific edition.
Playback将播放整个语音文件,只有播放结束才把控制权归还给。对Background相比,Background不仅播放语音文件还可以立即返回控制权,允许asterisk在当前通道播放语音文件时,执行其他的命令。
Playback will play the whole sound file(s), and when complete, return control. Compare with the Background command, which plays a sound file but returns control immediately, allowing Asterisk to perform other commands on this channel while the sound file is playing.
参数
[options]有如下选项:
Skip:只有当通道被应答了才可播放声音文件。如果通道还没有被应答,Playback命令将不做任何操作,直接返回
skip: Play the sound file only if the channel has already been answered. If the channel has not yet been answered, the Playback command will return immediately without playing anything.
Noanswer:播放声音文件,但是不用事先应答(如果还没有应答)。不是所有的通道支持在通道还没有被应答时播放声音文件的。
noanswer: Play the sound file, but don't answer the channel first (if hasn't been answered already). Not all channels support playing messages while still on hook.
J:如果该选项被指定了,当指定声音文件不存在,该应用将跳转到n+101处(如果存在优先级n+101)
j: If option is specified, the application will jump to priority n+101 if present when a file specified to be played does not exist.
Say:使用say.conf来说明当前字符串。
say: Use say.conf to interpret the string
如果skip和noasnwer选项两者都没有指定, Playback命令将首先应答通道(如果当前通道还没有被应答),才会播放声音文件。
If neither skip nor noanswer options are specified, then the Playback command will first answer the channel (if it hasn't been answered already) and then play the sound file.
Note: The options wont work if there are spaces between the filename, the comma and the option(s).
示例1
exten => 500,1,Playback(tt-weasels,skip)
返回值
一旦结束, ${PLAYBACKSTATUS}会被设置成"FAILED"或者"SUCCESS"。
On completion, ${PLAYBACKSTATUS} contains either "FAILED" or "SUCCESS".
Playback不会被时间影响,除非internal_timing在asterisk.conf中被开启。
Playback is not affected by timing, unless internal_timing is turned on in asterisk.conf.