Good morning,
So I have two trunks from A&A Andrews and Arnold here in the UK, One Trunk is on 01886 and the other Trunk is on 01905, when setting this up, I had problems with routing each of the trunks which is now resolved by using a Custom Dial Plan because both trunks are presented with just s not the proper DID so i did a DID rewrite in the extensions_custom.conf within this configuration i now have working inbound calls to correct extensions and correct outbound calls to the correct numbers, as follows extensions 200, 201 and 202 rings out to 01886 number and extension 300 and 301 now rings out using the 01905 number which is correct.
However while everything is somewhat working inbound and outbound call properly routed and working internal extensions i now have a somewhat functioning setup however there is one slight issue Yealink IP Phones works perfectly fine, softphone on my desktop and laptop works fine with outbound calls however the softphone on my work mobile which is on extension 301 dials out using the wrong Trunk, now i believe that this is something to do with the whole +44 / 07 prefix because if i disable Format phone numbers using international prefix when dialing out the number get’s seen with 01905 which now works, when I have this setting enabled which is enabled by default on my Phone it then starts dialing out using +4401886 number, while this isn’t really an issue I was just wondering if there could be a fix for this ? while I have this issue everything else seems to be good and working. took me a good few hours because of trying to figure out the whole DID rewrite thing. Anyways here is the full configuration of extensions_custom.conf would anyone have any ideas on this? not only that whether I am doing this correct? because without the whole DID rewrite situation I cannot route the trunks.
[from-trunk-custom]
; Inbound call routing based on the trunk
exten => s,1,NoOp(Inbound channel is ${CHANNEL})
same => n,Set(TRUNK=${CUT(CUT(CHANNEL,/,2),-,1)})
same => n,NoOp(Detected trunk: ${TRUNK}); Check trunk number and set routing paths
same => n,GotoIf($[“${TRUNK}”=“+441905”]?to01905,1)
same => n,GotoIf($[“${TRUNK}”=“+441886”]?to01886,1)
same => n,Hangup(); Routing for trunk 01905
exten => to01905,1,NoOp(Routing to 01905 DID)
same => n,Goto(from-trunk,01905,1); Routing for trunk 01886
exten => to01886,1,NoOp(Routing to 01886 DID)
same => n,Goto(from-trunk,01886,1)[from-internal-custom]
; ----- Outbound calls: only match external numbers (not 2XX/3XX) -----
; Example: UK numbers starting with 0 and at least 9 digits
exten => _0[1-9].,1,NoOp(Outbound call from ${CALLERID(num)}); Extensions 200, 201, 202 → trunk +441886
same => n,GotoIf($[“${CALLERID(num)}”=“200”]?out01886)
same => n,GotoIf($[“${CALLERID(num)}”=“201”]?out01886)
same => n,GotoIf($[“${CALLERID(num)}”=“202”]?out01886); Extensions 300, 301 → trunk +441905
same => n,GotoIf($[“${CALLERID(num)}”=“300”]?out01905)
same => n,GotoIf($[“${CALLERID(num)}”=“301”]?out01905); Fallback if no match
same => n,Hangup(); Dial via 01886 trunk
exten => _X.,n(out01886),Set(CALLERID(num)=01886)
same => n,Dial(PJSIP/${EXTEN}@+441886); Dial via 01905 trunk
exten => _X.,n(out01905),Set(CALLERID(num)=01905)
same => n,Dial(PJSIP/${EXTEN}@+441905)
Now in my testing without the following the call kept coming through to extension 200 and using the 01886 number as a fallback.
; Check trunk number and set routing paths
same => n,GotoIf($[“${TRUNK}”=“+441905”]?to01905,1)
same => n,GotoIf($[“${TRUNK}”=“+441886”]?to01886,1)
same => n,Hangup()
Now as an attempt to fix the softphone situation I add the following,
exten => _+44[1-9].,1,NoOp(Outbound +44 number detected: ${EXTEN})
same => n,Set(EXTEN=0${EXTEN:3})
; --- Go back to trunk selection with rewritten 0 number ---
same => n,Goto(from-internal-custom,${EXTEN},1)
When adding this the problem came back where ringing out of extension 300 would use the extensions 200 number, so i ended up removing this which fixed the problem. If anyone has any solutions then please let me know because I am kinda out of ideas, I also have a couple of clients in the US as well as Australia so i would like to add the support to the dial plan, but maybe i might be going wrong with this.
Regards
