PSTN gateway for Lync Server based on FreeSWITCH
One easy way to connect Lync Server to any IP telephony provider.
A small but significant obstacle to using Lync Server as the basis of corporate telephony may be the peculiarity of its work with the SIP protocol. The peculiarity lies in complete incompatibility with the standards of IP-telephony providers. Lync Server supports TCP or TLS and cannot transmit credentials; IP telephony providers, in turn, mainly use UDP and require authorization by login and password.
It is not by chance that FreeSWITCH was chosen as the basis for the solution. Ideologically, this is a rather powerful platform-router of multimedia traffic flows with the ability to connect additional handlers in the form of plug-ins. Lync configuration <-> FreeSWITCH <-> PSTN is just the simplest case corresponding to the FreeSWITCH architectural model.
In the Trunk Configuration subsection, open the Global rule . For Encryption support level, select Not Supported , for Refer support - None . Set the Centralized media processing checkbox and remove all the others.
In the Route subsection, create a rule for routing calls to external numbers on a SIP trunk to our gateway.
In the \ conf \ pstn folder, specify the credentials in the file template for one of the providers and delete the extension “.noload” from it. If for your provider the template is not in the folder, then you can take any as a basis and copy it to a file without the extension “.noload”. As a result, one or more .xml files with the parameters of the existing IP-telephony providers should remain.
In the freeswitch.xml file, specify the address (fe.lab.local in our example), the port (5068) and the protocol (tcp) of the Lync Mediation Server, the local address and port (6000) for connecting to the Lync Mediation Server, the 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 context of from_Lync forin the "action" rule, specify the name of the gateway from the profile of the current PSTN provider, to which all external calls from Lync will be poisoned. If there are several providers, you must create call routing rules. You can do this in Lync itself, but this is better described in a separate article.
FreeSWITCH can run as a console application or as a service. After entering the parameters in the configuration template, you need to start the console application and check whether the profiles and gateways are connected. To do this, the command is executed on the command line:
If both profiles and gateway (to PSTN) successfully started and connected, you can close the console with the command “...” (three points), start and set FreeSWITCH service to delayed startup.
The gateway is configured!
Configuration template for FreeSWITCH: freeswitch.conf.lync-pstn.zip .
Use for health!
A small but significant obstacle to using Lync Server as the basis of corporate telephony may be the peculiarity of its work with the SIP protocol. The peculiarity lies in complete incompatibility with the standards of IP-telephony providers. Lync Server supports TCP or TLS and cannot transmit credentials; IP telephony providers, in turn, mainly use UDP and require authorization by login and password.
Task
Choose the simplest and easiest solution for organizing a gateway. Ideally, free, stable and on Windows.Decision
FreeSWITCH in the smallest possible configuration, sufficient for connecting on the one hand with Lync Server and on the other for authorization with IP-telephony providers.It is not by chance that FreeSWITCH was chosen as the basis for the solution. Ideologically, this is a rather powerful platform-router of multimedia traffic flows with the ability to connect additional handlers in the form of plug-ins. Lync configuration <-> FreeSWITCH <-> PSTN is just the simplest case corresponding to the FreeSWITCH architectural model.
Topology
It all depends on the configuration of a particular network and the current load on telephony. Both options are viable, both with the installation of FreeSWITCH together with the role of Mediation Server (or Standard Edition), and on a separate server.Customization
The whole setup process is extremely simple and consists of 3 steps:Creating SIP Trunks in Topology Builder
Open the existing topology in Topology Builder. In the properties of the Mediation Server, enable the TCP port (for example, 5068). We create a new PSTN Gateway object (you can specify the name and address of either a separate server or Mediation in case of a joint installation). In the parameters of the SIP trunk, specify the port on which FreeSWITCH is listening (for example, 6000), the TCP protocol (in this example), the Mediation Server port (5068).Configure Lync Server
Open the Voice Routing section .In the Trunk Configuration subsection, open the Global rule . For Encryption support level, select Not Supported , for Refer support - None . Set the Centralized media processing checkbox and remove all the others.
In the Route subsection, create a rule for routing calls to external numbers on a SIP trunk to our gateway.
Configure FreeSWITCH
Download and install FreeSWITCH. We delete all the contents of the \ conf folder in the installation directory. Instead of the deleted files, unpack the archive with the configuration (link at the end of the post).In the \ conf \ pstn folder, specify the credentials in the file template for one of the providers and delete the extension “.noload” from it. If for your provider the template is not in the folder, then you can take any as a basis and copy it to a file without the extension “.noload”. As a result, one or more .xml files with the parameters of the existing IP-telephony providers should remain.
In the freeswitch.xml file, specify the address (fe.lab.local in our example), the port (5068) and the protocol (tcp) of the Lync Mediation Server, the local address and port (6000) for connecting to the Lync Mediation Server, the 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 context of from_Lync for
FreeSWITCH can run as a console application or as a service. After entering the parameters in the configuration template, you need to start the console application and check whether the profiles and gateways are connected. To do this, the command is executed on the command line:
sofia status
If both profiles and gateway (to PSTN) successfully started and connected, you can close the console with the command “...” (three points), start and set FreeSWITCH service to delayed startup.
The gateway is configured!
Configuration template for FreeSWITCH: freeswitch.conf.lync-pstn.zip .
Use for health!