Dial by Name can't exit

Dial by Name keeps repeating “Enter first 3 letters” when a user isn’t found. Entering a “1” or a “0” has no effect and it just keeps asking for “3 letters”. Can only get out of “Dial by Name” by hanging up.

The voicemail.conf file also has users appearing twice, with the second having a “u” as a prefix. Why and where does this get used?

Thanks for any leads.

extensions.conf:

[lya]
exten => 5,1,Answer()
same => n,Directory(default,lya)
same => n,WaitExten()
same => n,Hangup()

voicemail.conf

[default]
6001 => 1234,mr peanut,mrpeanut@somewhere.com
u6001 => 1234,mr peanut,mrpeanut@somewhere.com

Without seeing the rest of your dialplan it’s hard to say why your users in voicemail.conf are defined that way.

Usually only a single entry is needed.

What version of Asterisk are you using?

Asterisk V13.1

Believe it or not, with this spaghetti code, everything but Directory() is working. I tried to remove comments to shorten the file.

extensons.conf

[general]
static=yes
writeprotect=no

[globals]
CONSOLE=Console/dsp ; Console interface for demo
IAXINFO=guest ; IAXtel username/password
TRUNK=DAHDI/G2 ; Trunk interface
TRUNKMSD=1 ; MSD digits to strip (usually 1 (uses outbound-freenum
; context)

[dundi-e164-customers]
;
; If you are an ITSP or Reseller, list your customers here.
;
;exten => _12564286000,1,Dial(SIP/customer1)
;exten => _12564286001,1,Dial(IAX2/customer2)

[dundi-e164-via-pstn]
;
; If you are freely delivering calls to the PSTN, list them here
;
;exten => _1256428XXXX,1,Dial(DAHDI/G2/${EXTEN:7}) ; Expose all of 256-428
;exten => _1256325XXXX,1,Dial(DAHDI/G2/${EXTEN:7}) ; Ditto for 256-325

[dundi-e164-local]
include => dundi-e164-canonical
include => dundi-e164-customers
include => dundi-e164-via-pstn

[dundi-e164-switch]
switch => DUNDi/e164

[dundi-e164-lookup]
include => dundi-e164-local
include => dundi-e164-switch
[macro-dundi-e164]
exten => s,1,Goto(${ARG1},1)
include => dundi-e164-lookup

[iaxtel700]
exten => _91700XXXXXXX,1,Dial(IAX2/${GLOBAL(IAXINFO)}@iaxtel.com/${EXTEN:1}@iaxtel)

[iaxprovider]

[trunkint]
exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})

[trunkld]
exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1})
exten => _91NXXNXXXXXX,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[trunklocal]
exten => _9NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[trunktollfree]
exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[international]
ignorepat => 9
include => longdistance
include => trunkint

[longdistance]
ignorepat => 9
include => local
include => trunkld

[local]
ignorepat => 9
include => default
include => trunklocal
include => iaxtel700
include => trunktollfree
include => iaxprovider

include => parkedcalls

[outbound-freenum]
exten => _XX!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XX
X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXX!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXX
X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXXXX!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXXXX
X!,1,Goto(outbound-freenum2,${EXTEN},1)

[outbound-freenum2]
exten => _X!,1,Verbose(2,Performing ISN lookup for ${EXTEN})
same => n,Set(SUFFIX=${CUT(EXTEN,*,2-)}) ; make sure the suffix is
same => n,GotoIf($[“${FILTER(0-9,${SUFFIX})}” != “${SUFFIX}”]?fn-CONGESTION,1)

same => n,Set(TIMEOUT(absolute)=10800)
same => n,Set(isnresult=${ENUMLOOKUP(${EXTEN},sip,1,freenum.org)}) ; perform our lookup with freenum.org
same => n,GotoIf($[“${isnresult}” != “”]?from)
same => n,Set(DIALSTATUS=CONGESTION)
same => n,Goto(fn-CONGESTION,1)
same => n(from),Set(__SIPFROMUSER=${CALLERID(num)})
same => n,GotoIf($[“${GLOBAL(FREENUMDOMAIN)}” = “”]?dial) ; check if we set the FREENUMDOMAIN global variable in [global]
same => n,Set(__SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)}) ; if we did set it, then we’ll use it for our outbound dialing domain
same => n(dial),Dial(SIP/${isnresult},40)
same => n,Goto(fn-${DIALSTATUS},1)

exten => fn-BUSY,1,Busy()

exten => _f[n]-.,1,NoOp(ISN: ${DIALSTATUS})
same => n,Congestion()

[macro-trunkdial]
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup()
exten => s-BUSY,1,Hangup()
exten => _s-.,1,NoOp

[stdexten]
exten => _X.,50000(stdexten),NoOp(Start stdexten)
exten => _X.,n,Set(LOCAL(ext)=${EXTEN})
exten => _X.,n,Set(LOCAL(dev)=${ARG1})
exten => _X.,n,Set(LOCAL(cntx)=${ARG2})
exten => _X.,n,Set(LOCAL(mbx)=${ext}${IF($[!${ISNULL(${cntx})}]?@${cntx})})
exten => _X.,n,Dial(${dev},20) ; Ring the interface, 20 seconds maximum
exten => _X.,n,Goto(stdexten-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => stdexten-NOANSWER,1,VoiceMail(${mbx},u) ; If unavailable, send to voicemail w/ unavail announce
exten => stdexten-NOANSWER,n,Return() ; If they press #, return to start

exten => stdexten-BUSY,1,VoiceMail(${mbx},b) ; If busy, send to voicemail w/ busy announce
exten => stdexten-BUSY,n,Return() ; If they press #, return to start

exten => _stdete[n]-.,1,Goto(stdexten-NOANSWER,1) ; Treat anything else as no answer

exten => a,1,VoiceMailMain(${mbx}) ; If they press *, send the user into VoicemailMain
exten => a,n,Return()

[stdPrivacyexten]
exten => _X.,60000(stdPrivacyexten),NoOp(Start stdPrivacyexten)
exten => _X.,n,Set(LOCAL(ext)=${ARG1})
exten => _X.,n,Set(LOCAL(dev)=${ARG2})
exten => _X.,n,Set(LOCAL(dontcntx)=${ARG3})
exten => _X.,n,Set(LOCAL(tortcntx)=${ARG4})
exten => _X.,n,Set(LOCAL(cntx)=${ARG5})

exten => _X.,n,Set(LOCAL(mbx)=“${ext}”$[“${cntx}” ? “@${cntx}” :: “”])
exten => _X.,n,Dial(${dev},20,p) ; Ring the interface, 20 seconds maximum, call screening
; option (or use P for databased call _X.creening)
exten => _X.,n,Goto(stdexten-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => stdexten-NOANSWER,1,VoiceMail(${mbx},u) ; If unavailable, send to voicemail w/ unavail announce
exten => stdexten-NOANSWER,n,NoOp(Finish stdPrivacyexten NOANSWER)
exten => stdexten-NOANSWER,n,Return() ; If they press #, return to start

exten => stdexten-BUSY,1,VoiceMail(${mbx},b) ; If busy, send to voicemail w/ busy announce
exten => stdexten-BUSY,n,NoOp(Finish stdPrivacyexten BUSY)
exten => stdexten-BUSY,n,Return() ; If they press #, return to start

exten => stdexten-DONTCALL,1,Goto(${dontcntx},s,1) ; Callee chose to send this call to a polite “Don’t call again” script.

exten => stdexten-TORTURE,1,Goto(${tortcntx},s,1) ; Callee chose to send this call to a telemarketer torture script.

exten => _stdete[n]-.,1,Goto(stdexten-NOANSWER,1) ; Treat anything else as no answer

exten => a,1,VoiceMailMain(${mbx}) ; If they press *, send the user into VoicemailMain
exten => a,n,Return()

[macro-page]

exten => s,1,ChanIsAvail(${ARG1},s) ; s is for ANY call
exten => s,n,GotoIf($[${AVAILSTATUS} = “1”]?autoanswer:fail)
exten => s,n(autoanswer),Set(_ALERT_INFO=“RA”) ; This is for the PolyComs
exten => s,n,SIPAddHeader(Call-Info: Answer-After=0) ; This is for the Grandstream, Snoms, and Others
exten => s,n,NoOp() ; Add others here and Post on the Wiki!!!
exten => s,n,Dial(${ARG1})
exten => s,n(fail),Hangup()

[demo]

[page]
exten => _X.,1,Macro(page,SIP/${EXTEN})

[public]
include => demo

[default]
include => demo

[time]
exten => _X.,30000(time),NoOp(Time: ${EXTEN} ${timezone})
exten => _X.,n,Wait(0.25)
exten => _X.,n,Answer()
exten => _X.,n,Set(FUTURETIME=$[${EPOCH} + 12])
exten => _X.,n,SayUnixTime(${FUTURETIME},Zulu,HNS)
exten => _X.,n,SayPhonetic(z)
exten => _X.,n,SayUnixTime(${FUTURETIME},${timezone},HNS)
exten => _X.,n,Playback(spy-local)
exten => _X.,n,WaitUntil(${FUTURETIME})
exten => _X.,n,Playback(beep)
exten => _X.,n,Return()

[ani]
exten => _X.,40000(ani),NoOp(ANI: ${EXTEN})
exten => _X.,n,Wait(0.25)
exten => _X.,n,Answer()
exten => _X.,n,Playback(vm-from)
exten => _X.,n,SayDigits(${CALLERID(ani)})
exten => _X.,n,Wait(1.25)
exten => _X.,n,SayDigits(${CALLERID(ani)}) ; playback again in case of missed digit
exten => _X.,n,Return()

[default]

exten => 7010,1,Answer()
same => n,Playback(you-have-reached-admin)
same => n,Macro(voicemail,SIP/7010)
same => n,Hangup()

exten => 100,1,Answer()
same => n,Dial(SIP/100,5)
same => n,Wait(3)
same => n,Playback(this-call-may-be-monitored-or-recorded)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(missed)
same => n,Set(VOLUME(TX)=1)
same => n,Macro(voicemail,SIP/100)
same => n,Playback(goodbye)
same => n,Hangup()

exten => _15085551212,1,Answer()
same => n,wait(2)
same => n,Background(Watson)
same => n,WaitExten()
same => n,Hangup()

exten => 1,1,Set(VOLUME(TX)=3)
same => n,Playback(monty)
same => n,Macro(voicemail,SIP/1)
same => n,Hangup()

exten => 2,1,Playback(sales_message)
same => n,wait(1)
same => n,Dial(SIP/1&SIP/100,4)
same => n,Playback(yourcallisimportant)
same => n,Playback(yourcallisimportant)
same => n,wait(1)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(monty)
same => n,Macro(voicemail,SIP/1)
same => n,Hangup()

exten => 3,1,Playback(tech_message)
same => n,wait(2)
same => n,Dial(SIP/1&SIP/100,4)
same => n,Playback(we-dont-have-tech-support)
same => n,Hangup()

exten => 4,1,Playback(billing_message)
same => n,wait(1)
;same => n,Dial(SIP/3&SIP/100,4)
same => n,Dial(SIP/3,4)
same => n,Playback(you-are-caller-9000)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(monty)
same => n,wait(1)
same => n,macro(voicemail,SIP/3)
same => n,Hangup()

exten => 350,1,Dial(SIP/350,10)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(monty)
same => n,VoiceMail(350)

exten => 14135551212,1,DIAL(SIP/14135551212@Five)
exten => 12035551212,1,Goto(vorhand,12035551212,1)

exten => 200,1,Dial(SIP/350,10)
same => n,FollowMe(200)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(monty)
same => n,VoiceMail(350)

exten => 800,1,Directory(default,default)
;exten => 800,1,Directory(lya,vorhand)

exten => 6001,1,Dial(SIP/6001,10)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(monty)
same => n,VoiceMail(6001)

exten => 6002,1,Dial(SIP/6002,10)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(monty)
same => n,VoiceMail(6002)

exten => 6500,1,VoiceMailMain()

exten => _16175551212,1,Goto(anything,16175551212,1)

exten => _16175551234,1,Goto(vorhand,16175551234,1)

exten => 7000,1,Goto(lya,7000,1)

[vorhand]

exten => 12035551212,1,Answer()
same => n,GoTo(16175551212,demo)

exten => _16175551212,1(demo),Answer()
same => n,Wait(2)
same => n,Set(VOLUME(TX)=3)
same => n,Background(vorhand-main)
same => n,WaitExten()

exten => 1,1,Answer()
same => n,Set(VOLUME(TX)=3)
same => n,Playback(times)
same => n,Playback(goodbye)
same => n,Hangup()

exten => 2,1,Answer()
same => n,wait(1)
same => n,Set(VOLUME(TX)=3)
same => n,FollowMe(dere)
same => n,Playback(leave-message)
same => n,Macro(voicemail,SIP/625)
same => n,Hangup()

exten =>14135551212,1,Dial(SIP/14135551212@Five)

exten => 12035551212,1,Dial(SIP/12035551212@Five)

exten => 3,1,Answer()
same => n,wait(1)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(you-have-reached-admin)
same => n,Macro(voicemail,SIP/100)
same => n,Hangup()

exten => 4,1,Answer()
same => n,wait(1)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(you-have-reached-school)
same => n,Playback(school)
same => n,Macro(voicemail,SIP/100)
same => n,Hangup()

[anything]

exten => _16175551212,1,Answer()
same => n,wait(2)
same => n,Set(VOLUME(TX)=3)
same => n,Background(anything)
same => n,WaitExten()

exten => 1,1,Answer()
same => n,Dial(SIP/350,4)
same => n,wait(1)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(you-have-reached-admin)
same => n,Macro(voicemail,SIP/350)
same => n,Hangup()

exten =>6175551234,1,Dial(SIP/16175551234@Five)

exten => 2,1,Answer()
same => n,Dial(SIP/350,4)
same => n,FollowMe(350)
same => n,Playback(monty)
same => n,VoiceMail(350)
same => n,Hangup()

exten => 3,1,Answer()
same => n,Dial(SIP/1&SIP/350,4)
same => n,wait(1)
same => n,Set(VOLUME(TX)=3)
same => n,Playback(you-have-reached-admin)
same => n,Macro(voicemail,SIP/350)
same => n,Hangup()

[lya]
exten => 7000,1,Answer()
same => n,Background(lya-main)
same => n,WaitExten()
same => n,Hangup()

exten => 1,1,Answer()
same => n,Dial(SIP/7050)
same => n,Playback(lya)
same => n,Macro(Voicemail,SIP/7010)
same => n,Hangup()

exten => 2,1,Answer()
same => n,Dial(SIP/7060)
same => n,Playback(lya-admin)
same => n,Macro(Voicemail,SIP/7010)
same => n,Hangup()

exten => 3,1,Answer()
same => n,Dial(SIP/7070)
same => n,Playback(lya-j)
same => n,Macro(Voicemail,SIP/7010)
same => n,Hangup()

exten => 4,1,Answer()
same => n,Dial(SIP/7080)
same => n,Playback(lya-s)
same => n,Macro(Voicemail,SIP/7010)
same => n,Hangup()

exten => 5,1,Answer()
same => n,Directory(default,lya)
same => n,WaitExten()
same => n,Hangup()

exten => 6,1,Answer()
same => n,Background(lya-staff)
same => n,WaitExten()
same => n,Hangup()

exten => _7XXX,1,Dial(SIP/${EXTEN},10}
same => n,Followme(${EXTEN})
same => n,Macro(voicemail,SIP/${EXTEN})
same => n,Hangup()

[macro-voicemail]
exten => s,1,Dial(${ARG1},20)
exten => s,2,Goto(s-$DIALSTATUS},1)
;exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN},u)
exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN},su)
exten => s-NOANSWER,2,Hangup()
exten => s-BUSY,1,Voicemail(${MACRO_EXTEN},b)
exten => s-BUSY,2,Hangup()
exten => _s-.,1,Goto(s-NOANSWER,1)

I don’t see anywhere in your dialplan that those oddly named voicemail boxes are referenced so I believe it would be safe to remove them from your voicemail.conf

I think the issue with your Directory application may be in the arguments you are passing it

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Directory

You are passing in the context of lya, your users don’t match any extensions in that context.

It looks like your users are 6xxx but the pattern match in the lya context is for 7xxx.

Thanks for the great help.

I thought dialplan problems might prevent the Directory() routine from starting, but once in it, nothing in my dialplan would effect it at that point.

This will take me some time to digest. And then it doesn’t stay with me long.

My fall-back problem solving is random trial and error. You’ve given me a better place to start.

I need those odd names, but I’ll empty everything out and see if I can get things working and then clutter it up again.

The dial context is a neat option to voicemail.

Say you had a school

[k8]
101 => 1234,Teacher 1
102 => 1234,Teacher 2
103 => 1234,Teacher 3
104 => 1234,Teacher 4
105 => 1234,Teacher 5

You have a durying-class and outside class context in your dialplan

[durying-class]

exten => _10x,1,Dial(SIP/FrontOffice,30)
 same => n,Voicemail(${EXTEN}@k8,u)
 same => n,Hangup()

[outside-class]
exten => _10x,1,Dial(SIP/${EXTEN},30)
 same => n,Voicemail(${EXTEN}@k8,u)
 same => n,Hangup()

You could have your Directory() application change where the phonecalls ring to just by changing the context.

[my-ivr]
exten => s,1,Background(main-menu)

exten => 1,1,GotoIfTime(8:00-17:00,mon-fri,*,*,?in-class:out-class)
 same => n(out-class),Directory(k8,outside-class)
 same => n,Hangup()
 same => n(in-class),Directory(k8,durying-class)
 same => n,Hangup()

The teachers wouldn’t get disturbed by the ringing phone while they are teaching because the calls are going to the Front Office and not their phones.