[Fixed]Troubleshooting: Sorry that is not valid extension

I am having problem with calling particular extension from any phone where response is always:
"Sorry that is not a valid extension, please try again."
Version is Asterisk 1.4.26.3 (on Debian 5.0.3 - 2.6.26-2-686)
Protocol in use is SIP.
Other info:
-Tried different phones (SNOM 320) - same
-Phone registers properly and I CAN initiate call from that extension
-If I purposely call some non-existent extension I can see log ( /var/log/asterisk/messages) entry but no logs for problematic extension whatsoever.
-Extension is configured exactly the same as all other ones in sip.conf
-Extension can be seen when “sip show peers” is invoked

I am running out of ideas :frowning:

I would appreciate any hint or advice how can I troubleshoot this.
Thanks!

sip.conf:

[1020] ; Spare type=friend username=1020 secret= callerid=SIP/1020 host=dynamic context=from-sip limitonpeers=yes call-limit=100 canreinvite=yes vmexten=VoiceMail allowsubscribe=yes mailbox=1020@employees

extensions.conf

[code][general]
;------------------------------------------------------------------
[macro-CF]
;Call Forwarding
exten => s,1,Set(CF=${DB(CFI/${ARG1})})
exten => s,n,GotoIf(${CF}?yes:no)
exten => s,n(yes),Goto(from-sip,${CF},1)
exten => s,n(no),NoOp()

[macro-FM]
;Follow Me
;ARG1=EXTEN,ARG2=CALLERIDNUM
exten => s,1,Gotoif(${DB_EXISTS(FME/${ARG1})}?yes:no)
exten => s,n(yes),Set(CALLERID(num)=${ARG2})
exten => s,n,Goto(from-sip,${DB(FME/${ARG1})},1)
exten => s,n(no),Set(CALLERID(num)=${ARG2})

[globals]
;------------------------------------------------------------------
CMD_REBOOT_SNOMS=/etc/asterisk/rebootallsnoms.sh

[from-pstn]
;------------------------------------------------------------------
exten => s,1,Goto(from-pstn2,${EXTEN},1)

[from-pstn2]
include => ext-employees
include => ext-special
include => ext-management

include => welcome-holiday|||24-31|dec
include => welcome-holiday|||1-3|jan

include => welcome-opened|08:00-17:29|mon-fri||

include => welcome-closed|17:30-07:59|mon-fri||
include => welcome-closed||sat-sun||*

exten => i,1,Playback(invalid)
exten => i,n,Goto(main,1)

;External ringtone
exten => _10XX,2,SIPAddHeader(“Alert-Info:<http://192.168.1.2/external.wav”)

;All incoming calls enter this extension
exten => s,1,Goto(main,1)

exten => main,1,Answer()
exten => main,2,Gotoif(${DB_EXISTS(VM/CUSTOM)}?yes:no)
exten => main,3(yes),Background(welcome${DB(VM/CUSTOM)})
exten => main,4,Goto(7)
exten => main,6,Goto(7)
exten => main,7,WaitExten(60)
exten => main,n,Playback(invalid)
exten => main,n,Hangup()

exten => 0,1,VoiceMail(1099@employees)
exten => 0,n,Hangup()

exten => #,1,Directory(employees,ext-employees)
exten => #,n,Hangup()

[welcome-opened]
exten => main,5(no),Background(welcome1)
[welcome-closed]
exten => main,5(no),Background(welcome2)
[welcome-holiday]
exten => main,5(no),Background(welcome3)

[from-iax]
;------------------------------------------------------------------
exten => _.,1,Goto(from-iax2,${EXTEN},1)

[from-iax2]
include => ext-employees
include => ext-special
include => ext-outgoing

exten => i,1,Answer()
exten => i,n,Playback(invalid)
exten => i,n,Hangup()

;Internal ringtone for employees
exten => _10XX,2,SIPAddHeader(“Alert-Info:<http://192.168.1.2/internal.wav”)

[from-sip]
;------------------------------------------------------------------
;TEMP
exten => #66,1,Answer()
exten => #66,n,Set(TMP=${UNIQUEID})
exten => #66,n,Record(/rec/${TMP}.wav,5,300)
exten => #66,n,Playback(beep)
exten => #66,n,Playback(/rec/${TMP})
exten => #66,n,Hangup()
;--------------------
exten => _.,1,Goto(from-sip2,${EXTEN},1)

[from-sip2]
include => ext-employees ;10XX
include => ext-special ;1[2-4]XX
include => ext-management ;15XX
include => ext-emergency ;911
include => ext-outgoing ;9.
include => pbx-features ;*.
include => ext-iax ;#.

exten => i,1,Answer()
exten => i,n,Playback(invalid)
exten => i,3,Hangup()

;Internal ringtone for employees
exten => _10XX,2,SIPAddHeader(“Alert-Info:<http://192.168.1.2/internal.wav”)

[ext-iax]
;-----------------------------------------------------------------
exten => _#XXX,1,Dial(IAX2/asterisk-ls/${EXTEN:1})
exten => _#XXX,n,Gotoif($["${DIALSTATUS}" = “CHANUNAVAIL”]?err:end)
exten => _#XXX,n(err),Playback(err-noiax)
exten => _#XXX,n(end),Hangup()

;SAS Paris
;exten => _#85XX,1…

[ext-employees]
;------------------------------------------------------------------
exten => _10XX,1,Macro(CF,${EXTEN})
;Priority 2 is ringtone, defined in some contexts which include this one
exten => _10XX,n,LDAPget(CALLERID(name)=cidname)
exten => _10XX,n,Dial(SIP/${EXTEN},30,tTwWkK)
exten => _10XX,n,Noop(Dialstatus is ${DIALSTATUS})
exten => _10XX,n,Gotoif($["${DIALSTATUS}" = “NOANSWER”]?follow)
exten => _10XX,n,Gotoif($["${DIALSTATUS}" = “BUSY”]?busy)
exten => _10XX,n,Gotoif($["${DIALSTATUS}" = “CHANUNAVAIL”]?invalid:unavailable)

exten => _10XX,n(follow),Macro(FM,${EXTEN},${CALLERID(num)})
exten => _10XX,n,Goto(unavailable)

exten => _10XX,n(busy),VoiceMail(${EXTEN}@employees,b)
exten => _10XX,n,Hangup()

exten => _10XX,n(unavailable),VoiceMail(${EXTEN}@employees,u)
exten => _10XX,n,Hangup()

exten => _10XX,n(invalid),Playback(invalid)
exten => _10XX,n,Hangup()

[ext-outgoing]
;------------------------------------------------------------------
exten => _9.,1,Dial(DAHDI/g0/${EXTEN:1})

[ext-emergency]
;------------------------------------------------------------------
exten => 911,1,Dial(DAHDI/g0/911)

[menu-wm]
;------------------------------------------------------------------
exten => i,1,Goto(s,1)

exten => s,1,Answer()
exten => s,n,Playback(entercode)
exten => s,n,Read(PIN,4)
exten => s,n,Gotoif($["${PIN}" = “xxxx”]?menu-wm-main,s,1:end)
exten => s,n(end),Playback(invalid)
exten => s,n,Hangup()

[menu-wm-main]
exten => i,1,Goto(s,1)

exten => s,1,Background(menu-wm-main)
exten => s,n,WaitExten(60)
exten => s,n,Hangup()

exten => 1,1,Goto(menu-wm-play,s,1)

exten => 2,1,Goto(menu-wm-rec,s,1)

exten => 3,1,Goto(menu-wm-set,s,1)

[menu-wm-play]
exten => i,1,Goto(s,1)

exten => s,1,Background(menu-wm-qplay)
exten => s,n,Background(menu-wm-list)
exten => s,n,Background(menu-back)
exten => s,n,WaitExten(30)
extem => s,n,Playback(invalid)
exten => s,n,Hangup()

exten => *,1,Goto(menu-wm-main,s,1)

exten => 0,1,Goto(s,1)

exten => _[1-4],1,Playback(beep)
exten => _[1-4],n,Playback(welcome${EXTEN})
exten => _[1-4],n,Playback(beep)
exten => _[1-4],n,Goto(s,1)

[menu-wm-rec]
exten => i,1,Goto(s,1)

exten => s,1,Background(menu-wm-qrec)
exten => s,n,Background(menu-wm-list)
exten => s,n,Background(menu-back)
exten => s,n,WaitExten(30)
exten => s,n,Playback(invalid)
exten => s,n,Hangup()

exten => *,1,Goto(menu-wm-main,s,1)

exten => 0,1,Goto(s,1)

exten => _[1-4],1,Playback(sayafterbeep)
exten => _[1-4],n,Record(/var/lib/asterisk/sounds/welcome${EXTEN}.wav,5)
exten => _[1-4],n,Wait(1)
exten => _[1-4],n,Playback(messagerecorded)
exten => _[1-4],n,Goto(s,1)

[menu-wm-set]
exten => i,1,Goto(s,1)

exten => s,1,Background(menu-wm-setlist)
exten => s,n,Background(menu-back)
exten => s,n,WaitExten(30)
exten => s,n,Hangup()

exten => *,1,Goto(menu-wm-main,s,1)

exten => _[1-4],1,Set(DB(VM/CUSTOM)=${EXTEN})
exten => _[1-4],n,SayAlpha(OK)
exten => _[1-4],n,Goto(1)

exten => 0,1,Noop(${DB_DELETE(VM/CUSTOM)})
exten => 0,n,SayAlpha(OK)
exten => 0,n,Goto(s,1)

[pbx-features]
;------------------------------------------------------------------
;Call forwarding, activate
exten => _*6X.,1,Answer()
exten => _*6X.,2,Set(DB(CFI/${CALLERID(NUM)})=${EXTEN:2})
exten => _*6X.,n,Playback(cf-activated)
exten => _*6X.,n,SayDigits(${EXTEN:2})
exten => _*6X.,n,Hangup()

;Call forwaring, deactivate
exten => *6,1,Answer()
exten => *6,n,NoOp(${DB_DELETE(CFI/${CALLERID(num)})})
exten => *6,n,Playback(cf-deactivated)
exten => *6,n,Hangup()

;Follow me, activate
exten => _*7X.,1,Answer()
exten => _*7X.,n,Set(DB(FME/${CALLERID(num)})=${EXTEN:2})
exten => _*7X.,n,Playback(fm-activated)
exten => _*7X.,n,SayDigits(${EXTEN:2})
exten => _*7X.,n,Hangup()

;Follow me, deactivate
exten => *7,1,Noop(${DB_DELETE(FME/${CALLERID(num)})})
exten => *7,n,Playback(fm-deactivated)
exten => *7,n,Hangup()

;Pickup ringing extension
exten => _*8X.,1,Pickup(${EXTEN:2})

[ext-special]
;-------------------------------------------------------------------
;VoiceMail
exten => 1200,1,VoiceMailMain(@employees)
exten => 1200,n,Hangup()
exten => VoiceMail,1,Goto(1200,1)

;Conferences
exten => _130X,1,Answer()
exten => _130X,n,Wait(1)
exten => _130X,n,MeetMe(${EXTEN},DM1)
exten => _130X,n,Hangup()

;Parking
exten => _140Z,1,ParkedCall(${EXTEN})
exten => _140Z,n,Hangup()

[ext-management]
;-------------------------------------------------------------------
;Welcome message menu
exten => 1501,1,Goto(menu-wm,s,1)

;Reboot all Snoms
exten => 1502,1,Goto(reboot-snoms,s,1)

[reboot-snoms]
;-------------------------------------------------------------------
exten => s,1,Answer()
exten => s,n,Playback(enter-PIN)
exten => s,n,Read(PIN,4)
exten => s,n,Gotoif($["${PIN}" = “xxxx”]?ok:end)
exten => s,n(ok),Noop(PIN is OK, will reset all Snom phones now)
exten => s,n,System(${CMD_REBOOT_SNOMS})
exten => s,n,SayAlpha(OK)
exten => s,n(end),Hangup()

[blf]
;-------------------------------------------------------------------
exten => 1000,hint,SIP/1000
exten => 1006,hint,SIP/1006
exten => 1007,hint,SIP/1007
exten => 1010,hint,SIP/1010
exten => 1012,hint,SIP/1012
exten => 1013,hint,SIP/1013
exten => 1023,hint,SIP/1023
[/code]

Logs? In particular, sip set debug on output.

Figured what was the problem :smile:. Extension has been forwarded to non-existent extension.
Have to say that I am beginner with asterisk (inherited when joined company)
Steps how I figured:
-Checked “database show” command which showed some additional entry for “problematic” extension:

/CFI/1020 : 33 /FME/1020 : 000
-performed “grep CFI *” and “grep FME *” in /etc/asterisk/ to see where are those entry coming from
-found that in extensions.conf I have _*7X.,n,Set(DB(FME/${CALLERID(num)})=${EXTEN:2}) and *6X.,2,Set(DB(CFI/${CALLERID(NUM)})=${EXTEN:2}) respectively
-tried functions from different phone *6 (*7) and got response that those are “follow me” and “forward” options.
-used “*6” and “*7” to remove feature from that extension and “voila”

Strangely in phone’s web interface usually I can see if forwarding was enabled but not in this case.

Cheers.