Skip to main content

Use different trunks per extensions and system calls still working

Posted by jesperkjeldsen on Mon, 03/08/2010

Hi!
I have created a script that makes my extensions dial out via the trunk specified in the extensions Custom Tag

(with help from this forum :-)).

It looks like this:
exten => s,1,Macro(tl-set-myvariables)
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})

It works great when the extensions makes call, but have some problems.
When a user forward his phone either the Snom way (at the phone or the webinterface) or by using the feature

codes (like *72), it dosn't work. As far as I can find out the tl-dialout-base don't get a trunk to dial out via. So you can say it works as it should ;-)

I have been working on a good solution all day, but I can't find just the right way to make it work.

Some of the problems comes because my SIP provider requires me to send the corresponding "External Caller ID Number" that matches the trunk. I have one SIP trunk per phonenumber.

I had some of it to work, where it chooses a default trunk when none is specified - but then I get in trouble with the External Caller ID and my provider denies the call.

This is some of the nearly working stuff:
exten => s,1,Macro(tl-set-myvariables)
exten => s,1,GotoIf($["${MACRO_EXTEN}" = "s"]?dial)
exten => s,n,Set(__DIALED_NUMBER=${MACRO_EXTEN})
exten => s,n,GotoIf($["${DB(TL/${tenant}${TL_DASH}${MYEXTENSION}/tag)}" = ""]?notrunk)
exten => s,n(dial),Macro(tl-dialout-base,${ARG1},${DB(TL/${tenant}${TL_DASH}${MYEXTENSION}/tag)},${ARG3},${ARG4},${ARG5})
exten => s,n(notrunk),Macro(tl-dialout-base,${ARG1},${ARG6},${ARG7},${ARG8},${ARG9})

My thought is that someone else of you out there must have the same problem as me which basically can be described like this:
My extensionens have DID they also want to call out via.
My provider requires that External Caller ID and trunk is corresponding.

It should be simple ;-)

One of my suggestions now is maybe to create an outbound route for every trunk, but can I make an pattern that matches the extensions (without making dialplan in the phones)?

Now I have one outbound route, all calls that matches _. is routed towards the script.

Could anyone point me in the right way?

Regards
Jesper


Submitted by jesperkjeldsen on Mon, 03/08/2010 Permalink

Do you know the feeling where you have been strugling with a problem and just cannot stop working with it?!

I found out now that with the second script and by adding fromuser to the trunk, I can control alone by the custom tag for the extensions. And then I have a "fall back" trunk which I set in the script as ARG6.

So I am now having a functional system ;-)
But it would be very nice if the *72 feature code and the Snom way of forward call (as far as I can reed it uses 302 temporarilt moved), also could use the custom tag so the calls is placed at the extensions DID. So if anyone have any great ideas for me it would be great :-)

Here in Denmark its now 11PM (GMT+1) so I should stop working ;-)

Regards
Jesper

Submitted by jesperkjeldsen on Thu, 09/02/2010 Permalink

Hi Jörgen
Yes it works - but with the limitations that forwarded calls uses the trunk set as the secondary trunk in outbound trunks.
The problem is that tl-dialout-base don't get a trunk to dial out via - it dosn't get the extension custom tag.
In fact I have just opened another forum thread about it :-)

Regards
Jesper

Submitted by luster on Wed, 11/10/2010 Permalink

This is just about EXACTLY the script I need.

A few questions;

Where exactly do you paste this code...is it extensions.conf under [from-inside]?

Secondly, what syntax do you use for the custom tag, is it TRUNKTYPE/TRUNKNAME? ie; SIP/PROVIDER0011

Thanks in advance!

Submitted by jesperkjeldsen on Tue, 11/16/2010 Permalink

I use it as an outbound script for the trunk and type the costum tag like this SIP/xxxxxxxxx (where x is the trunk name).

Regards
Jesper