Home Development of Communication Systems PSTN Gateway for Lync Server based on FreeSWITCH

PSTN Gateway for Lync Server based on FreeSWITCH

by admin

One easy way to connect your Lync Server to any IP telephony provider.
A small but significant obstacle for using Lync Server as the basis for corporate telephony can be a feature of its work with the SIP protocol.The feature is completely incompatible with the standards of IP-telephony providers.Lync Server supports TCP or TLS and can’t transfer the credentials, while the IP-telephony providers in their turn mostly use UDP and require authorization with login and password.

Task

Find the easiest and simplest solution to organize a gateway. Ideally, it should be free, stable and on Windows.

Solution

FreeSWITCH in the lowest possible configuration, sufficient to connect on one side to Lync Server and on the other side to authorize from IP telephony providers.
PSTN Gateway for Lync Server based on FreeSWITCH
FreeSWITCH was not chosen as a basis for the solution by accident. Ideologically, it is quite a powerful platform-router of multimedia traffic streams with the ability to connect additional handlers in the form of plug-in modules. The Lync <-> FreeSWITCH <-> PSTN configuration is just the simplest case corresponding to the FreeSWITCH architectural model.

Topology

It all depends on the configuration of the particular network and the existing telephony load. Both are viable, either with FreeSWITCH installed together with the Mediation Server (or Standard Edition) role, or on a separate server.

Setting up

The whole setup process is very simple and consists of 3 steps :

  1. Creating SIP trunks in Topology Builder
  2. Lync Server Setup
  3. FreeSWITCH Setup
  4. Creating SIP trunks in Topology Builder

    Open an existing topology in the Topology Builder. In the properties of the Mediation Server, turn on the TCP port (for example 5068). Create a new PSTN Gateway object (the name and address can be specified either for a single server, or for a joint installation). In the SIP trunk parameters specify the port where FreeSWITCH listens (e.g. 6000), TCP protocol (in this example), Mediation Server port (5068).
    PSTN Gateway for Lync Server based on FreeSWITCH

    Configuring Lync Server

    Open section Voice Routing
    In subsection Trunk Configuration we open the rule Global For the parameter Encryption support level select Not Supported , for the parameter Refer support None Check the box. Centralized media processing and uncheck all the others.
    PSTN Gateway for Lync Server based on FreeSWITCH
    In subsection Route create a rule to route calls to external numbers to the SIP trunk to our gateway.

    FreeSWITCH setup

    Download and install FreeSWITCH. Delete all the contents of the conf folder in the installation directory. Instead of deleted files unpack the archive with the configuration (link at the end of the post).
    In the folder confpstn specify the credentials in the file template for one of the providers and delete the extension ".noload" from it. If your provider does not have a template in the folder, you can take any template as a basis and copy it to a file without the extension ".noload". As a result, you should have one or more .xml files with the parameters of the current ISPs.
    In the freeswitch.xml file we specify the address (fe.lab.local in our example), port (5068) and protocol (tcp) of the Lync Mediation Server, local address and port (6000) to connect to the Lync Mediation Server, local address and port (5060, but can be any) to connect to the PSTN provider.
    At the end of the file in the "dialplan" section in the "from_Lync" context for <extension name="RouteToPSTN"> in the "action" rule specify the name of the gateway from the profile of the active PSTN provider, to which all external calls from Lync will be sent. If there are several providers, you should create call routing rules. You can do this in Lync itself, but it’s better to describe in a separate article.
    FreeSWITCH can run as a console application and as a service. After entering the parameters in the configuration template, it is necessary to run the console application and check whether the Profiles and Gateways are connected. To do this at the command line, run the command :

    sofia status

    PSTN Gateway for Lync Server based on FreeSWITCH
    If both profiles and gateway (to PSTN) are successfully started and connected, you can close the console with the command ". (three dots), start and put the FreeSWITCH service on delayed autorun.
    The gateway is set up!


    Configuration template for FreeSWITCH: freeswitch.conf.lync-pstn.zip
    Enjoy it!

You may also like