[asterisk-users] Need help with my dial plan - general logic flaws

Ivan Demkovitch idemkovitch at yahoo.com
Sat Mar 12 15:09:00 CST 2016


Hello group, 

I’m developer myself but creating dial plans is little bit different I guess :) 
I created very simple automated attendand (with a help of book), below is code. 
But logic is simple:

Depending on time - I want:
If during business hours - give them menu and handle extensions
If after hours - give them message and take to voicemail.

This dial plan accomplishes just that.

What I don’t like is side behavior of this plan
	When after hours - I can still press 1/2/3 and go into Sales/Support queue or to operator, etc.
It’s probably OK to allow dialing of extensions of actual users (101, 102, etc)
But I don’t want them to dial operator (0) or 1,2,3 and such.

How do I fix it?

Thank you!
Ivan







[automated_attendant]

exten => fax,1,Goto(fax_incoming,fax,1)

exten => s,1,Verbose(1, Caller ${CALLERID(all)} has entered the auto attendant)
       same => n,Answer()
       same => n,Set(TIMEOUT(digit)=2)         ;this sets the inter-digit timer
       same => n,Wait(1)                       ;wait 1 sec to establish audio
       same => n(menustart),GotoIfTime(9:00-17:00,mon-fri,*,*?daygreeting:afterhoursgreeting)     ;depending if it's work time or not go to labels

       same => n(afterhoursgreeting),Background(/etc/asterisk/automated-attendant-prompts/ditat_afterhour_greeting)         ; after hours greeting
       same => n,VoiceMail(99 at default,u)
       same => n,Hangup()

       same => n(daygreeting),Background(/etc/asterisk/automated-attendant-prompts/ditat_main_greeting)                  ; day greeting
       same => n,WaitExten(4)                                          ; wait 4 sec max before give up
       same => n,Goto(0,1)                                             ; treat as caller pressed '0'

exten => 1,1,Verbose(1, Caller ${CALLERID(all)} has entered the sales queue)
       same => n,Goto(Queues,7001,1)                                   ; Sales Queue

exten => 2,1,Verbose(1, Caller ${CALLERID(all)} has entered the support queue)
       same => n,Goto(Queues,7002,1)                                   ; Support Queue

exten => 3,1,Verbose(1, Caller ${CALLERID(all)} has entered the support queue via Other extension)
       same => n,Goto(Queues,7002,1)                                   ; Support Queue

exten => 0,1,Verbose(1, Caller ${CALLERID(all)} wants an operator)
       same => n,Goto(internal,101,1)

exten => i,1,Verbose(1, Caller ${CALLERID(all)} has entered an invalid selection)
       same => n,Playback(invalid)
       same => n,Goto(s,menustart)

exten => t,1,Verbose(1, Caller ${CALLERID(all)} has timed out)
       same => n,Goto(0,1)

; ------ CALLING EXTENSIONS DIRECTLY -----------------
exten => _1XX,1,Verbose(1,Call to an extension starting with '1')
       same => n,Goto(internal,${EXTEN},1)


More information about the asterisk-users mailing list