Asterisk cmd ControlPlayback Chinese





註:新版的asterisk,大概是1.6版以上,參數間的分隔都改用逗號 "," 而不是管線"|"了

此程式會播放指定的檔名(不要包含副檔名)。 預設值, * 鍵是倒帶, # 鍵是快轉。

  • skipms - 此數字為毫秒,為按一次快轉鍵或倒帶鍵時要略過的秒數。(譯者註:即快轉幾秒、倒帶幾秒)
  • ff - 快轉,當收到 DTMF 數字時。
  • rew - 倒帶,當收到 DTMF 數字時。
  • stop - 停止播放,當收到 DTMF 數字時。
  • pause - 暫停播放,當收到 DTMF 數字時。
  • restart - 重新播放,當收到 DTMF 數字時。
  • Options: 目前可用的選項只有 j - 若未找到檔案時,跳到 priority n+101

This application sets the CPLAYBACKSTATUS channel variable upon completion. The CPLAYBACKSTATUS variable will contain the status of the attempt as a text string, one of: SUCCESS | USERSTOPPED | ERROR

The caller may control the playback of the sound by dialing the forward button (default is *) and the rewind button (default is #). Each press of these keys will skip the playback skip milliseconds forward or backward as appropriate. You may also specify stop, restart and pause buttons.

Note that as the * key is on the left and the # button is on the right of a telephone keypad, it may make more sense to swap the default buttons: use * for rewind and # for forward.

Return Code

Returns -1 on hangup or if filename doesn't exist, 0 otherwise (this may have been true in the past, don't know if it is still the case).


exten => 1234,1,ControlPlayback(mysoundfile,4000,*,#,1,0)

註:若 ControlPlayback 是使用 AGI 來呼叫的話,那麼它參數必須使用 | 管線來分隔這些參數,而不是用逗號。 例 (from a Perl script, where the filename to play back was stored in variable $file2play):


此例中, 6 號鍵用來快轉 5 秒, 4 號鍵為倒帶 5 秒 (模擬許多遙控器上的快轉、倒帶鍵的位置)。 # 號鍵為停止播放,* 號鍵為暫停播放,按1號鍵重頭重新播放(from the "1st" part of the recording).

See also

Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: dominic16y, Last modification: Wed 26 of Sep, 2012 (02:45 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+