[asterisk-users] Asterisk as an IVR

Steve Edwards asterisk.org at sedwards.com
Tue Jul 1 14:28:28 CDT 2008


On Tue, 1 Jul 2008, research at businesstz.com wrote:

> Can someone assist to unfold the secret on how to atleast to a count on
> particular branch, say, if 2 is chosen, then we start count from the time
> the choice is made to the time the caller hangup or choice another option
>
> i.e.
> exten => s,1,Answer()
> exten => s,n,Background(PLEASE ENTER YOU OPTION)
>
> exten => s,n,XXX ; //IS IT POSSIBLE TO START A STOPWATCH (COUNTER) HERE
> exten => s,n,WaitExten(10)
> exten => s,n,Goto(s,1)
>
> exten => 1,1,Answer()
> exten => 1,n,AGI(POPULATE PREVIOUS BRANCH DATA INTO THE DB)
> exten => 1,n,XXX ;(RE)START A COUNTER HERE
> exten => 1,n,PLAYBACK(OPTION1 SELECTED);(RE)START A COUNTER HERE
> exten => 1,n,Hangup
>
> exten => 2,1,Answer()
> exten => 2,n,AGI(POPULATE PREVIOUS BRANCH DATA INTO THE DB)
> exten => 2,n,XXX ;(RE)START A COUNTER HERE
> exten => 2,n,PLAYBACK(OPTION2 SELECTED);(RE)START A COUNTER HERE
> exten => 2,n,Hangup

You could "start" your stopwatch with

 	exten = s,n,			set(STOPWATCH=${EPOCH})

instead of your extraneous answer()s and then in your "h" extension, stop 
the stopwatch with:

 	exten = h,n,			set(STOPWATCH=$[${EPOCH} - ${STOPWATCH}])

You could also use resetcdr(w) at the start of each option. This will 
create a new CDR with the time spent on the previous option at each step 
in your dialplan. By setting the option number in a CDR variable after 
each CDR is written, the time spent in each option can be identified.

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list