Category Archives: Lync

Lync 2013 outbound calls fail after 10 seconds

Recently we encountered an odd scenario with a Lync 2013 install:

  • Dial a phone number from the Lync client
  • Listen to 10 seconds of Lync’s ring tone (DING… ding)
  • The call fails with “The call could not be completed…”

    Call Cound Not Be Completed

Testing the same phone number via a cell phone, we noted the following:

  • About 11 – 13 seconds of silence (no ringing)
  • Phone was then answered by an automated attendant

Using Lync Snooper, we noted the following in the logs.

  • 5025;reason=”Cancel sent by application for INVITE client transaction.”;
    NOTE: This error was generated 10 seconds after the initial SIP Invite
  • A SIP/2.0 487 Request Terminated was sent to the downstream VOIP provider


OK, it appears Lync simply hangs up the phone after 10 seconds if a response is not received by the called party.
Yes, we understand the called phone system was *very* slow, but to simply hang up is rather rude! 

What is really happing is Lync assumes the call failed and is trying to failover the outbound routing… and no failover exists (hence the hang-up)

To correct:

  1. Launch the Lync configuration web page and select Voice Routing
  2. Click Trunk Configuration, double click the Global record
  3. Uncheck Enable outbound routing failover timer
  4. Click OK and commit the changes
  5. Wait 5 – 10 minutes for the changes to take effect

Using FreeSWITCH as a TCP/UDP bridge for Lync

In our Lync lab, we are always running into scenarios where we would like to test various functionality against known VOIP providers and equipment.  This usually results in an increased levels of frustration as Lync does not play well in the land of UDP SIP.  Enter FreeSWITCH.
Over the past two years, we have cooked up several FreeSWITCH configurations which support:

  • UDP to TCP bridging which allows Lync to work with VOIP providers such as FlowRoute and PBXs such as 3CX.
  • Full NAT support for those times when you just have to be behind a firewall.
  • Much better support for direct inbound (private) phone numbers into a Lync system using extensions.
  • Support for non-Lync conference phones such as the Polycom IP 6000.
  • Support for Lync 2010 as well as Lync 2013!

The configurations documented in this article are non-standard and, as such, are not supported by any of the vendors referenced within.  These configurations are designed in, and for a test environment.  Utilizing these configurations in a production environment will be undertaken at your own risk.
(OK, with that out of the way, on to the configurations)

IMPORTANT:  It is recommend you read and understand this entire blog entry before making configuration changes… it’ll make your life much easier.

Article Assumptions about Lync Versions
Lync 2010, 2013, Enterprise, and standard, oh my!
For brevity, this article was written using screen shots of a Lync 2013 Standard Edition install.  Most configuration instructions will directly apply to Enterprise Editions as well as Lync 2010 with some minor tweaking.


  1. A functioning install of Lync front end server
  2. A DNS entry pointing to the location running FreeSWITCH
    NOTE: In this article, the DNS entry is FREESWITCH.MYCOMPANY.COM
  3. Coffee or your caffeine of choice.

Configuring Lync Topology

  1. Launch Lync Server Topology Builder and load the current topology.
  2. Drill down to Mediation pools and highlight the mediation pool which will service outbound calls.
  3. Check the Enable TCP port and verify the TCP port range is set to 5068 – 5068image
  4. Close the dialog
  5. Drill down to Shared Components –> PSTN gateways
  6. Right click on PSTN gateways and select New IP/PSTN Gateway from the menuimage
  7. At Define the PSTN Gateway FQDN, enter your FreeSWITCH DNS entry
  8. At Define the IP address, take the defaults
  9. At Define the root trunk, make the following changes:
    Set the SIP Transport Protocol to TCP
    Set the Listening port for IP/PSTN gateway to 5060
    Set the Associated Mediation Server port to 5068 (it should already be set, but check it)image
  10. Publish your topology


Configure Lync Voice Routing

  1. Launch the Lync configuration web page and select Voice Routingimage
  2. Click Trunk Configuration, double click the Global record
  3. Set the following details for the trunk configuration
    Encryption support level to Not Supported
    Refer support to None
    Uncheck Enable media bypass
    Check Centralized media processing
    Uncheck all others.
  4. Click OK to save the trunk configuration
  5. Create PSTN routes to your preferences
    See for complete details


Configure FreeSWITCH

  1. Install FreeSWITCH using the Complete / Full option
    IMPORTANT: Be sure to install FreeSWITCH on the server pointed to by your DNS entry!
  2. Locate the \conf directory under the FreeSWITCH install and delete ALL the files
  3. Download the FreeSWITCH XML configuration file
    Configuration file (.ZIP’d) is available at
  4. Modify the FreeSWITCH configuration file to meet your needs and copy it into the \conf directory
    See FreeSWITCH Configuration XML below for more details
  5. Locate the FreeSWITCH Multi Protocol Switch service and set the service to Startup type of Automatic

FreeSWITCH Configuration XML

Include Section

  • published-name=SIPGateway
    This defines the name FreeSWITCH will respond with during SIP communication.
    Can be set to any value you desire
  • inbound-sip-port=6000
    The inbound SIP port used by external VOIP traffic.
    Make sure you configure you VOIP provider to communicate with FreeSWITCH using this port.
  • outbound-sip-port=5060
    The port used by your internal Lync and VOIP devices.
  • codec-prefs
    The default codec preferences for FreeSWITCH
  • internal-ip
    The internal IP for your FreeSWITCH server.
    Under a NAT/Firewall scenario, this will usually be a non-routable IP such at
  • external-ip
    The external IP address exposed outside your firewall


Inbound Gateway Profile
See <profile name=”Inbound”>

  • username=none
    Lync does not support user name registration.  Leave as none
  • password=none
    Lync does not support user name registration. Leave as none
  • proxy
    Set to the IP address and port of your Lync server.  I.E.


Outbound Gateway Profile
See <profile name=”Inbound”>

  • username=none
    Username provided by your VOIP provider
  • password=none
    Password provided by your VOIP provider
  • proxy
    IP or URL of your VOIP provider
  • register=true/false
    Set according to your VOIP providers configuration.


Dial Plans
See the .XML file for example inbound and outbound routing.
NOTE: All examples assume Lync is configured with three digit extensions

FreeSWITCH, Lync 2013 and AppFabric
Astute observers will have noticed the inbound (outside your firewall) SIP Port is set to 6000 in the FreeSWITCH configuration file.  This is not by accident.  Lync 2013 uses AppFabric under the hood.   As of this writing of this article, AppFabric will attempt to use several ports between 5060 and 5080.  If FreeSWITCH starts BEFORE Lync, the Lync Server Front-End service will fail to start.  There are two solutions:

Solution #1: Make sure nothing other than Lync’s own services use ports between 5060 and 5080.
This is the solution we selected as it is quick and easy.

Solution #2: Make sure FreeSwitch starts AFTER Lync Server Front-End service has started.


Happy calling!

Installing Lync: HostLocalActivateTask execution failed on an unrecoverable error

In our test labs (and occasionally, at a customer’s site), we will encounter an error running the Install or Update Lync Server System wizard at Step2 : Setup or Remove Lync Server Components.  The error looks something like:

This step will configure services, apply permissions, create firewall rules, etc.Executing PowerShell command: Enable-CSComputer -Confirm:$false -Verbose -Report “C:UsersadministratorAppDataLocalTempEnable-CSComputer-[2013_04_07][11_40_53].html”
HostLocalActivateTask execution failed on an unrecoverable error.

Root Cause

We have seen two primary root causes for this error:

  1. A failed installation of Lync that is being recovered
  2. Installing a fresh copy of Lync on a server which previously had Lync installed

Either way, the error is a PIA as the server has services installed which are causing the wizard all sorts of grief.

Validation of the error

  1. Open Lync Server Management Shell
    Important: Remember to run as administrator
  2. Execute the command Enable-CSComputer
  3. When the command fails, note the location of the detailed results.  This will read something like:
    WARNING: Detailed results can be found at “C:UsersadministratorAppDataLocalTempEnable-CSComputer-d7c83064-2a82-4db9.html
  4. Locate and open the html file.  Review the error It will read something along the lines of
    Error: The service name “RTCnnnn” is already in use


The solution is to delete the services which already exist on the server.

  1. Open a command prompt (CMD)
    Important: Remember to run as administrator
  2. Enter the following command
    sc delete RTCnnnn
    Where RTCnnnn is the name of the service from the log file
  3. Rerun the steps listed in Validation of the error above
  4. Repeat as necessary as there may be more than one service causing problems on your install
  5. Restarting the server is strongly recommended


Lync 2013 Specific Solution

For Lync 2013, we have identified 6 services which consistently cause the HostLocalActivateTask error.  For Lync 2013, we recommend you perform the following solution:

    1. Open a command prompt (CMD)
      Important: Remember to run as administrator
    2. Enter the following commands (execute each separately)
      sc delete RTCCAS
      sc delete RTCCAA
      sc delete RTCCPS
      sc delete RTCRGS
      sc delete RTCPDPAUTH
      sc delete RTCPDPCORE
      sc delete RTCATS
    3. Restarting the server is strongly recommended