[asterisk-users] Time counting while playback

Jeff LaCoursiere jeff at jeff.net
Mon Mar 15 21:24:50 CDT 2010


On Tue, 16 Mar 2010, Pham Quy wrote:

> Hi all,
>
> This question has been asked for days, I think that would be more
> comprehensible if i post it in a new thread.
>
> What i want to do is something like karaoke. when users call to
> asterisk, a music song is played while caller sings. Their voice
> will be recorded and mixed with the music. To do that i used
> MixMonitor() and Playback() applications.
>
> I also want to enable users to select a part of song to be recorded
> (monitored) for example: Users press '*' to start recording. For
> stopping record, there are two ways: (1) he press '#'to stop recording
> OR it will be stopped (stop MixMonitor) AUTOMATICALLY after 60 seconds.
>
> How can I count down 60s? MixMonitor app doesnt have any time out
> argument.
>
> I detect '#' using Read() app as following
>
> ----------------
> [ivr-test]
> exten => test,1,Answer()
> exten => test,n,Wait(2)
> exten => test,n(prompt),Read(digit,hello-world,1,,3,2)
> exten => test,n,NoOp("Input digit - $[${digit}]")
> exten => test,n,GotoIf($[${digit} = 1]?one,1)
> exten => test,n,GotoIf($[${digit} = #]?sharp,1)
> exten => test,n,GotoIf($["${digit}" = ""]?nokey,1)
> exten => test,n,Goto(prompt)
> exten => test,n,Hangup()
>
> exten => one,1,NoOp(1 pressed)
> exten => one,n,Hangup()
>
> exten => sharp,1,NoOp(You press # )
> exten => sharp,n,HangUp()
>
> exten => nokey,1,NoOp(No key pressed)
> exten => nokey,n,Hangup()
> ---------------
>
> But it couldnt read #, key '#' have recognized as NoKey
>
> ps: sorry for my english
>
> Quyps
>

I think you would be more successful and have more control if you wrote it 
as an AGI.  Then you could set a timer that would interrupt the process 
and you could do what you like from there (hangup?).  I think you are 
asking too much of the dialplan.

j





More information about the asterisk-users mailing list