On 2011-06-04 13:38, virendra bhati wrote:
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?
Yes, I store the calls timezone in tis variable before the code sample
you got.
and another things is what is the use of SayUnixTime(${time},${tz},d
'digits/of' B);
this function in such case?
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 <time> and <date>.
This is repeated untill the user presses a key on the keypad.
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}))
${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 <filename>.
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 <time> ms from the beginning of the
file.
[See Also]
Not available
/Johan
Please put some light on these too.
On Wed, Jun 1, 2011 at 1:50 AM, Johan Wilfer <[email protected]
<mailto:[email protected]>> wrote:
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
----
context conference_play_recordings_conference_connect {
playrec_intro => {
Set(position=0);
goto play,1;
}
play => {
while (true) {
if (${position}==-1) { goto recording_end,1; }
//rewind 5 seconds after every action (so the user doesn't
feel lost...)
Set(position=$[${position}-5000]);
if (${position} < 0) { Set(position=0); }
ControlPlayback(${filename},60000,3,1,*#2456790,,,o(${position}));
Set(position=${CPLAYBACKOFFSET});
if (${CPLAYBACKSTATUS}==ERROR) {
Playback(pbx_error_500);
Playback(pbx_endcall);
Wait(2);
Hangup();
}
//If stopped by user
if (${CPLAYBACKSTATUS}==USERSTOPPED) {
if (!${ISNULL(${CPLAYBACKSTOPKEY})}) { goto
${CPLAYBACKSTOPKEY},1; }
}
}
}
recording_end => {
//The end of the recording is reached
Set(position=0);
Background(pbx_endcall);
WaitExten(2);
Hangup();
}
1 => {
Set(position=$[${position}-60000]); //Rewind 1 minute
goto play,1;
}
2 => {
//Instructions, that could be aborted with 2.
//1 and 3 could be used to forward/rewind 0 ms effectivly
disabling the defalut..
ControlPlayback(conf_playrec_instructions_full,0,1,3,2);
Wait(1);
goto play,1;
}
3 => {
Set(position=$[${position}+60000]); //Forward 1 minute
goto play,1;
}
4 => {
Set(position=$[${position}-300000]); //Rewind 5 minutes
goto play,1;
}
5 => {
goto conference_play_recordings_conference_paused, announce,
1; //Pause
}
6 => {
Set(position=$[${position}+300000]); //Forward 5 minutes
goto play,1;
}
7 => {
Set(position=$[${position}-900000]); //Rewind 15 minutes
goto play,1;
}
9 => {
Set(position=$[${position}+900000]); //Forward 15 minutes
goto play,1;
}
0 => {
goto playrec_intro,1; //Restart playback of the current
recording
}
* => {
//Previous recording
//If no recording found, resume playback
goto play,1;
}
# => {
//Next recording
//If no recording found, resume playback
goto play,1;
}
i => {
goto play,1;
}
}
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);
}
}
i => {
//Every inputs goes here
Wait(1);
goto conference_play_recordings_conference_connect,play,1;
}
}
-----
Thanks and regards
Virendra Bhati
+91-9172341457
Asterisk Engineer
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided byhttp://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Med vänlig hälsning
Johan Wilfer email:[email protected] <mailto:[email protected]>
JT Tech | Utvecklare webb:http://jttech.se
direkt: +46 31 380 91 01 support: +46 31 380 91 00
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
-----
Thanks and regards
Virendra Bhati
+91-9172341457
Asterisk Engineer
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Med vänlig hälsning
Johan Wilfer email: [email protected]
JT Tech | Utvecklare webb: http://jttech.se
direkt: +46 31 380 91 01 support: +46 31 380 91 00
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users