MSBG Routing
Â
To help understand the routing logic within the MSBG, there are two key points:
1. Calls from all TDM ports routed to the local loopback IP address of the SBC: 127.0.0.1
This means a SIP profile bound to 127.0.0.1 will capture this traffic, where its dialplan will take care of routing the call onwardÂ
2. Calls to TDM ports routed to 127.100.0.1 because this is the IP Address that the TDM Gateway listens on.
This means that inbound SIP calls need a route to 127.100.0.1 to pass through to the PSTN
This is achieved via a SIP Trunk towards 127.100.0.1Â
Â
Getting Started
Log into the MSGB WebGUI and familiarize yourself with the TDM related sections
1. The Control Panel has a designated engine to start/stop the TDM Gateway
The start order of the TDM Gateway and Netborder Session Controller does not matter
If the TDM Gateway (or TDM ports) is not being used for deployment, do not start it
2. All the configuration options for the TDM port(s) and dialplan are located on the left colum, under Gateway
Description Details:
Global:Â Generic options which are not typical adjusted (leave as is unless told otherwise)
TDM Interfaces: Main configuration section to configure each TDM port:
E1/T1 physical settings
Switchtypesettings
Signaling settings
Dialplan: Advanced PSTN dialplan.  This dialplan section is only used for advanced adjustments. It is never recommended to touch any area in this dialplan section. (SIP->TDM, TDM->SIP routing is already created by default).
SIP: For advanced SIP Protocol adjustment. It is never recommended to touch any variable in this section.Â
Â
Configuring E1/T1 & Signaling
1. To begin configuring the TDM ports, select TDM interfacesÂ
The following window will appear, displaying available/detected TDM Ports.
Below is an example of an SMBG with 4 avaialble E1/T1 ports, ready to configure
2. To begin configuring a port, select edit, located under 'Physical Config'
A window with the physical layer settings will be displayed:
3. After selecting your choice, click 'Apply to Port', where the next screen will prompt selection for link type. Select ISDN Link (PRI) for connection to a PRI telco/device
4. Select the switchtype & Signaling configuration by clicking on 'use' button. Modifications to the default profiles can be made by clicking on 'Edit Profile'
5. Port configuration is now complete. Proceed toconfiguring any other port required
*Note: Span Group number is used in the SBC dialplan configuration to specify specific ports to dial to. For example, if all 4 ports are configured and there are 4 unique PRI lines (1 for long distance, 1 for local calls..etc)each port will have a unique Span Group ID (default is 1,2,3,4). When routing the call from SIP, the unique Span Group ID is used to pass the call to that particular port. Same logic can be used for calls in the opposite direction. More on this in the SBC dialplan section.
If all your PRI lines are connected to same endpoint and want all lines to be used as a large group of channels, makesurethat 'Span Group Number' is identical for all ports (i.e. 1)
6. To apply the completed TDM configuration, navigate to the Configuration icon at the top right of the SBC menu, which will be in Orange color and select 'apply'
TDM configuration is now complete. Begin configuring the SBC SIP routing
Â
TDM to SIP Routing
As mentioned, calls from any/all E1/T1 ports route towards the local loopback IP address 127.0.0.1 of the SBC.
This means the SBC needs a SIP Profile bound to 127.0.0.1 in order to catch this traffic from the PSTN, where a separate dialplan will route traffic onwards to SIP.
By default, the MSBG has a sip profile created and bound to 127.0.0.1, and called Internal_TDM. Verify this by navigating to 'Configuration'->'SIP Profiles':
Â
NOTE: If you do not see this SIP Profile created click on the 'Add' button and create a new SIP Profile and select the following options:
SIP IP Address: 127.0.0.1 Â (PSTN calls will be sent to this IP address)
Inbound Media Profile/Outbound Media Profile: Internal_TDM_Media
These media profiles aredesignatedfor TDM because onlypcmu/pcmaaudio codecs are supported through the E1/T1 line
Routing Plan: Populate this field with the PSTN->SIPdialplan that will be created nextÂ
allother options can be left at default
Strict Security Mode: Strict Security mode must be disabled on Internal_TDM SIP Profile
example:
  Â
TDM to SIPDialplan Creation
1. Navigate to 'Configuration'-> 'Routing' -> 'Call Routing', then click on 'Add' under 'Basic Call Routing'
2. Give the new dialplan a convenient name. In this example, 'from_tdm' is created to identify calls FROM the PSTN, routing TO SIP
3. Give the new dialplan a Description. (This is optional)
4. Click 'Add', under 'Rule' to create the dialplan
Â
5. Under the 'Condition' section, create the filter that will match inbound PSTN callsÂ
To route all PSTN calls from any TDM Port, select:
->Â Condition: Standard Information
->Â Name: Destination Address
->Â Expression: (.*)
6. Under 'Actions to perform if condition matches' create the route to SIP where to send the calls to
Depending on your network setup and the routes already created for SIP routing, select any of the available options under 'Action'.
Typically used options are:
-> Action: 'Bridge to Trunk' or 'Custom'
In the below example, therewas a sip trunk toa FreePBX pbxalready created (and bound to an internal SIP Profile), called 'to_freepbx', so all calls from PSTNwill route to the FreePBX pbx. ($1 under 'Destination' simply means that the call will route to whichever number was dialed from PSTN, since (.*) was used under 'Condition')
Final Dialplan view:
7. Last Step: Bound this newdialplanto the Internal_TDM profile so that the inbound PSTN calls have adialplanto route
Navigate back to 'SIP Profiles' and click on 'Modify' and toggle the 'Routing Plan' to select the newdialplan.
The route from PSTN to SIP is now complete.
Â
SIP to TDM routing
 By default, the MSBG has an internal SIP Profile bound to any live network connections.
For example, the MSBG in the following diagram has an internal SIP Profile created and bound to the eth0-10.10.12.12.
This profile will be used for calls coming FROM sip to be captured on the SBC for routing to PSTN.
Â
If there are no SIP Profiles created (other than the TDM SIP Profile), one must be created Â
To Create a SIP Profile, simply navigate to 'Configuration'->'SIP Profiles' and click 'Add'
Verify the following settings are met:
SIP IP Address: toggle the drop down and select the IP address/Interface where SIP calls will be sent to
Inbound Media Profile/Outbound Media Profile:Â default
The default codec selection contains support for codecs such as G729, iLBC, G.722,pcmu,pcma, so that the device(s) on the SIP side can be restricted to any codec. (The MSBG must be supplied with a DSP transcoder to be able to handle codec mismatch).
Routing Plan: Populate this field with the SIP->PSTNdialplan that will be created nextÂ
allother options can be left at default
example:
Â
Also by default, the MSBG has a SIP Trunk, called TDM_Trunk, used to route calls to the TDM Gateway.
As seen below, TDM_Trunk points towards the IP address 127.100.0.1 which is the IP Address that the TDM Gateway listens on. It is also bound on the Internal_TDM SIP Profile.
If your MSGB does not have a SIP Trunk pointing towards the TDM Gateway, create one now:
Navigate to 'Configuration'-> 'SIP Trunks' and click on 'Add' (as seen above)
Verify the following settings are met:
Domain:Â 127.100.0.1Â Â (this is the IPAdress the TDM Gateway is listening on)
SIP Profile:Â Internal_TDMÂ (or which ever SIP Profile you have created bound to 127.0.0.1)
Inbound Media Profile: Internal_TDM_Media  (This profile must be used when routing calls to TDM because onlypcmu/pcma codec is supported through E1/T1)
all other options can be left at default
Â
SIP to TDM Dialplan Creation
To route all SIP calls to all TDM ports
1. Navigate to 'Configuration'-> 'Routing' -> 'Call Routing', then click on 'Add' under 'Basic Call Routing'
2. Give the newdialplan a convenient name. In this example, 'from_sip' is created to identify calls FROM the SIP, routing TO PSTN
Â
3. Give the new dialplan a Description. (This is optional)
4. Click 'Add', under 'Rule' to create thedialplan
Â
5. Under the 'Condition' section, create the filter that will match inbound SIP calls.Â
To route calls from SIP to all TDM Port, select:
->Â Condition: Standard Information
->Â Name: Destination Address
->Â Expression: (.*)
6. Under 'Actions to perform if condition matches' create the route to TDM where to send the calls to
Select::
Action:Â Bridge to TrunkÂ
Trunk: TDM_Trunk   (This is the trunk that points towards the TDM Gateway at 127.100.0.1, bound to the Internal_TDM trunk)Â
Destination:Â $1 Â Â Â Â Â (Any number that was dialed and captured under 'Condition' with (.*) will be used to call out to the PSTN.
Â
*The above dial plan will route all SIP calls to ALL TDM ports, starting with port 1.
 If your deployment requires you to send calls out to specific TDM ports, follow the below details
Â
To route SIP calls through specific TDM Ports:
To route calls out designated TDM ports only, the Span Group Number must be used when dialing out from SIP to TDM.Â
The SBC Dialplan must call the 'g' variable to indicate that a particular Group (i.e. Span Group) is to be dialed.
Add -g-gX at the end of the Destination information:Â
- To route calls to TDM port 1 only:Â $1-g=g1
- To route calls to TDM port 2 only:Â $1-g=g2
(lower case 'gx' specifies ascending channel dialing order. To send calls starting from last channel use 'G', as in $1-g=Gx)
Â
Thedialplanto dial out TDM port 2 would look like:
However, the above dialplanrule is not yet complete because the 'Condition' statement is capturing every dialed destination, so all calls will go out TDM port 2.
Multiple dialplan rules MUST be created so that only specific rules are triggered which pass calls to unique TDM ports.
One Solution is to create multiple rules to filter on dialing prefix.
Example:
route to port 1:
Calls from SIP with prefix of 5555 will be stripped of the prefix and routed out TDM port 1
Â
route to port 2:
Calls from SIP with prefix of 4444 will be stripped of the prefix and routed out TDM port 2
Final Dialplan view (for SIP calls to unique TDM ports):
Â
Last Step: Bound this new dialplanto the Internal profile so that the inbound SIP calls have a dialplanto route
Navigate back to 'SIP Profiles' and click on 'Modify' and toggle the 'Routing Plan' to select the newdialplan.
The route from SIP to PSTN is now complete.
Â
To apply the completed TDM configuration, navigate to the Configuration icon at the top right of the SBC menu, which will be in Orange color and select 'apply
Â
Start the Netborder Session Controller and TDM Gateway and make some test calls!