Asterisk Configuration
First, I configured my Asterisk installation, you have to enabled TCP SIP, and create a peer. I added the following to the sip.conf general section:
[general]
tcpbindaddr=0.0.0.0
tcpenable=yes
and then I added my peer for Lync
[LYNC_TRUNK]
type=peer
host=192.168.11.4
qualify=no
transport=tcp,udp
canreinvite=no
port=5068
disallow=all
allow=ulaw
context=from-ocs
I used the context from-ocs, so I set up a basic context in extensions.conf, cutting off the + that comes through and sending the call to the normal internal call context for normal call handling:
[from-ocs]
exten => _+1XXX,1,Goto(internal-call,${EXTEN:1},1)
exten => _+1XXXXXXXXXX,1,Dial(SIP/${EXTEN}@OUTBOUND_PROVIDER,30)
exten => _+1XXXXXXXXXX,1,Dial(SIP/${EXTEN}@OUTBOUND_PROVIDER,30)
You will need to make a test extension in your normal dial context to test calling in to Lync, something like this should work
exten => 1000,1,Dial(SIP/+2593@LYNC_TRUNK,30)
After restarting asterisk that side of things should be configured, now just to make sure you have Lync configured.
Lync Configuration (Standard Edition)
- Open the Lync 2010 Topology Builder
- Edit the properties of your standard edition pool
- Install the mediation server, I used the Collocated option because load is low enough it doesn't need a dedicated server.
- 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.
- At the bottom find the section "The following gateways are associated with this mediation server."
- Click New, and enter the IP address of your Asterisk server, and the port you use for Asterisk TCP SIP (5060 by default).
- 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.
- 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.
- Open your Lync control panel, go to users, edit your test user and enable Telephony for Enterprise Voice.
- 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..
- 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.
- At this point you should be able to make/receive calls to and from Lync/Asterisk.