OpenSBC Route XML
You can define routes that OpenSBC (OSBC) can use via an XML file. While it is possible to create routes via the OSBC user interface (UI), the use of an XML file provides the added flexibility of being able to centralize routing information used by several OSBC instances.
This document assumes you have basic knowledge in extensible markup language (XML). You can find several tutorials on XML over the Internet.
The Routes XML File
You can set the routes that OpenSBC can use through an XML file. You can add as many routes in the said XML file.
The XML file should be in the following format:
<routes>
<route filter="
c-main">
c-main</route>
</routes>
Here is an example of a valid OSBC route XML file:
<routes>
<route filter="sip:1212*">sip:xx.xxx.xx.xxx</route>
<route filter="sip:011632*">sip:xx.xxx.xxx.xxx:5060 | sip:xx.xxx.xxx.xxx:5060</route>
<route filter="sip:01163*">sip:xx.xxx.xxx.xxx:5060, sip:xx.xxx.xxx.xxx:5060</route>
<route filter="sip:011632*">sip:xx.xxx.xxx.xxx:5060;forceprivacy=true</route>
<route filter="sip:613*;max-session=5">sip:fwd.solegy.com</route>
</routes>
Let us break down the example XML file so that you can understand how to create a route.
The first route in the example is the basic route entry that you can define. In the example, our filter is "sip:1212*". It means that when OSBC receives a dial string that starts with 1212, OSBC routes the call to the SIP domain that is defined for that filter.
The second route in the example defines a route with a load balancer. To define two routes with load balancing, separate each domain with a pipe ( | ). In the example above, when OSBC receives a dial string that begins with 011632, the call is routed in a round robin fashion. For example, the call is routed to the first domain defined. Now, if OSBC receives another dial string that begins with 011632, the call is routed to the next domain defined.
The third route in the example defines a route with failover. When the first domain defined in the route is unavailable for whatever reason, OSBC routes the call to the second domain. Using the example above, when OSBC receives a dial string that begins with 01163, it checks if the first domain is available. If the first domain is available, the call is routed to that domain. Otherwise, the call is routed to the second domain.
The fourth route in the example shows a domain with a parameter. In this example, the parameter is "force-privacy=true". You separate the parameter from the domain with a semicolon. You can set the following parameters:
action - this parameter instructs the domain to perform a certain action. For example, if you set action to redirect (i.e., action=redirect), the call is redirected to another domain when the call is routed.
debit - set to true if you want to use the domain as an IVR (debit=true, default is false)
force-privacy - setting this parameter to true or id forces OSBC to set the FROM field as anonymous. Default is none.
The fifth route in the example shows a filter with a parameter. In the example, the parameter is "max-session=5". You separate the parameter from the dial string filter with a semi-colon. You can set the following parameters:
max-session - set to any number, this parameter limits the number of calls that is routed to the domain
codec - set to codec mnemonic, this parameter checks the codec used by the caller before the call is routed. You can check this page to see the codecs that you can set -
http://gim.org.pl/rfcs/rfc3108.html (look for Table 2. Encoding Names and Payload Types at the said Web page, then check the Encoding Name column for the codec mnemonic).
sip-trunk - this parameter indicate that the domain need a register (sip-trunk=true, default is false). And you must to configure the SIP-TRUNK(http://www.opensourcesip.org:8080/clearspacex/docs/DOC-1040)
Save the XML file. You can use any file name, but it is suggested to use a very descriptive name (for example, routes.xml). Upload the XML file in the same directory/folder where OSBC is located.
Configuring OpenSBC
After creating the route XML file, you must configure OSBC to use the said file for routing purposes. In the main page of the OSBC user interface, click on the
B2BUA Routes link.
In the
B2BUA Routes page (shown below), check the
Use External XML for B2BUA Routes field.
Then, enter the URL of the XML file in the
B2BUA Route External XML field. Click on
Update to save.