All calls go to single extension

Hi, I have an asterisk-15.3.0 install on fedora28 and just realized I have a problem with how extensions are routed. I had made some changes quite some time ago to avoid having a “catch all” mailbox people would end up in when they don’t choose an extension.

It appears now that any attempt to dial an extension results in all calls being redirected to extension 7000. This also occurs after just dialing 700. It’s not even necessary to dial the last digit.

What could I possibly have done wrong?

[local]
exten           =>  7000,1,Macro(stdexten,SIP/7003,7003)
exten           =>  7003,1,Macro(stdexten,SIP/7003,7003)
exten           =>  7004,1,Macro(stdexten,SIP/7004,7004)

exten           =>  8000,1,Goto(incoming,s,1)
exten           => _8XXX,1,Playback(invalid)
exten           => _8XXX,2,Goto(incoming,s,1)

exten           => _9XXX,1,Playback(invalid)
exten           => _9XXX,2,Goto(incoming,s,1)

exten           => *86,1,Answer 
exten           => *86,2,Wait(.5)
exten           => *86,3,VoicemailMain(@local)
exten           => *86,4,Hangup

exten           => *87,1,Answer 
exten           => *87,2,Wait(.5)
exten           => *87,3,VoicemailMain(${CALLERID(num)}@local)
exten           => *87,4,Hangup

exten           => 9,1,Set(CALLERID(all)=9 - ${CALLERID(name)} <${CALLERID(num)}>)
exten           => 9,2,Directory(local)
exten           => 9,3,Hangup
exten           => h,1,Hangup
exten           => i,1,Hangup
exten           => t,1,Hangup

[incoming]
exten => s,1,NoOp(CALLERID = ${CALLERID(name)} - ${CALLERID(num)})
 same => n,Set(LoopCount=1) ; Set up your counter
 same => n,Set(TIMEOUT(response=6)
 same => n,Set(TIMEOUT(digit)=2)
 ;same => n,Goto(mainmenu-day,s,1)
 same => n,GotoIfTime(09:00-20:00,mon-fri,*,*?mainmenu-day,s,1)
 same => n,Goto(mainmenu-night,s,1)

[mainmenu-day]
exten => s,1,NoOP()
 same => n,Ringing()
 same => n,Wait(1)      ; ring before IVR starts
 same => n(MENU),Background(local-mainmenu-day)
 same => n,WaitExten(6) ; (3)                  ; Wait for an extension to be dialed.

exten => fax,1,Hangup()

exten => 2,1,Set(CALLERID(all)=2 - ${CALLERID(name)} <${CALLERID(num)}>)
 same => n,Queue(sales,t,,,20)
 same => n,Voicemail(7000@local,b)
 same => n,Hangup()

exten => 3,1,Set(CALLERID(all)=3 - ${CALLERID(name)} <${CALLERID(num)}>)
 same => n,Queue(custservice,t,,,20)
 same => n,Voicemail(7003@local,b)
 same => n,Hangup()

exten => 4,1,Set(CALLERID(all)=4 - ${CALLERID(name)} <${CALLERID(num)}>)
 same => n,Queue(support,t,,,20)
 same => n,Voicemail(7003@local,b)
 same => n,Hangup()

exten => 5,1,Set(CALLERID(all)=5 - ${CALLERID(name)} <${CALLERID(num)}>)
 same => n,Queue(noc,t,,,20)
 same => n,Voicemail(7003@local,b)
 same => n,Hangup()

exten => 6,1,Goto(incoming,s,1)

exten => 7,1,Voicemail(7000@local,b)
 same => n,Hangup()

exten => *86,1,Goto(local,*86,1)

exten => 9,1,Set(CALLERID(all)=9 - ${CALLERID(name)} <${CALLERID(num)}>)
 same => n,Directory(local)
 same => n,Hangup()

exten => i,1,Playback(invalid)
 same => n,Goto(s,MENU)

exten => t,1,Set(LoopCount=${INC(LoopCount)}) ; Increment the counter
 same => n,GotoIf($[${LoopCount} < 2]?s,MENU) ; If we have looped fewer than 2 times jump back to the Menu
 same => n,Playback(goodbye) ; If we have looped 4 times then play Goodbye
 same => n,Hangup() ; Terminate the call

[mainmenu-night]
exten => s,1,NoOP()
 same => n,Ringing()
 same => n,Wait(5)
 same => n,Answer()
 same => n(MENU),Background(local-mainmenu-night)
 same => n,WaitExten(6) ; Remove the below 5 lines to get rid of voicemail at night
 ;same => n,Ringing()
 ;same => n,Wait(2)
 ;same => n,Voicemail(7000@local,u)
 ;same => n,Hangup()

exten => fax,1,Hangup()

exten => 1,1,Goto(enterprise-support-auth,s,1)

exten => 2,1,Set(CALLERID(all)=2 - ${CALLERID(name)} <${CALLERID(num)}>)
 ;same => n,Queue(sales,t,,,20)
 same => n,Voicemail(7000@local,b)
 same => n,Hangup()

exten => 9,1,Set(CALLERID(all)=9 - ${CALLERID(name)} <${CALLERID(num)}>)
 same => n,Directory(local)
 same => n,Hangup

exten => *86,1,Goto(local,*86,1)

exten => i,1,Playback(invalid)
 same => n,Goto(s,MENU)

exten => t,1,Set(LoopCount=${INC(LoopCount)}) ; Increment the counter
 same => n,GotoIf($[${LoopCount} < 2]?s,MENU) ; If we have looped fewer than 3 times jump back to the Menu
 same => n,Playback(goodbye) ; If we have looped 4 times then play Goodbye
 same => n,Hangup() ; Terminate the call

; [enterprise-support]
;
; This is the context for "enterprise emergency service" calls which come in
; after hours.  Calls are only thrown here from the mainmenu-night context.
;
[enterprise-support-auth]
exten           => s,1,Authenticate(/etc/asterisk/enterprise-customers.txt,a)
exten           => s,2,Goto(enterprise-support,s,1)
exten           => s,3,Hangup

exten           => i,1,Hangup
exten           => h,1,Hangup
exten           => t,1,Hangup

[enterprise-support]
exten           => s,1,Voicemail(7999@local,)
exten           => s,2,Hangup

exten           => i,1,Hangup
exten           => h,1,AGI(enterprise-support.agi,1)
exten           => t,1,Hangup

[enterprise-support-callback]
exten           => s,1,Background(local-enterprise-support-callback-dial-7999)
exten           => s,2,Wait(1)
exten           => s,3,Goto(enterprise-support-callback,s,1)
exten           => s,4,Hangup

exten           => i,1,Goto(enterprise-support-callback,s,1)
exten           => *,1,Goto(local,*86,1)

;[incoming-sales]
;exten           => s,1,NoOp(CALLERID = ${CALLERID(name)} - ${CALLERID(num)})
;exten           => s,2,Macro(stdexten,SIP/7004,7004)
;exten           => s,2,Goto(incoming,_1NXXNXXXXXX,1)
;exten           => s,3,Goto(incoming,_1NXXNXXXXXX,1)
;exten           => s,4,Hangup

[invalid]
exten           => s,1,Hangup
exten           => h,1,Hangup
exten           => i,1,Hangup
exten           => t,1,Hangup

;
; [network-outage]
;
; This is the context for "severly critical host or service outage"
; calls which come in via Nagios's escalation facility.
;
[network-outage] 
exten           => s,1,AGI(network-outage.agi,1)
exten           => s,2,Answer
exten           => s,3,Hangup

exten           => i,1,Hangup
exten           => h,1,Hangup
exten           => t,1,Hangup

[network-outage-callback]
exten           => s,1,Background(local-network-outage);
exten           => s,2,Wait(1)
exten           => s,3,Goto(network-outage-callback,s,1)
exten           => s,4,Hangup

;
; [default]
;
; This is the default context that calls will be thrown into if no other
; contexts are matched.  If this even happens, throw them into the main
; "incoming" context to initiate a new incoming call.
;
[default]
exten           => s,1,Goto(incoming,_1NXXNXXXXXX,1)
exten           => h,1,Hangup
exten           => i,1,Hangup
exten           => t,1,Hangup

[trusted]
include         => local
include         => outgoing
;include         => parkedcalls
include         => testing

; Allow people to transfer calls directly into voicemail.
exten           => _*7XXX,1,Answer
exten           => _*7XXX,2,Ringing
exten           => _*7XXX,3,Wait(30)
exten           => _*7XXX,4,Voicemail(${EXTEN:1}@local,u)
exten           => _*7XXX,5,Hangup

; Our ad-hoc intercom ;)
exten           => 8000,1,Set(TIMEOUT(absolute)=21)
exten           => 8000,2,AGI(intercom.agi,${CALLERID(num)})
exten           => 8000,3,Page(${CANDIDATES}) 

; XXX
exten           => h,1,NoOp([trusted] CALL ENDING -- ${STRFTIME(${EPOCH},,%m/%d/%Y - %H:%M:%S)})

;
; [testing]
;
; Miscellaneous testing extensions, this context should be included into
; [trusted] or [local] for debugging.
;
[testing]
exten           => 200,1,Goto(mainmenu-day,_1NXXNXXXXXX,1)
exten           => 201,1,Goto(mainmenu-night,_1NXXNXXXXXX,1)
exten           => 202,1,Goto(incoming,_1NXXNXXXXXX,1)
exten           => 203,1,MusicOnHold()

; Echo test
exten           => 300,1,Answer
exten           => 300,2,Ringing
exten           => 300,3,Wait(1)
exten           => 300,4,Echo
exten           => 300,5,Hangup

; T102 Milliwatt Test Number
exten           => 1102,1,Answer
exten           => 1102,2,Ringing
exten           => 1102,3,Wait(3)
exten           => 1102,4,Milliwatt()
exten           => 1102,5,Hangup

exten           => 31337,1,ChanSpy(SIP,q)
exten           => 31337,2,Hangup

;
; [outgoing]
;
; This is the contxt all OUTGOING calls are place into.  This is our "trunk"
; to VoicePulse Connect! and any other providers.
;
[outgoing]
exten           => h,1,Hangup
exten           => i,1,Hangup
exten           => t,1,Hangup

;
; If the call is prefixed with an '8', then record it.
;
exten   => _81NXXNXXXXXX,1,Set(CALLFILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${EXTEN}-${CALLERIDNUM}-${EXTEN:1})
exten   => _81NXXNXXXXXX,2,Monitor(wav,${CALLFILENAME},m)
exten   => _81NXXNXXXXXX,3,Goto(outgoing,${EXTEN:1},1);

;
; If the call is prefixed with an '9', then don't send Caller*ID.
;
exten   => _91NXXNXXXXXX,1,AGI(make-outgoing.agi,${CALLERID(num)},${EXTEN})
;exten  => _91NXXNXXXXXX,2,Set(CALLERID(all)=,a)
exten   => _91NXXNXXXXXX,2,Set(CALLERID(all)=)
exten   => _91NXXNXXXXXX,3,Goto(outgoing,_1NXXNXXXXXX,3);

;
; Domestic Calls
;
exten   => _1NXXNXXXXXX,1,AGI(make-outgoing.agi,${CALLERID(num)},${EXTEN})
exten   => _1NXXNXXXXXX,2,Set(CALLERID(all)=12019637300)
exten   => _1NXXNXXXXXX,3,NoOp([outgoing] STARTING -- ${STRFTIME(${EPOCH},,%m/%d/%Y - %H:%M:%S)})
exten   => _1NXXNXXXXXX,4,Dial(DAHDI/${CHANNEL_OV}/${DIAL_OV})
; exten => _1NXXNXXXXXX,5,Dial(SIP/+${DIAL_VP}@${VOICEPULSE_TRUNK01})
; exten => _1NXXNXXXXXX,6,Dial(SIP/+${DIAL_VP}@${VOICEPULSE_TRUNK01})
exten   => _1NXXNXXXXXX,7,Congestion

;
; International Calls
;
exten   => _011.,1,Set(CALLERID(all)=12019637300)
; exten => _011.,2,Dial(SIP/+${EXTEN:3}@${VOICEPULSE_TRUNK01})
; exten => _011.,3,Dial(SIP/+${EXTEN:3}@${VOICEPULSE_TRUNK02})
exten   => _011.,4,Congestion

Assuming you start in the incoming context, and it is day time, it will end up in main menu day, and will try to read an extension matching one in that context. There is nothing more than three digits in that context, and there are no extensions beginning with a a numeric digit of more than one digit.

As a result, as soon as 7 is dialled, it will end up on:

exten => 7,1,Voicemail(7000@local,b)

I have no idea how to fix this. Do I need to loop back to [local] to cycle through the available extensions? This is the threat that you helped me with back in Jan where I was having a problem with calls (and faxes, mostly) going directly to the general mailbox instead of being forced to pick an extension. Now, it seems the extensions are broken entirely.

You would need to include the local context in the IVR contexts. However, even then I’m not sure that it would cope with an option which was the prefix digits of another extension, as I think it only follows includes if there is no match.

In any case if the 7 option is really a catch-all for unknown extensions, it should be “_7.”

Hi, the 7 option is supposed to be a prefix to the extensions. Our extensions are 700X.

The problem was that previously when a caller didn’t enter an extension, it would just go into a general mailbox. You helped me solve that in January, but now for some reason every attempt at dialing an extension results in all calls going into the general mailbox, before even the full extension is dialed.

I need people to be able to reach specific internal people by extension, obviously.

That’s because they are matching “7” in a context that doesn’t have anything longer than that beginning with 7.

You need to go to the sample configuration and understand how context inclusions and patterns work.

Hi, I think I figured it out. Thanks for your help. The examples provided with asterisk are entirely too complicated, however. They’re not even working examples.

I did need to import the macro-stdexten to my existing extensions.conf as well as a this in the mainmenu-day dialplan(?)

exten           => _7XXX,1,Macro(stdexten,SIP/${EXTEN},${EXTEN})

Thanks again.

If you can’t understand the examples, you probably need to hire a consultant. Generally free consultancy is going to be limited to saying what is wrong and pointing you to suitable resources.