[asterisk-users] GotoIf function

Gopalakrishnan N gopalakrishnan.an at gmail.com
Thu May 23 08:49:03 CDT 2013


Hi,

Actually i would like to get the input from the user and he should not try
more than 3 times, he can try more than 3 times, if yes it will get routed
to the next priority and if not it goes to the loopback again from the
beginning.

And following is the one I created, I just want to know whether this will
validate the input and will allow for 3 times....

exten => s,1,GotoIfTime(08:00-09:00,mon-fri,*,*?2:avgtech,1)
exten => s,n,Background(voicemessage_1)
exten => s,n(voicemessage2),Background(voicemessage_2)

exten => s,n(begin),Set(wait=2)
exten => s,n,Set(gottries=0)
exten => s,n,Read(get,"silence/1",,,,${wait})

exten => s,n(gotnothing),Set(gottries=$[${gottries}+1]
exten => s,n,GotoIf($[${LEN(${get})} == 0]?reallynothing:gotdigit)
exten => s,n(reallynothing),GotoIf($[${gottries}>3]?done:voicemessage5)
exten => s,n(done),Background(voicemessage3)
exten => s,n,Background(voicemessage4)
exten => s,n,Playback(moh)
exten => s,n, ; Addittional messageing
exten => s,n,Queue(general technical team)

exten => s,n(voicemessage5),Goto(voicemessage2)

exten => s,n(gotdigit),Set(got=${get})
exten => s,n,GotoIf( $[ "${got}" = "1"]?doneinstall)
exten => s,n(doneinstall),Background(voicemessage3)
exten => s,n,Background(voicemessage4)
exten => s,n,Playback(moh)
exten => s,n, ; Addittional messageing
exten => s,n,Queue(installation technical skill)

exten => s,n,GotoIf( $[ "${got}" = "2"]?done2)
exten => s,n(done2),Background(voicemessage6)
exten => s,n,Goto(begin2)
exten => s,n(begin2),Set(wait=2)
exten => s,n,Set(gottries=0)
exten => s,n,Read(get,"silence/1",,,,${wait})
exten => s,n(gotnothing),Set(gottries=$[${gottries}+1]
exten => s,n,GotoIf($[${LEN(${get})} == 0]?reallynothing:gotdigit2)
exten => s,n(reallynothing),GotoIf($[${gottries}>3]?done:option2)
exten => s,n(done),Background(voicemessage3)
exten => s,n,Background(voicemessage4)
exten => s,n,Playback(moh)
exten => s,n, ; Addittional messageing
exten => s,n,Queue(general technical skill)

exten => s,n(option2),Background(voicemessage5)
exten => s,n,Goto(done2)

and so on... for digit 3...

Thanks in advance...

Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130523/c08293d0/attachment.htm>


More information about the asterisk-users mailing list