Routing tips from various users

From Yate Documentation
Revision as of 18:07, 31 October 2013 by Monica (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article contains a mix of information that various users found important to point out. Before embarking on writing complex routing routines follow this points to make sure you considered all aspects.


General advice

  • Watch your priorities. A numerically lower priority means a higher actual priority of the route.
  • Test your routes before going public. Calls may be routed through external providers instead on your network, and you may never notice. Actually, my DB had indicated that the call was setup directly (lines in use on source and destination both 1), but the call was routed via Voipstunt. Else you may have nasty surprises with your next bill ;-)


  • Ban not-registered users from calling numbers on your network
;Stop unauthorized calls.
  • Some test-routes. Starting with 000 - so no overlap with international / local area codes
;Route to the German Alice hotline, using voipstunt as provider (as set by line)

;Route to a madplay set up with some mp3 files, to test quality.

;Record something with 0007 and play it back with 00077. 
;The file will be overwritten on next call.
;Note the double slashes after record and play. Taken from online documentation; 

Modifying call information

To do this I had to modify the sending information. Initially the SIP message looked like (anonymised):

From: "stuff" <sip:random@>;tag=108375482
To: <>

What I wanted to do, was change it into:

From: <sip:originator@>;tag=1402492972
To: <>

To change "stuff" into something else, or remove it entirely, you can use the callername property. To change 'random' into 'originator' you set the caller property. Combining these together gives you:


which you can place in regexroute.conf

Redirecting Calls to another User in the Regex Module

  • I use the full international format to assign unique numbers to my customers (Their fixed line numbers). If regexroute.conf has the highest actual priority, these customers always will be routed using the external provider. I could add rules to route them, by redirecting:

In regexroute.conf:


Routing priorities:

  • regexroute.conf: i.e. preroute=10 route=10
  • regfile.conf: i.e. preroute=50 route=50

YATE will start routing with regexroute.conf (highest priority, as it has the lowest number!). There the number 123456 matches, changes the called parameter to johndoe and returns. As the number has not been routed yet, YATE tries the files with the lower routing priority, now trying to route johndoe. johndoe is found in regfile.conf, and the originally called number 123456 is routed to the user johndoe.
Naturally, instead of regfile.conf you can use the database module (register.conf), with the priorities set accordingly.

My setup to route calls originating from Munich (089 in Germany 0049) over Voipstunt which takes international format 004989xxyz only.

I use Voipstunt to route calls to destinations not on my network.


Note, how I used sip/ , not sip/sip: . I took this from the doc on routing to and from FWD on this site. Actually both may work, I haven't tested the other.

Routing with two providers (lines), alternating between them:

;Test setup: Deutsche Telekom Service

;Routing international calls.

The purpose of this setup is to distribute the balance of the calls across the two providers; Also it gives callers the possibility to try again with a different provider (well both are Betamax actually, but ...)

Setting up outgoing number for each user

^9\(.*\)$=goto outgoing_trunk


Slow devices

I discovered that a few times I'd call my voicemail machine and YATE would go ahead and cancel the session just prior to establishing it. It turned out that that the voicemail machine was somewhat loaded and things were not responding in time. For each call that YATE initiates, it starts two timers: maxcall and timeout.

Timeout runs for the overall length of the call. Whereas is maxcall is how long YATE will wait until the other side responds. Both parameters are in units of milliseconds. So, to wait up to 10 seconds before cancelling the call to the voicemail system, we can change our line in regexroute.conf to be:


Not letting things go on forever

Sometime the devices will be slow and sometimes the people using those devices will be slow (at talking). If you wish you can constrain the duration of a call as well. This is known as the timeout. So, to not let people leave voicemails longer than 180 seconds (3 minutes) you would have:


See also

Personal tools