<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
On 2011-05-30 14:32, virendra bhati wrote:
<blockquote
cite="mid:BANLkTi=KrrfNgwe-yzZqXSQKtG1Lf7EDTg@mail.gmail.com"
type="cite">
<div dir="ltr">Hi List,<br>
<br>
Asterisk 's <b>ControlPlayback</b> will used for play any
recorded file as an audio player. Is it possible that we can use
it for multiple forward and rewind ?<br>
<br>
ex:- <br>
original: ControlPlayback(filename,skipms,ff,rew,stop,pause) <br>
expected
ControlPlayback(filename,skip1,skip2,skip3,forward1,rewind1,forward2,rewind2,forward3,rewind3,stop,pause)
: <br>
</div>
</blockquote>
<br>
Yes, you can use the CPLAYBACKSTATUS, CPLAYBACKOFFSET and
CPLAYBACKSTOPKEY variables to get this behavior. <br>
All you have to do is to list the additional keys and stop keys and
implement this in your dialplan...<br>
<br>
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.<br>
5 I use as the pause key, and */# to switch recording.<br>
<br>
Greetings,<br>
Johan Wilfer<br>
<br>
----<br>
<br>
<br>
context conference_play_recordings_conference_connect {<br>
playrec_intro => {<br>
Set(position=0);<br>
goto play,1;<br>
}<br>
<br>
play => {<br>
while (true) {<br>
if (${position}==-1) { goto recording_end,1; }<br>
<br>
//rewind 5 seconds after every action (so the user doesn't
feel lost...)<br>
Set(position=$[${position}-5000]);<br>
if (${position} < 0) { Set(position=0); }<br>
<br>
ControlPlayback(${filename},60000,3,1,*#2456790,,,o(${position}));<br>
Set(position=${CPLAYBACKOFFSET});<br>
<br>
if (${CPLAYBACKSTATUS}==ERROR) {<br>
Playback(pbx_error_500);<br>
Playback(pbx_endcall);<br>
Wait(2);<br>
Hangup(); <br>
} <br>
<br>
//If stopped by user<br>
if (${CPLAYBACKSTATUS}==USERSTOPPED) {<br>
if (!${ISNULL(${CPLAYBACKSTOPKEY})}) { goto
${CPLAYBACKSTOPKEY},1; }<br>
}<br>
}<br>
}<br>
<br>
recording_end => {<br>
//The end of the recording is reached<br>
Set(position=0);<br>
Background(pbx_endcall);<br>
WaitExten(2);<br>
Hangup(); <br>
}<br>
<br>
1 => {<br>
Set(position=$[${position}-60000]); //Rewind 1 minute<br>
goto play,1;<br>
}<br>
<br>
2 => {<br>
//Instructions, that could be aborted with 2.<br>
//1 and 3 could be used to forward/rewind 0 ms effectivly
disabling the defalut..<br>
ControlPlayback(conf_playrec_instructions_full,0,1,3,2); <br>
Wait(1);<br>
goto play,1; <br>
}<br>
<br>
3 => {<br>
Set(position=$[${position}+60000]); //Forward 1 minute<br>
goto play,1;<br>
}<br>
<br>
4 => {<br>
Set(position=$[${position}-300000]); //Rewind 5 minutes<br>
goto play,1;<br>
}<br>
<br>
5 => {<br>
goto conference_play_recordings_conference_paused, announce,
1; //Pause<br>
}<br>
<br>
6 => {<br>
Set(position=$[${position}+300000]); //Forward 5 minutes<br>
goto play,1;<br>
}<br>
<br>
7 => {<br>
Set(position=$[${position}-900000]); //Rewind 15 minutes<br>
goto play,1;<br>
}<br>
<br>
9 => {<br>
Set(position=$[${position}+900000]); //Forward 15 minutes<br>
goto play,1;<br>
}<br>
<br>
0 => {<br>
goto playrec_intro,1; //Restart playback of the current
recording<br>
}<br>
<br>
* => {<br>
//Previous recording<br>
//If no recording found, resume playback<br>
goto play,1;<br>
}<br>
<br>
# => {<br>
//Next recording<br>
//If no recording found, resume playback<br>
goto play,1;<br>
}<br>
<br>
i => {<br>
goto play,1;<br>
}<br>
<br>
}<br>
<br>
context conference_play_recordings_conference_paused {<br>
announce => {<br>
Set(time=$[${epoch_start}+${position}/1000]);<br>
while(true) {<br>
WaitExten(1);<br>
Background(conf_playrec_pause_part1);<br>
SayUnixTime(${time},${tz},kM);<br>
Background(conf_playrec_pause_part2);<br>
SayUnixTime(${time},${tz},d 'digits/of' B);<br>
Background(conf_playrec_pause_part3);<br>
WaitExten(5);<br>
}<br>
}<br>
<br>
i => {<br>
//Every inputs goes here<br>
Wait(1);<br>
goto conference_play_recordings_conference_connect,play,1;<br>
}<br>
}<br>
<br>
<br>
<blockquote
cite="mid:BANLkTi=KrrfNgwe-yzZqXSQKtG1Lf7EDTg@mail.gmail.com"
type="cite">
<div dir="ltr"> <br>
<div dir="ltr"><br>
-----<br>
Thanks and regards<br>
<br>
Virendra Bhati<br>
+91-9172341457<br>
Asterisk Engineer<br>
</div>
<br>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by <a class="moz-txt-link-freetext" href="http://www.api-digital.com">http://www.api-digital.com</a> --
New to Asterisk? Join us for a live introductory webinar every Thurs:
<a class="moz-txt-link-freetext" href="http://www.asterisk.org/hello">http://www.asterisk.org/hello</a>
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
<a class="moz-txt-link-freetext" href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a></pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Med vänlig hälsning
Johan Wilfer email: <a class="moz-txt-link-abbreviated" href="mailto:johan@jttech.se">johan@jttech.se</a>
JT Tech | Utvecklare webb: <a class="moz-txt-link-freetext" href="http://jttech.se">http://jttech.se</a>
direkt: +46 31 380 91 01 support: +46 31 380 91 00
</pre>
</body>
</html>