Skip to main content

Different outbound trunks for extension groups

Posted by andrewyager on Mon, 01/05/2009

Hi,

One of our clients would like to deploy a 50 user STE, but within their organisation they have a number of "sub-businesses" which they would like to arrange to call out using different outbound SIP trunks.

They don't want a full multi-tennant solution, as they want all of the extension to be able to call eachother internally etc, and won't have overlapping extension numbers - just want to be able to put extensions in "extension groups" for outbound calls.

Does anyone have any suggestions on the best way to make this happen?

Andrew


Submitted by andrewyager on Tue, 01/06/2009 Permalink

One of, but not the only.

The current plan is to design extension numbers so that the different groups have different prefixes, and then write a script that rewrites the outbound routes prefixed by the business group name, then dialing rules that handle the calls according to their rules.

e.g.

Extension 3000 dials 5551234, gets rewritten to bg15551234 (script just mangles based on gotoifs and source extension) and then there is a rule that matches bg1555. and forwards it to Zap/1

Extension 2000 dials 5551234, gets rewritten to bg25551234 and then there is a rule that matches bg2555. and forwards the call to a SIP trunk (the original number - 5551234).

Any problems real with that?

Andrew

Submitted by eeman on Tue, 01/06/2009 Permalink

i could do it with a lot less outbound routes...

clone tl-dialout-1-trunk and change

exten => s,n(dial),Macro(tl-dialout-base,${ARG1},${ARG2},${ARG3},${ARG4},${ARG5})

to

exten => s,n(dial),Macro(tl-dialout-base,${ARG1},${DB(TL/${MYEXTENSION}/tag)},${ARG3},${ARG4},${ARG5})

just keep in mind you wont actually use ARG2 when creating the outbound route.

and in each extension just put the trunk name in each Custom Tag field..

eg Zap/1

SIP/provider1

etc

Submitted by Skydoc on Sun, 01/11/2009 Permalink

Erik,

Thanks for this example of how to use Tags - its just what I needed - so I gave it a go but found that ${MYEXTENSION}/tag)} returned null and so the route wasn't enforced - even though

database show reveals the tag -

/TL/5006/tag : IAX/8444XXXX

Should the variable be _MYEXTENSION or can I use MYID ?

As ever - any guidance would be appreciated.

Regards,

Geoff.

Submitted by eeman on Sun, 01/11/2009 Permalink

call Macro(tl-set-myvariables) in the dialplan, that should set the variables going into the script

Submitted by Skydoc on Mon, 01/12/2009 Permalink

[from-inside]

exten => _X,1,Macro(tl-set-variables2,from-inside-redir,)

exten => _*.,1,Macro(tl-set-variables2,from-inside-redir,)

exten => _X.,1,Macro(tl-set-variables2,from-inside-redir,)

exten => _+X.,1,Macro(tl-set-variables2,from-inside-redir,)

Do I need to add sections that run - (tl-set-myvariables)?

Sorry to be a pain but the learning curve is steep!

Regards,

Geoff.

Submitted by jesperkjeldsen on Mon, 02/16/2009 Permalink

What will happend if the user forwards all calls - will it still be using the right trunk (specified in the custom tag field) or will it be forwarded using the normal outbound rules?

Its a bit funny that it is so hard to find Asterisk-based PBXs with the functionality to allow og disallow extensions access to trunks. In 3CX you can type what extensions that has access to dial a specific trunk - and by that easily managed that every extension dial out with its own number. Also if the calls are forwarded.

Regards

Jesper

Submitted by jesperkjeldsen on Sun, 05/03/2009 Permalink

Hi again

What to do if it is the MTE version?

I tried to figure it out, and thought this would be the way to do it, but apperantly not ;-)

exten => s,n(dial),Macro(tl-dialout-base,${ARG1},${DB(TL/TENANT/${MYEXTENSION}/tag)},${ARG3},${ARG4},${ARG5})

I have tried to enter the trunk name (SIP/number) directly as ARG2 and it works that way. So it is something I doesn't get right in how to get the costum tag out of the database (I think)!

What is it I doesn't get right?!

Regards

Jesper

Submitted by jesperkjeldsen on Sun, 05/03/2009 Permalink

A couple of hours and trying later...

I get it to work with this:

exten => s,n(dial),Macro(tl-dialout-base,${ARG1},${DB(TL/${tenant}-${MYEXTENSION}/tag)},${ARG3},${ARG4},${ARG5})

Is it the "right" way to do it? Or should I use ${TL_DASH} instead of -?

show database is a great command - it made it much easier to understand what I wanted to get out of the database :-)

Regards

Jesper

Submitted by jesperkjeldsen on Tue, 05/12/2009 Permalink

Thanks for the explanation why I should do it with TL_DASH.

THe more I work wotk the Thirdlane the better it is :-)

Regards

Jesper

Submitted by sardinha on Fri, 10/30/2009 Permalink

Hi,

My problem in using tags is that ${MYEXTENSION}/tag)} returned null and database show not reveals the tag.

in sip.conf:

[200]
tag=SIP/211452690

and in the script used for related outbound route:

exten => s,1,GotoIf($["${MACRO_EXTEN}" = "s"]?dial)
exten => s,n,Set(__DIALED_NUMBER=${MACRO_EXTEN})
exten => s,n(dial),Macro(tl-dialout-base,${ARG1},${DB(TL/${tenant}${TL_DASH}${MYEXTENSION}/tag)},${ARG3},${ARG4},${ARG5})

Can you tell me where is the problem?

Submitted by sardinha on Mon, 11/02/2009 Permalink

This topic is really what i need to try in my business scenario.

Excuse me for not understanding the concept of "Tag" in this context. I'm confusing how the variable "tag" is defined in BD by extension. How can I define tag in each extention? Can you pointing the right direction by showing me an example ?

Thank you for the patience.