login | register
Tue 02 of Dec, 2008 [02:22 UTC]

voip-info.org

Discuss [1] History

Asterisk cmd ControlPlayback

Created by: JustRumours,Last modification on Fri 12 of Oct, 2007 [12:24 UTC] by chandave

Synopsis

Plays a sound file with fast forward, rewind and stop controls.

Description

   ControlPlayback(filename[|skipms[|ff[|rew[|stop[|pause[|restart|options]]]]]]])

This application will play back the given filename (do not include the filename extension). By default, the * key can be used to rewind, and the # key can be used to fast-forward.

Optional Parameters:
  • skipms - This is number of milliseconds to skip when rewinding or fast-forwarding.
  • ff - Fast-forward when this DTMF digit is received.
  • rew - Rewind when this DTMF digit is received.
  • stop - Stop playback when this DTMF digit is received.
  • pause - Pause playback when this DTMF digit is received.
  • restart - Restart playback when this DTMF digit is received.
  • Options: At present the only valid option is j - Jump to priority n+101 if the requested file is not found.

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).

Example

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

NOTE that if ControlPlayback is called using AGI then the options must be separated by the | character rather than a comma. Example (from a Perl script, where the filename to play back was stored in variable $file2play):

  $AGI->exec("ControlPlayback","$file2play|5000|6|4|#|*|1");

In this example, 6 was used to go forward 5 seconds, and 4 to go back 5 seconds (emulating the positions of the forward and back buttons on many remote controls). # stops the playback and * pauses it, while 1 restarts from the beginning (from the "1st" part of the recording).

See also



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


Comments

Comments Filter
222

333Can asterisk record dictations?

by mescueta, Sunday 30 of January, 2005 [23:50:33 UTC]
Can asterisk record dictations? just like recding disctation sofware?