Skip to main content

Routing Question

Posted by Skydoc on Fri, 01/02/2009

Hi

I'm sure that this is a pretty easy question to answer and probably reflects my relative inexperience with routing strings but here goes!

I have a number of SIP accounts on my asterisk PBX to which are connected individual SIP clients (Phones and Soft Phones).

Up until now I have been happy to have all the phones using the same outbound routes, but now I need to route each of the phones through individual (specific) routes (and therefore trunks). Previously I would have simply used a set of custom outbound prefixes (that would subsequently be stripped off) but this means that each phone user has to remember to prepend the right access number - 9 for normal routing, 5 for route 2 etc. Users are very unlikely to remember to do this so my question is this -

How can I ensure that a user on a particular phone / extension is always routed outbound through the correct route / trunk?

A moment ago I thought I might have solved it if the individual extension setup page had an option to automatically prepend a number to all outbound calls - but it does not. Another option would, I think, to be to use custom contexts, and put the appropriate outbound routes in each context - but 1) this seems like a sledgehammer to crack a nut and 2) Thirdlane single tenant version does not seem to have a way of managing contexts other than those pre assigned by the scripts.

There must be an easy way of doing this, it would seem to be a pretty straightforward requirement.

Can anyone help me out with this one?

Happy New Year and thanks in advance.

Geoff Tothill.


Submitted by justdave on Fri, 01/02/2009 Permalink

The separate contexts for the different classes of phones would be the "proper" way to do it according to the upstream asterisk folks. I've more than once requested the ability to set up custom contexts for phones other than the three that are currently provided, but it hasn't happened yet. This is one of those situations it would really come in handy for. The specific situation I wanted it for was the phone in the front lobby (which is outside the door that gets locked at night) so I could restrict that phone to doing nothing other than calling the receptionist. I ended up doing it anyway in the back end config files, and just warned the admins to never edit that phone in the GUI, lest the GUI change the context back to one of the three provided ones. :)

Submitted by eeman on Fri, 01/02/2009 Permalink

Is this an MTE installation? you can create trunks that only specific tenants can have access too. Additionally you'll want to deny your tenant to the Outbound Routes section of PBX manager so they dont mess it up once you get it working. A seperate trunk for each tenant sounds horrible, I can't imagine this scaling very well. If your need is even more granular than 1 trunk per tenant, I would shop for a new sip provider as they should be using something else to identify the source caller.

Submitted by thirdlane on Fri, 01/02/2009 Permalink

You can use a recently added custom tags (data identifying each phone) + custom script for outbound call handling where tag will effectively identify a "class of service" so technically you will be able to have different call handling for each phone. I am a bit afraid to add custom contexts as that will make any changes and automatic upgrades more difficult plus require giving users ability to manage context inclusion - and get things more complicated. My feeling is that 3 "classes" cover most cases and custom tags could cover the rest - but I am interested on more feedback on this topic.

Submitted by Skydoc on Sat, 01/03/2009 Permalink

Thanks justdave - I agree that the use of contexts would be the quickest and most flexible way of doing this, but I can see that it would be difficult to allow users to add contexts on the fly - as explained by Alex above. I'm sure that if I had the right experience your solution of editing the individual phone configuration would work for me as I have a pretty small installation. Unfortunately I am trying to get this to work with one particular line on a Polycom 601 and as far as I can see there is no way of setting this up on the unit.

eeman - Thanks for your input - this isn't a MTE setup but I see how your solution would work if it were.

Alex - the custom tags concept seems pretty powerful but Im no asterisk programmer. Do you have any example scripts showing how these tags are used? I would really like to start using Tags in my setup and any help you could give would be very much appreciated.

Regards and thanks,

Geoff.

Submitted by eeman on Sat, 01/03/2009 Permalink

Geoff,

custom tags are just DB entries for each extension. You could, in theory, create a new outbound trunk script that parses the custom tag to use the applicable trunk when calling macro tl-dialout-base.

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

Erik

Thanks for your comments. I have delved a bit into tl-dialout-2-trunks to see how it works and Im assuming that I just need to put a parsing routine at the top to check the line tag and then pass the variables as ${ARG2} or ${ARG6} to tl-dialout-base.

This is where my inexperience with scripting for asterisk lets me down - how do I refer to the new custom tag in the script? I'm sure this is actually very straightforward as there must be many instances where Db enteries are simply called by scripts but Im afraid I dont know how to do this.

Thanks again for your continued help,

Kind Regards,

Geoff.

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

the tag will be an asterisk-db entry. so you could just refer to it as ${DB(family/key)} instead of ARG if the entire string is what you want to use. In a more advanced use, you could put an array of data in there separated by a delimiter and use CUT to fetch the field you want to use.

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

Erik,

I'm going to have to spend some more time figuring out the coding on this one but thanks for setting me off in the right direction!

Regards,

Geoff.