How to establish a SIP trunk between ScopTEL IP PBX and Microsoft Lync

We will see in this article how to configure a Scopserv system so it can communicate with Microsoft Lync/OCS

Two steps are required in order to use an external link, and two other steps are optional:

  • Creation of a VoIP Account
  • Creation of an incoming line (optional)
  • Creation of an outgoing line (optional)
  • Update of the appropriate Class of Service (CoS)


Creation of the VoIP Account

In the Telephony -> Interface menu , in the VoIP Account tab, click on ‘Add New VoIP Account ‘

In General tab, set:

  • Type: SIP
  • Trunk Type: Friend
  • Name: LyncGW

In Server tab, set:

  • Host Mode: Specific
  • Host/IP: (your Microsoft Lync Server host/IP)
  • Port: (optional; your Microsoft Lync Server port, default to 5060)
  • Register as User Agent? (optional)

In Network tab, set:

  • Transport Mode: Both (UDP and TCP)
  • Trunk behind a Nat (optional; set only if required)
  • Unsecure Port and Invites (optional; required for incoming calls)
  • Qualify? (optional)

In Options tab, set:

  • DTMF Mode: Automatic Mode DTMF (RFC2833/Inband)

Network Tab: Check boxes: Trunk behind a Nat, Unsecure Port and Invites (required for incoming calls), and Qualifier
Options Tab:  Automatic Mode DTMF (RFC2833/Inband)

Save configuration.

Creation of incoming line

In the menu Telephony –> Lines, incoming line Tab, click  ‘Add a new line’

In General tab, set:

  • Type: Extension (DNIS)
  • Extension (DNIS): Set the incoming line DNIS
  • Trunk: Select the trunk created in the previous step, in this case LyncGW

In Destination tab: Select the desired destination, such a position.

Save configuration.

Creation of an outgoing line

In the menu Telephony –> Lines,  outgoing line Tab, click  ‘Add a new line ‘

In General tab, set:

  • Name: The name of your line, for example LyncGW_Out
  • Trunk: Select the trunk created in the first step, in this case LyncGW

In Dial String tab: You specify the dial string used to make a call using this outgoing line. Simply put in first, choose a custom dial string and enter ‘X’. This configuration is not adequate but to validate the operation.

Save configuration

Update the Class of Service (CoS)

In the menu Telephony –> Manager, Class of Service Tab, choose the Class of Service where you have defined your internal extensions.

Outgoing Lines tab:  Either you check the ‘Allow all outgoing lines’ or you include the LyncGW_Out line in the list authorized lines.

Save configuration


Lync Configuration (Standard Edition)


  1. Open the Lync 2010 Topology Builder
  2. Edit the properties of your standard edition pool
  3. Install the mediation server, I used the Collocated option because load is low enough it doesn’t need a dedicated server.
  4. Under mediation server take note of the TCP Listening port, as that is the port you need to specify in sip.conf of Asterisk.  It defaults to 5068 so that’s what I used.
  5. At the bottom find the section “The following gateways are associated with this mediation server.”
  6. Click New, and enter the IP address of your Asterisk server, and the port you use for Asterisk TCP SIP (5060 by default).
  7. Note that mine has a red X saying i already have this address configured.  This is because I was redoing the steps for this tutorial.  Also note I have two gateways added as my Asterisk server has multiple IP Addresses and you must make sure to enter all addresses in the gateway list.
  8. Once this is done make sure to publish your topology and re-run setup if you did not previously have the mediation service installed.  I restarted my entire Lync server at this point but if you’d prefer you should be able to restart the Mediation service to apply the new settings.
  9. Open your Lync control panel, go to users, edit your test user and enable Telephony for Enterprise Voice.
  10. We use 2XXX range extensions in Lync, and 1XXX range extensions in Asterisk, so you will see tel:+2593, and ext=1593.  The ext=1593 is for PSTN Conferencing support so Lync can see me
    call from 1593 and know I am Andrew, and automatically authenticate me in to my own conferences..

  11. Configure Voice Routing -> Dial Plan.  These are the rules I wrote in OCS 2007 R2 and imported using import-cslegacyconfiguration.  You will need to tweak them for your requirements.
  12. At this point you should be able to make/receive calls to and from Lync/Asterisk.