[split from unrelated thread - mod]
@lgaetz Thanks again for such a quick response.
I have struggled to understand when to use the [from-internal-custom] in the past. I had read your other post (Hooking for Fun and Income) several times and just read it again.
Based on what was just confirmed, I am not sure how to handle the below situation… Maybe it should be a separate question post?
The below solution has seemingly been working fine for quite a while, but now you have me thinking that maybe it’s causing the dialing to bypass our default [from-local] context all together when 6 or 7 digit numbers are dialed.
Background… each of our phone systems uses 3 digit extensions and 4 digit groups. However, we have a network of phone systems that all route through a central “hub”. Each phone system is assigned a unique 3 digit number that is essentially it’s “locator”. When a 6 or 7 digit number is dialed, the custom context appends the correct local “locator” before sending the call to the IAX2 trunk. This ensures that if someone calls back the number on the caller ID, they will call back the correct extension.
[extension_custom.conf]
; Add "Phone System Locator" code to front of extension when another 6 digit
; extension has been dialed.
; This will make "call backs" work correctly when calling from Office to Office
; This has been Set for vPBX-XXX-01 which is: 100
[from-internal-custom]
; Dialed 6 digits (Company Extension - Site Prefix + Destination Extension)
exten => _XXXXXX,1,GotoIf($[${LEN(${CALLERID(num)})} = 3]?setcid:end)
exten => _XXXXXX,n(setcid),NoOp(CUSTOM "from-internal-custom" in /etc/asterisk/extension_custom.conf_)
exten => _XXXXXX,n,NoOp(CUSTOM: 6 digit extension dialed. Changing Caller ID for ${CALLERID(all)} to 100${CALLERID(number)})
exten => _XXXXXX,n,Set(CALLERID(number)=100${CALLERID(number)})
exten => _XXXXXX,n,NoOp(CUSTOM: Caller ID changed to ${CALLERID(all)})
exten => _XXXXXXX,(end)n,NoOp()
; Dialed 7 Digits (Company Groups, Queues etc - Site Prefix + Group/Queue etc Number)
exten => _XXXXXXX,1,GotoIf($[${LEN(${CALLERID(num)})} = 3]?setcid:end)
exten => _XXXXXXX,n(setcid),NoOp(CUSTOM "from-internal-custom" in /etc/asterisk/extension_custom.conf_)
exten => _XXXXXXX,n,NoOp(CUSTOM: 7 digit extension dialed. Changing Caller ID for ${CALLERID(all)} to 100${CALLERID(number)})
exten => _XXXXXXX,n,Set(CALLERID(number)=100${CALLERID(number)})
exten => _XXXXXXX,n,NoOp(CUSTOM: Caller ID changed to ${CALLERID(all)})
exten => _XXXXXXX,(end)n,NoOp()