<!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-06-04 13:38, virendra bhati wrote:
<blockquote
cite="mid:BANLkTi=e=tN10_NXVif5-vRvP9GXNjXkbg@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Johan Wilfer,<br>
<br>
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.<br>
in below context what's ${tz} ? Is this time zone value or
else?<br>
</div>
</blockquote>
Yes, I store the calls timezone in tis variable before the code
sample you got.<br>
<br>
<blockquote
cite="mid:BANLkTi=e=tN10_NXVif5-vRvP9GXNjXkbg@mail.gmail.com"
type="cite">
<div dir="ltr">
and another things is what is the use of <span style="color:
rgb(0, 102, 0);">SayUnixTime(${time},${tz},d 'digits/of' B);</span><br>
this function in such case?<br>
</div>
</blockquote>
<br>
I've implemented 5 as a pause-button on the phone. This context
handles this by playing a <br>
prompt that you have pause the recording and <time> and
<date>.<br>
<br>
This is repeated untill the user presses a key on the keypad.<br>
<blockquote
cite="mid:BANLkTi=e=tN10_NXVif5-vRvP9GXNjXkbg@mail.gmail.com"
type="cite">
<div dir="ltr"><br>
context conference_play_recordings_
<div bgcolor="#ffffff">
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>
}</div>
<br>
one thing which is also confusing is that what is the meaning or
use of such lines in this application.<br>
<br>
<span style="color: rgb(0, 102, 0);">ControlPlayback(${filename},60000,3,1,*#2456790,,,o(${position}))</span><br>
</div>
</blockquote>
${filename} is the file you want to play.<br>
60000 is 60 seconds to skip.<br>
3 is to use 3 as forward 60 seconds<br>
1 to to use 1 as rewind 60 seconds<br>
*#2456790 is used as stop buttons (and handled by the dialplan)<br>
o() is a option to go to a specific position in the file<br>
${position} is the variable that hold the current position of the
playback.<br>
<br>
To get more details use the following command:<br>
asterisk*CLI> core show application ControlPlayback<br>
<br>
Displays:<br>
-= Info about application 'ControlPlayback' =- <br>
<br>
[Synopsis]<br>
Play a file with fast forward and rewind. <br>
<br>
[Description]<br>
This application will play back the given <filename>.<br>
It sets the following channel variables upon completion:<br>
${CPLAYBACKSTATUS}: Contains the status of the attempt as a text
string<br>
SUCCESS<br>
USERSTOPPED<br>
ERROR<br>
${CPLAYBACKOFFSET}: Contains the offset in ms into the file where
playback<br>
was at when it stopped. '-1' is end of file.<br>
${CPLAYBACKSTOPKEY}: If the playback is stopped by the user this
variable<br>
contains the key that was pressed.<br>
<br>
[Syntax]<br>
ControlPlayback(filename[,skipms[,ff[,rew[,stop[,pause[,restart[,options]]]]]]])<br>
<br>
[Arguments]<br>
skipms<br>
This is number of milliseconds to skip when rewinding or fast-fo<br>
rwarding.<br>
ff<br>
Fast-forward when this DTMF digit is received. (defaults to '#')<br>
rew<br>
Rewind when this DTMF digit is received. (defaults to '*')<br>
stop<br>
Stop playback when this DTMF digit is received.<br>
pause<br>
Pause playback when this DTMF digit is received.<br>
restart<br>
Restart playback when this DTMF digit is received.<br>
options<br>
o(time): <br>
time - Start at <time> ms from the beginning of the<br>
file.<br>
<br>
[See Also]<br>
Not available<br>
<br>
<br>
/Johan<br>
<blockquote
cite="mid:BANLkTi=e=tN10_NXVif5-vRvP9GXNjXkbg@mail.gmail.com"
type="cite">
<div dir="ltr">
<br>
Please put some light on these too.<br>
<br>
<div class="gmail_quote">On Wed, Jun 1, 2011 at 1:50 AM, Johan
Wilfer <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:lists@jttech.se">lists@jttech.se</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff">
<div class="im"> On 2011-05-30 14:32, virendra bhati
wrote:
<blockquote 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>
</div>
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 type="cite">
<div class="im">
<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>
</div>
<pre><fieldset></fieldset>
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by <a moz-do-not-send="true" href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --
New to Asterisk? Join us for a live introductory webinar every Thurs:
<a moz-do-not-send="true" href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a>
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
<a moz-do-not-send="true" href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></pre>
</blockquote>
<br>
<br>
<pre cols="72">--
Med vänlig hälsning
Johan Wilfer email: <a moz-do-not-send="true" href="mailto:johan@jttech.se" target="_blank">johan@jttech.se</a>
JT Tech | Utvecklare webb: <a moz-do-not-send="true" href="http://jttech.se" target="_blank">http://jttech.se</a>
direkt: +46 31 380 91 01 support: +46 31 380 91 00
</pre>
</div>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a
moz-do-not-send="true" href="http://www.api-digital.com"
target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar
every Thurs:<br>
<a moz-do-not-send="true"
href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a moz-do-not-send="true"
href="http://lists.digium.com/mailman/listinfo/asterisk-users"
target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div dir="ltr"><br>
<br>
<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>