ControlPlayback’s options

Home » Asterisk Users » ControlPlayback’s options
Asterisk Users 3 Comments

On 2011-05-30 14:32, virendra bhati wrote:
> Hi List,
>
> Asterisk ‘s *ControlPlayback* will used for play any recorded file as
> an audio player. Is it possible that we can use it for multiple
> forward and rewind ?
>
> ex:-
> original: ControlPlayback(filename,skipms,ff,rew,stop,pause)
> expected
> ControlPlayback(filename,skip1,skip2,skip3,forward1,rewind1,forward2,rewind2,forward3,rewind3,stop,pause)
> :

Yes, you can use the CPLAYBACKSTATUS, CPLAYBACKOFFSET and
CPLAYBACKSTOPKEY variables to get this behavior.
All you have to do is to list the additional keys and stop keys and
implement this in your dialplan…

I’ve attached some ael I use for this to implement 1 and 3 as 1 minute
rewind/forward. 4 and 6 as 5 minutes rewind/forward and 7 and 9 as 15
minutes.
5 I use as the pause key, and */# to switch recording.

Greetings,
Johan Wilfer

3 thoughts on - ControlPlayback’s options

  • Hi Johan Wilfer,

    Thanks for your reply. On the basis of your provided code I made all things
    into extensions.conf. But i have an small issue on which I need your
    attention again.
    in below context what’s ${tz} ? Is this time zone value or else?
    and another things is what is the use of SayUnixTime(${time},${tz},d
    ‘digits/of’ B);
    this function in such case?

    context conference_play_recordings_
    conference_paused {
    announce => {
    Set(time=$[${epoch_start}+${position}/1000]);
    while(true) {
    WaitExten(1);
    Background(conf_playrec_pause_part1);
    SayUnixTime(${time},${tz},kM);
    Background(conf_playrec_pause_part2);
    SayUnixTime(${time},${tz},d ‘digits/of’ B);
    Background(conf_playrec_pause_part3);
    WaitExten(5);
    }
    }

    one thing which is also confusing is that what is the meaning or use of such
    lines in this application.

    ControlPlayback(${filename},60000,3,1,*#2456790,,,o(${position}))

    Please put some light on these too.

  • Yes, I store the calls timezone in tis variable before the code sample
    you got.

    I’ve implemented 5 as a pause-button on the phone. This context handles
    this by playing a
    prompt that you have pause the recording and

    This is repeated untill the user presses a key on the keypad.
    ${filename} is the file you want to play.
    60000 is 60 seconds to skip.
    3 is to use 3 as forward 60 seconds
    1 to to use 1 as rewind 60 seconds
    *#2456790 is used as stop buttons (and handled by the dialplan)
    o() is a option to go to a specific position in the file
    ${position} is the variable that hold the current position of the playback.

    To get more details use the following command:
    asterisk*CLI> core show application ControlPlayback

    Displays:
    -= Info about application ‘ControlPlayback’ =-

    [Synopsis]
    Play a file with fast forward and rewind.

    [Description]
    This application will play back the given .
    It sets the following channel variables upon completion:
    ${CPLAYBACKSTATUS}: Contains the status of the attempt as a text string
    SUCCESS
    USERSTOPPED
    ERROR
    ${CPLAYBACKOFFSET}: Contains the offset in ms into the file where playback
    was at when it stopped. ‘-1’ is end of file.
    ${CPLAYBACKSTOPKEY}: If the playback is stopped by the user this variable
    contains the key that was pressed.

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

    [Arguments]
    skipms
    This is number of milliseconds to skip when rewinding or fast-fo
    rwarding.
    ff
    Fast-forward when this DTMF digit is received. (defaults to ‘#’)
    rew
    Rewind when this DTMF digit is received. (defaults to ‘*’)
    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
    o(time):
    time – Start at

    [See Also]
    Not available

    /Johan

  • Hi John Wilfer,

    Thanks for replay. Now all things is working on asterisk 1.6.2.18 version.
    But When I try the same thing on Asterisk 1.4.X then facing problem.

    Is this the problem of ControlPlayback ‘s option fields of asterisk 1.4.X
    in this version have option P(jumping) not O(time) ?
    Is there any way by which we will implement like by upload ControlPlayback
    from asterisk 1.6 to 1.4 or else ?
    ControlPlayback(filename[,skipms[,ff[,rew[,stop[,pause[,restart[,options]]]]]]])