Configure Failover Routing with AudioCodes Media Gateways: Part 4

This is part four of a four-part article that explains how to configure AudioCodes Enhanced Gateway components for branch office locations. Correct gateway configuration ensures that your Lync Server 2010 environment will continue to function even if a Survivable Branch Server or Survivable Branch Appliance is not available. Part one explains the need for failover routing and how to add a Survivable Branch Server to a Lync Server topology. Part two explains how to configure basic settings on an AudioCodes Media Gateway. Part three details how to define proxy sets and IP groups. Part four delineates how to configure PSTN trunk settings.

Author: Ryan Gates

Publication date: October 31, 2011

Product version: AudioCodes Firmware v6.2

Part four is not a universal deployment guide. Many of the sample screen shots are for illustrative purposes only. The settings for each deployment are dependent on the specific PSTN integration scenario and Lync Server dial plan. Work with your Telco provider to determine the settings for your specific situation.

Configure PSTN Trunk Settings

After the steps outlined in parts one, two, and three are complete, all IP communication settings are configured. The branch office scenario outlined in part one supports one or more T1/E1 trunks. These trunks are connected to the PSTN to provide inbound/outbound call routing. Configuration of T1/E1 trunks requires information from your telecom provider. This ensures that the correct settings are synchronized on both sides of the T1/E1. To configure the TDM Settings:

1. In the left pane click the Configuration tab.

2. Select VoIP –> TDM –> TDM Bus Settings.

3. Configure the PCM Law Select to either MuLaw or ALaw depending on the requirements of your PSTN provider (see Figure 1).

4. The TDM Bus Clock Source setting determines where the Media Gateway receives clock synchronization information. Setting this to Network allows the Media Gateway to receive clock synchronization information from the PSTN side of the T1/E1. This configuration setting depends on your PSTN provider.

5. The TDM Bus Local Reference defines the physical trunk ID where the clock synchronization is received. If you are unsure of what these settings should be, work with your local telco or PBX vendor to determine the correct TDM settings.

6. Click Submit to save and continue.

Figure 1. Configure PSTN Trunk Global Settings


After the global TDM settings are defined, individual trunk settings can be defined.

  • Select VoIP –> PSTN –> Trunk Settings.

At the top of the Trunk Settings pane there is a status indicator for each PSTN trunk port configured on the Media Gateway (see Figure 2). This guide does not detail the configuration of PSTN trunks for use with an AudioCodes gateway. Once the T1/E1 modules have been installed, work with your PSTN provider or PBX vendor to determine the appropriate settings needed to match the far end of the T1/E1 connection. After the configuration is correctly established, all configured PSTN trunks show green.

Figure 2. Define PSTN Trunks


After all PSTN trunks are properly configured, assign each PSTN trunk to a Trunk Group. This routes calls to the correct trunks.

  • Select VoIP –> GW and IP to IP –> Trunk Group. This screen allows you to configure multiple T1/E1 trunks into one or more Trunk Groups (see Figure 3). Trunk Groups are comprised of T1/E1 trunks or FXS ports depending on which modules are installed on the Mediant 1000 MSBG. The sample configuration contains four T1/E1 ports configured in a single Trunk Group ID. This allows outbound calls from Lync Server to the PSTN to use any of the 4 configured T1/E1 ports.

Figure 3. Define Trunk Groups


After the Trunk Groups are configured, use the Channel Select Mode to configure which channels on each trunk are selected. Figure 4 illustrates Channel Select Mode of Cyclic Ascending for all T1/E1 ports configured as a part of Trunk Group ID 1.

Figure 4. Trunk Channel Select Mode


Configure Routing

All IP settings and Trunk Groups are now configured. The next step in the deployment process is to define the routing settings. Routing settings determine how calls are routed from Lync Server to the PSTN (IP to Trunk Group) and from the PSTN to Lync Server (Tel to IP).

1. In the left pane click the Configuration tab.

2. Select VoIP –> GW and IP to IP –> Routing –> General Parameters.

3. Set the Enable Alt Routing Tel to IP to Enable. This configuration allows the Tel to IP routing table to be used when communication with the Default Proxy set is unavailable (Survivable Branch Server in this example scenario).

4. Configure the Alt Routing Tel to IP Mode to Both.

5. Set the Alt Routing Tel to IP Connectivity Method to SIP Options.

6. Click Submit to save changes and continue.

Figure 5. General Routing Configuration


To define the routing rules used for Tel to IP calls (PSTN/PBX to Lync).

  • Select VoIP –> GW and IP to IP –> Routing –> Tel to IP Routing.

This configuration sends all calls to IP Group 1 (see Figure 6). This includes calls from any gateway, with any destination telephone number format, with any source telephone number format. IP Group 1 was defined earlier and contains the IP addresses or DNS names of the Mediation Server pool located in the regional data center.

Note. The Tel to IP routing table rules are used if the servers defined in the Default Proxy Set (0) are marked as down by the Media Gateway. This route sends all calls to IP Group 1 if the Default Proxy Set is unavailable.

Figure 6. Tel to IP Routing


Routing from the PSTN to the Lync Server environment is now configured. To configure calls from Lync Server to the PSTN/PBX use the IP to Trunk Group routing table.

Select VoIP –> GW and IP to IP –> Routing –> IP to Trunk Group Routing.

Figure 7 shows a simple configuration in which all calls received by the Media Gateway are sent to the PSTN trunks located in Trunk Group 1. If necessary, additional advanced routing rules can be configured to conform to your environment.

Figure 7. IP to Trunk Group Routing


The last routing configuration marks a remote gateway as down when a SIP 503 message is received (see Figure 8).

1. In the left pane click the Configuration tab.

2. Select VoIP –> GW and IP to IP –> Routing –> Alternative Routing Reasons.

3. In the Tel to IP Reasons section, select Reason 1 and configure a value of 503.

4. Click Submit to save changes and continue.

Figure 8. IP to Tel Reasons


To account for the different options included with a SIP 503 response, add a configuration parameter to ensure that remote gateways are properly marked as down (Lync servers in this example).

1. Navigate to the Admin interface by appending /AdminPage (case sensitive) to the URL of the web interface. For example: http://<IP of Mediant 1000>/AdminPage.

2. In the navigation pane on the left select ini Parameters.

3. In the Parameter Name: text field type a value of FAKERETRYAFTER in upper case.

4. In the Enter Value: text field type a value of 60.

5. Click Apply New Value.

6.  See the Output Window (see Figure 9) for a description and assigned value of the parameter.

7. In the left navigation pane use the Back to Main option to return to the main web UI.

Figure 9. Configure FAKERETRYAFTER Value


Configure Telephone Number Manipulation

After all procedures outlined in parts one, two, and three are complete, the AudioCodes Media Gateway is fully integrated with Lync Server 2010. The final step is to configure the source and destination telephone number manipulation rules. Changing source and destination telephone numbers to the correct format is handled in different ways and differs with each deployment. The following sections outline samples for modifying source and destination telephone numbers.

Destination Telephone Number Manipulation

This article is not a deep dive into creating Lync Server dial plans, trunk configurations, and so forth. Consult with the Lync Server documentation to find specific configuration instructions.

Manipulation of a called telephone number is completed by the AudioCodes Gateway or by Lync Server using dial plans and trunk configurations. Tel to IP calls (PSTN to Lync Server in this example) sent to the Mediation Server are normalized based on the dial plan used by the Mediation Server.

The preferred option uses a Lync Server dial plan to normalize telephone numbers originating from the PSTN/PBX. This allows for centralized management of the normalization rules needed to manipulate the numbers. To view the dial plans defined in your Lync Server environment used to manipulate the “called” telephone number for calls coming from a PSTN gateway:

1. Open the Lync Server Control Panel.

2. Select Voice Routing –> Dial Plan.

See Configuring Dial Plans and Normalization Rules for additional information.

In reverse (Lync Server to the PSTN) the called telephone number is manipulated using Lync Server trunk configurations. To view the trunk configurations created in your Lync Server environment:

1. Open the Lync Server Control Panel.

2. Select Voice Routing –> Trunk Configuration.

See Defining Translation Rules for additional information on the creation of Lync Server trunk configurations.

Source Telephone Number Manipulation

The source telephone number (calling party) cannot be modified in Lync Server and must be handled by the AudioCodes Gateway.

In a properly configured Lync Server environment, the source telephone number is always an E.164 formatted number (+15554731234). Many PSTN circuit providers and PBX vendors cannot properly handle a telephone number beginning with a “+”.

The Source Phone Number Manipulation Table for IP strips the left two characters for any call with a source number that starts with a “+” character. Assuming that the user making the call has a properly formatted E.164 telephone number, this process strips the source number down to last 10 digits (see Figure 10).

Note: This example applies to North American telephone numbers starting with a + followed by a country code of 1. If your telephone numbers are outside of North America, an adjustment to the rule below will be necessary.

1. Navigate to VoIP –> GW and IP to IP –> Manipulations –> Source Number IP -–> Tel.

2. In the text box next to the Add button type the number 1 (see Figure 10).

3. Click Add.

4. In the Destination Prefix type *.

5. In the Source IP Address type in match all Called telephone numbers and source Lync Server Mediation server.

6. In the Source Prefix field type +. This matches telephone numbers that start with +.

7. In the Stripped Digits From Left field type 2. This strips the left two digits.

8. Click Apply to save the new rule.

Figure 10. Configure Source Number Manipulation


This procedure manipulates the calling number (+15554256765) on a Lync to PSTN call. It removes the +1 and leaves only the right most 10 digits. Your environment may require additional rules depending on your specific dial plan and PSTN integration scenario.


When the procedures described in parts one, two, three, and four are complete, the AudioCodes gateway is integrated and configured with the Lync Server environment. In the event of an outage of the Survivable Branch Appliance or Survivable Branch Server, branch office calls are handled by one or more Mediation Servers located in a regional data center. If Media Bypass is configured correctly, the only additional network overhead to the WAN connection is the additional SIP signaling traffic. The media traffic stays local to the branch site.

This article outlines the high level steps necessary to configure PSTN connectivity, Calling/Called party manipulation, and routing with the AudioCodes gateway. Additional dial plan modifications may be necessary for your environment, but the configuration outlined in this four part series should lay the groundwork for a successful AudioCodes Mediant 1000 MSBG deployment to integrate PSTN connectivity with your Lync Server environment.

Additional Resources

Keywords: AudioCodes, Failover, Routing

Comments (4)
  1. Adminiuga says:

    On figure 7, I'd recommend specifying a "source IP" matching your mediation server and enable "secure incoming calls" in gateway configuration. You will need a line per each of your mediation server. Otherwise, anyone with access to the IP address of the gateway can make calls to the PSTN directly with any SIP endpoint.

  2. Ryan Gates says:


    Great suggestion, thank you for the comment.  The article was really meant to focus on the need for and configuration of alternate routing with the AudioCodes product.  There are a number of additional configuration options that should be considered when deploying a Media Gateway in each environment that were not placed in this sample configuration.  

  3. Mark King says:

    Great Job Ryan!

  4. says:

    Ryan, Thanks for sharing this. It helped us to resolve one of issue.

Comments are closed.