Netborder Routing Examples
Configuring NBE to work with DID's (DDI)
To pass the DID from the telco to the SIP pbx simply just modify your "default_sip_out" rule as shown below, this is found in your "\Program Files\Netborder\Express\Gateway\config\routing-rules.xml" configuration file. This will save the pstn.in.dnis into the %1 variable since the pstn.in.ani has the %0 variable because it was declared before the dnis. Now the (.*) is what saves it into the next available variable.
<rule name="default_sip_out" outbound_interface="sip" qvalue="0.001">
<condition param="transfer" expr="false"/>
<condition param="pstn.in.channelName" expr=".*"/>
<condition param="pstn.in.ani" expr="(.*)"/>
<condition param="pstn.in.dnis" expr="(.*)"/>
<out_leg name="" media_type="sendrecv">
<!-- To modify the target SIP destination, just change the value below -->
<param name="sip.out.requestUri" expr="sip:%1@localhost:5060"/>
<param name="sip.out.from.uri" expr="sip:%0@GW_HOST_IP:GW_SIP_PORT"/>
<param name="sip.out.from.displayName" expr="Netborder Express Gateway"/>
<param name="sip.out.transport" expr="udp"/>
</out_leg>
</rule>
3CX Is Sending CID In Quotes
If 3CX is sending CID in quotes then you can simply remove this by editing your routing-rules.xml which can be found in the file browser of the management interface. Once in there locate the rule "default_pstn_out_with_caller_name" as shown below.
<rule name="default_pstn_out_with_caller_name" outbound_interface="pstn" qvalue="0.01">
<condition param="transfer" expr="false"/>
<condition param="sip.in.requestUri.canonical" expr="sip:([\+]?[-\*\#\d]+)@"/>
<condition param="sip.in.from.displayName" expr="(.*)"/>
<condition param="sip.in.from.uri.canonical" expr="sip:([\+]?[-\*\#\d]+)@"/>
Then change the sip.in.from.displayName line so it looks like the rule below. Once this is done then stop and start the gateway and the issue will be resolved.
<rule name="default_pstn_out_with_caller_name" outbound_interface="pstn" qvalue="0.01">
<condition param="transfer" expr="false"/>
<condition param="sip.in.requestUri.canonical" expr="sip:([\+]?[-\*\#\d]+)@"/>
<condition param="sip.in.from.displayName" expr="([0-9]+)"/>
<condition param="sip.in.from.uri.canonical" expr="sip:([\+]?[-\*\#\d]+)@"/>
3CX Inbound Calls Fail With Proxy Authentication Required In the Status Window
This issue is occurring because with 3CX requires the INVITE from NBE to contain the trunk ID set in 3CX. So this is a quick and simple fix just go to http://www.3cx.com/voip-gateways/sangoma.html and once there go "Part 2 – Configuration of 3CX Phone System". In this section there will be two step #3's, just go to the second one and insure you follow the steps there. The steps there will show you how to generate the configuration for NBE.
If the issue is still occurring send an email to support@sangoma.com and our support team will assist you.
Sometimes 3CX is not responding to NBE SIP INVITES
If the CID has other characters other then letters and numbers then 3CX has been known not to respond. So to fix this you can modify the default routing rule and add a second routing rule to send CID with a comma in it.
Take your normal routing rule and change "(.*)" to "([0-9a-zA-Z]+)" as shown below.
<rule name="default_sip_out" outbound_interface="sip" qvalue="0.001">
<condition param="transfer" expr="false"/>
<condition param="pstn.in.channelName" expr=".*"/>
<condition param="pstn.in.dnis" expr="(.*)"/>
<condition param="pstn.in.ani" expr="(.*)"/>
<condition param="pstn.in.callerName" expr="([0-9a-zA-Z]+)"/>
<out_leg name="" media_type="sendrecv">
<!-- To modify the target SIP destination, just change the value below -->
<param name="sip.out.requestUri" expr="sip:%0@localhost:5060"/>
<param name="sip.out.from.uri" expr="sip:%1@GW_HOST_IP:GW_SIP_PORT"/>
<param name="sip.out.from.displayName" expr="%2"/>
<param name="sip.out.transport" expr="udp"/>
</out_leg>
</rule>
Then add a second routing rule which will get any calls with a comma in it, eg. "Doe, John". This new rule will have 2 variables as shown below and there will be a space between them instead of a comma, you can see this below where is says "%2 %3". So insure the space is kept and other then that just copy and paste this rule below the first rule. All required changes from the default rule above have been high lighted.
<rule name="sip_out_comma_in_caller_name" outbound_interface="sip"
qvalue="0.002">
<condition param="transfer" expr="false"/>
<condition param="pstn.in.channelName" expr=".*"/>
<condition param="pstn.in.dnis" expr="(.*)"/>
<condition param="pstn.in.ani" expr="(.*)"/>
<condition param="pstn.in.callerName"
expr="([0-9a-zA-Z]+)[,\s]+([0-9a-zA-Z]+)"/>
<out_leg name="" media_type="sendrecv">
<param name="sip.out.requestUri" expr="sip:%0@localhost:5060"/>
<param name="sip.out.from.uri" expr="sip:%1@GW_HOST_IP:GW_SIP_PORT"/>
<param name="sip.out.from.displayName" expr="%2 %3"/>
<param name="sip.out.transport" expr="udp"/>
</out_leg>
</rule>
Then simply restart the gateway and test to insure the issue has been resolved.
Caller ID on SIP REFER transfers is incorrect/incomplete
By default, the routing rule handling the SIP REFER requests will copy the From: header to the resulting INVITE message, so that the Caller Number presented to the transfer target is the one of the transferring SIP endpoint (IVR or person triggering the transfer).
Default Rule:
<rule name="sip_to_sip_transfer" outbound_interface="sip" qvalue="0.001">
<condition param="transfer" expr="true"/>
<condition param="sip.in.referTo" expr="(?U)(.*)(?:;|\?|$)"/>
<condition param="sip.in.from.uri" expr="(.*)"/>
<out_leg name="" media_type="sendrecv">
<param name="sip.out.requestUri" expr="%0"/>
<param name="sip.out.from.uri" expr="%1"/>
</out_leg>
</rule>
To present the Caller Number corresponding to the PSTN number associated to the call instead, the contents of the To: header must be used instead
Alternate rule:
<rule name="sip_to_sip_transfer" outbound_interface="sip" qvalue="0.001">
<condition param="transfer" expr="true"/>
<condition param="sip.in.referTo" expr="(?U)(.*)(?:;|\?|$)"/>
<condition param="sip.in.to.uri" expr="(.*)"/>
<out_leg name="" media_type="sendrecv">
<param name="sip.out.requestUri" expr="%0"/>
<param name="sip.out.from.uri" expr="%1"/>
</out_leg>
</rule>
Also, the default rule only copy over the Caller Number, and not the Caller Name if available. The following rule shows how to extract the Caller Number and Caller Name from the PSTN side of the call and package it in the resulting INVITE message.
PSTN Caller Number and Name rule:
<rule name="sip_to_sip_transfer" outbound_interface="sip" qvalue="0.001">
<condition param="transfer" expr="true"/>
<condition param="sip.in.referTo" expr="(?U)(.*)(?:;|\?|$)"/>
<condition param="sip.in.to.uri" expr="(.*)"/>
<condition param="sip.in.to.displayName" expr="(.*)"/>
<out_leg name="" media_type="sendrecv">
<param name="sip.out.requestUri" expr="%0"/>
<param name="sip.out.from.uri" expr="%1"/>
<param name="sip.out.from.displayName" expr="%2"/>
</out_leg>
</rule>
How to select incoming PSTN channel(s) for routing rules
If you ever have the need to segment the incoming PSTN traffic towards different SIP destinations based on the channel(s) that the calls were placed on. The condition param that you would need to modify to do this is :
pstn.in.channelName
<rule name="default_sip_out" outbound_interface="sip" qvalue="0.001">
<condition param="transfer" expr="false"/>
<condition param="pstn.in.channelName" expr=".*"/>
<condition param="pstn.in.ani" expr="(.*)"/>
<condition param="pstn.in.dnis" expr="(.*)"/>
<out_leg name="" media_type="sendrecv">
<!-- To modify the target SIP destination, just change the value below -->
<param name="sip.out.requestUri" expr="sip:%1@localhost:5060"/>
<param name="sip.out.from.uri" expr="sip:%0@GW_HOST_IP:GW_SIP_PORT"/>
<param name="sip.out.from.displayName" expr="Netborder Express Gateway"/>
<param name="sip.out.transport" expr="udp"/>
</out_leg>
</rule>
There are two types of channel name formats: One for digital interfaces (A101,102,104 and 108) and one for analog interfaces (A200):
Digital channel name format
b1(B1 - A102_digital)di2(B1I2)-c0
The REGEX to match the channel(s) will have the following fo rmat: "bX.*diY.*-cZ"
X is the board number
Y is the digital interface number
Z is the channel number
Analog channel name format
b1(B1 - A200_analog)ai1(B1I1)-c1
b1(B1 - A200_analog)ai2(B1I1)-c1
The REGEX to match the channel(s) will have the following format: bX.*aiY
X is the board number
Y is the analog interface number or channel.
To select all incoming calls placed on board 1 (analog and digital)
<condition param="pstn.in.channelName" expr="b1"/>
To select all incoming calls placed to the digital interface 1 on board 1
<condition param="pstn.in.channelName" expr="b1.*di1"/>
To select all incoming calls placed to the analog interface/channel 1 on board 1
<condition param="pstn.in.channelName" expr="b1.*ai1"/>
To select all incoming calls placed to multiple digital interfaces on board 1 (interface 1 to 6)
<condition param="pstn.in.channelName" expr="b1.*di[1-6]"/>
To select all incoming calls placed to multiple analog interfaces/channels on board 1 (interface 1 to 3)
<condition param="pstn.in.channelName" expr="b1.*ai[1-3]"/>
To select all incoming calls placed to digital channel 20 of interface 1 on board 1
<condition param="pstn.in.channelName" expr="b1.*di1.*c20$"/>
To select all incoming calls placed to multiple digital channel of interface 1 on board 1 (channel 1 to 8)
<condition param="pstn.in.channelName" expr="b1.*di1.*c[1-8]$"/>
Note: dont forget to place the "$" at the of the channelName for the last 2 examples
If you wanted to segment your traffic between digital interfaces 1 to 4 and 5 to 8 on a A108 Card.
You would have the following routing-rules:
<rule name="default_sip_out_interface1-4" outbound_interface="sip" qvalue="0.001">
<condition param="transfer" expr="false"/>
<condition param="pstn.in.channelName" expr="b1.*di[1-4]"/>
<condition param="pstn.in.ani" expr="(.*)"/>
<condition param="pstn.in.dnis" expr="(.*)"/>
<out_leg name="" media_type="sendrecv">
<!-- To modify the target SIP destination, just change the value below -->
<param name="sip.out.requestUri" expr="sip:%1@localhost:5060"/>
<param name="sip.out.from.uri" expr="sip:%0@GW_HOST_IP:GW_SIP_PORT"/>
<param name="sip.out.from.displayName" expr="Netborder Express Gateway"/>
<param name="sip.out.transport" expr="udp"/>
</out_leg>
</rule>
<rule name="default_sip_out_interface5-8" outbound_interface="sip" qvalue="0.001">
<condition param="transfer" expr="false"/>
<condition param="pstn.in.channelName" expr="b1.*di[5-8]"/>
<condition param="pstn.in.ani" expr="(.*)"/>
<condition param="pstn.in.dnis" expr="(.*)"/>
<out_leg name="" media_type="sendrecv">
<!-- To modify the target SIP destination, just change the value below -->
<param name="sip.out.requestUri" expr="sip:%1@localhost:5070"/>
<param name="sip.out.from.uri" expr="sip:%0@GW_HOST_IP:GW_SIP_PORT"/>
<param name="sip.out.from.displayName" expr="Netborder Express Gateway"/>
<param name="sip.out.transport" expr="udp"/>
</out_leg>
</rule>