Extention DID Presentation


#1

Hi don’t know if another article exists (I did look) but I’m not sure if my terminology is correct.

Here is was I was to do. I have 4 extensions, 4 outbound GV trunks, 1 inbound GV trunk and 2 Sipgate trunks.

All outbound calls go out though a GV trunks I’ve made it so you can prefix the number dialed with 5, 6 or 7 it will direct the call down a different trunk so the outbound DID shows up correctly. Ergo the call DID presentation. If you dial the number with out a prefix it defaults to the main trunk.

Now what I’m looking for it a way to automate this. Say you pick up exten: 102 and dial some number, I would like the dialplan to see that its coming from exten: 102 and thus direct to call to the correct trunk so that the called Id show up correctly on the other end. Ergo same for extensions 100, 101 and 200.

Is this possible and if so how. I’m thinking that it’s fairly simple. I just need to be pointed in the correct direction.

Thanks in advance.
Lionel


#2

There are several ways to achieve this goal. For the following example let’s assume, that every internal extension should be bounded to a specific trunk (Your requirement) and these trunks are named trunk1,trunk2…trunkn. Next assumption is, that the extensions are SIP-extensions (for DAHDI see below, for IAX2 exchange sip.conf with iax.conf).
Then a sloution could be:

sip.conf

[code][100]

setvar=myProvider=trunk1
context=myphones

[101]

setvar=myProvider=trunk2
context=myphones

[/code]

extensions.conf

[myphones]
exten => _NXXNXXXXXX,1,goto ${myProvider},${EXTEN},1 ;for an NANP-Outbound-call

[trunk1]
exten => _NXXNXXXXXX,1,Dial(...) ;for an NANP-Outbound-call through trunk1

[trunk2]
exten => _NXXNXXXXXX,1,Dial(...) ;for an NANP-Outbound-call through trunk2

This could be optimized, it just should give You an idea, how to solve the problem.

As DAHDI actually AFAIK doens’t suupport any setvar-association You’ll neeed a different approach here if Your extensions are of this channeltype. Here we assume that the CALLERID of the DAHDI-extension is our “switch-criteria”:

extensions.conf

[myphones]
exten => _NXXNXXXXXX,1,GotoIf($["${CALLERID(num)}" = "100"]?2:3) ;for an NANP-Outbound-call
exten => _NXXNXXXXXX,2,goto trunk1,${EXTEN},1
exten => _NXXNXXXXXX,3,GotoIf($["${CALLERID(num)}" = "101"]?4:5) ;for an NANP-Outbound-call
exten => _NXXNXXXXXX,4,goto trunk2,${EXTEN},1
....

[trunk1]
exten => _NXXNXXXXXX,1,Dial(...) ;for an NANP-Outbound-call through trunk1

[trunk2]
exten => _NXXNXXXXXX,1,Dial(...) ;for an NANP-Outbound-call through trunk2

Alternatively You may assign different (starting) contexts to the different extensions, but this may break Yourt existing logic …

BTW: What You also could do (but IMHO it’s a solution wich doesn’t make the dialplan comfortable to read and maintain) is using the CID-depended patternmatch as: