Step-by-step Microsoft Lync 2010, Asterisk and Skype installation/integration guide
Once a year I give my “blessing” to the wife to go away on a long weekend with the girls and usually I try to call in a few child minding favours from my parents/in-laws and this weekend, thank goodness, is no exception to the rule!
Last time I was given these days of peace I wrote a Trixbox/Exchange 2010 integration guide, the emphasis was on this becoming the first in a series of how-to’s – however this never really came to fruition, the reason? Asterisk + friendly UI = Bad bad bad…so from here on in I have chosen to move to AsteriskNOW.
Trixbox is a great distribution of Asterisk, however it does break certain Asterisk standards and you can’t beat a good ol’ command line – yes in Asterisk’s case the command line is easier than a web interface.
So why not plain old Asterisk? AsteriskNOW makes light work of the install and I’m by no means a Linux guru! You can still opt for the FreePBX front end – but we will choose to not go down this dark path – trust me on this!
So let’s talk objectives…
- Setup AsteriskNOW, configuring a SIP extension and corresponding dial-plan
- Install and configure Skype for Asterisk (SFA), ensuring the SIP extension above can route in/out (SkypeOut)
- Take the Lync 2010 Server install performed here and integrate it with AsteriskNOW
- Make calls to and from the Asterisk SIP extension (Lync & SFA)
- Make calls to and from the Lync client (SIP & SFA)
So here is an idea of how this will all piece together:
Sounds like a tall order right? Wrong. With AsteriskNOW and Lync Server 2010, it is reasonably straight forward and I will endeavour to document the end-to-end setup process.
Before I begin let me talk about SFA…
Skype as you may or may not be aware offers two SME level VoIP integrations:-
- Skype for SIP (now re-branded as Skype Connect) – essentially a way of integrating Skype’s cloud of PSTN in/out connectivity including the capability to call Skype users (22.5k online as I type) to an SIP enabled IP PBX – for supported vendors see here.
- Skype for Asterisk (SFA) – an add-on Asterisk channel driver which allows for Skype-to-Skype calls and access to Skype’s uber cheap calling rates via your Asterisk end-point.
If you are already running an Asterisk based PBX you will probably want to know the difference. From a high level it comes down to the following:-
- Cost – Skype Connect is subscription-based, you pay $6.95 per channel plus calling costs – not cheap for those who want to use this for a lab sized implementation.
- Functionality – SFA is not channel-based, it is user-based, for a one off charge of $66 you get a single user license – sounds a bit more digestible, right? A single license would give you one channel. In this guide we will enable a single license be configured to route out from either SIP or Lync end points. From an inbound perspective you could create a Lync response group or Asterisk call group to broadcast inbound calls to multiple users.
One (or should i say three?) last caveat before we get on with the good stuff:-
- Lync is currently in release candidate, it is unlikely to change on a grand scale, but be aware it is not supported by Microsoft
- Lync (or OCS) + Asterisk integrations are not supported by Microsoft
- This is a “just for fun” guide or lab setup only
Okay, with that over with let’s look at requirements
- I’ll be using Windows Server 2008 R2 with Hyper-V to run Lync Server 2010 RC & AsteriskNOW
- I have assigned 2gb of memory to Lync Server 2010 RC and 512mb to AsteriskNOW (I know this seems minimal but it is enough for this small test setup)
- You’ll need to setup a Skype business account as SFA will not work with regular consumer accounts (you can route Skype-to-Skype calls between business and consumer accounts)
- Once you have setup a free Skype business account you’ll need credit as without credit it won’t route out to PSTN. I suggest you test the account by adding it to a Skype software client first (if you hit any roadblocks further down the line you’ll be pleased to have ruled this potential issue out)
- Buy an SFA single channel license which can be purchased directly from Digium, the makers of Asterisk, via their online store (currently at $66) – you’ll get a licence key that we will activate later…
Let’s begin…
Download a copy of AsteriskNOW, I have opted for the 64-bit version here, whilst this is downloading (it is approximately 600mb), let’s setup our VM.
Create a name:
Set memory:
Don’t connect it to your virtual network, we’ll need to create a legacy network adaptor as we are using Linux
I’m going to accept the default options when configuring my virtual disk (this isn’t usually recommended for performance, but for AsteriskNOW it’ll be sufficient)
Once your bootable AsteriskNOW ISO is downloaded, select this as the operating system to boot from within Hyper-V Manager
Our summary, click Finish
Before we kick off the install, you’ll need to go to your settings and add one hardware component, the legacy network adaptor mentioned earlier – and make sure this is connected to your virtual network
Let’s start our VM! Fingers-crossed the AsteriskNOW ISO will boot and the install commences, select option 5 – Asterisk 1.6 only (we need Asterisk 1.6 for TCP support, a SIP trunk requirement for OCS and Lync)
Select yes, to accept the creation of partitions and wiping of data
The default partition scheme is fine, select next. Set your region, select next and create a root (or Administrator) password then click next.
The install will now commence, in my case I’m going to grab some breakfast…!
I’m back and the install is complete, eject your ISO via the Hyper-V toolbar, Select Media -> DVD Drive -> Eject. Then click reboot
During the boot sequence you’ll see a ton of text, which will all (hopefully) end with [ OK ]. Upon completion you will see a Setup Agent, quit this and you will be presented with the screen below.
Login with your root account and start the network configuration utility, type system-config-network. You will then be presented with the screen below
Edit your network device “eth0 – Digital Equipment Corporation DECchip 21140 [FasterNet]”, remove the DHCP option and set a static address, in my case 192.168.10.30
Save and now edit your DNS configuration. In my case I have a local DNS server (192.168.10.253) but set this to suit your needs. I have also set my host name as ast.jacobs.local (jacobs.local is my local domain name) and set the search to my local domain. Then Save & Quit.
Once you are back to the command line type: shutdown –r now this will result in a reboot of the system. Once the system has completed a restart, login again as root. You should now be able to ping from this system to another address on your local network including the Internet (to check this, ping www.bing.com to ensure internet connectivity is working) – if you can’t then something has gone wrong! In some cases I have found that you need to head back into the network settings and re-input the DNS, this issue shouldn’t re-occur.
Now you are back to your Asterisk command line, type yum install register, you’ll be prompted to download the package, accept this by inputting Y and hitting enter. YUM is an abbreviated word for Yellow dog Updater Modified, it is a command line package management tool. The Register package is used to activate your SFA license.
Next we’ll update our version of AsteriskNOW, type yum update asterisk16, accept the upgraded packages (as detailed within our previous step)
Once completed, we’ll install SFA, type yum install asterisk16-skypeforasterisk, accept the package download. Once installed reboot, type shutdown –r now.
Once the reboot has completed login and we’ll register the SFA module (using the license key received from Digium). Login as root and type, register. Select option 1 (Digium Products), then option 7 Skype for Asterisk. Next you will be prompted to enter you SFA key, enter the key and register now. Click the space bar to run through the license agreement (does anyone read these?) and accept the agreement. Complete your personal details and your license should be written to /var/lib/asterisk/licenses/ (you should back this up – I’ll explain this next). But one last reboot first, type shutdown –r now, our Asterisk install is now complete, next we’ll need to configure it!
To configure our Asterisk PBX we need to edit a number of text files, there are Linux-based editors, but in my experience they are not that user friendly and I like to perform this remotely using my friendly Windows PC, to do this you need an SSH client – I use WinSCP. Download a free copy via their website here. Once installed add a new site (see below)
Then change the default remote directory (as per the illustration below) and save the site.
Once saved click login. The first time you connect you will be prompted to save your Asterisk server key, click yes to add the host key to your cache. Finally enter your password, once connected an explorer type view of your Asterisk’s file system will be displayed – I have changed to a detailed view (choose view -> details)
Back-up your SFA license by copying the file from /var/lib/asterisk/licenses – there should only be one .lic file in there, just right click and copy to your desktop to save locally. Now head back to the folder /etc/asterisk – this is where our Asterisk config files are located.
We will be editing three files: (right click and “edit” within WinSCP)
- Sip.conf – for main Asterisk settings (trunks/extensions)
- Extensions.conf – for dial plans
- Chan_skype.conf – SFA settings
First sip.conf, replace the content of your file with the following settings (you should probably backup your original conf files before)
[general] context=default ; Default context for incoming calls allowoverlap=no ; Disable overlap dialing support. (Default is yes) udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all) bindport=5060 bindaddr=0.0.0.0 tcpenable=yes ; Enable server for incoming TCP connections (default is no) tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces) srvlookup=yes ; Enable DNS SRV lookups on outbound calls notifyhold = yes ; Notify subscriptions on HOLD state (default: no) [1001] ; A locally attached SIP extension type=friend callerid=1001 canreinvite=no dtmfmode=rfc2833 mailbox=1001 disallow=all allow=ulaw transport=udp secret=password host=dynamic context=default [Lync_Trunk] ; Our Lync trunk type=friend port=5068 ; This is the default Lync Server TCP listening port host=192.168.10.29 ; This should be the IP address of your Lync Server dtmfmode=rfc2833 context=from-lync qualify=yes transport=tcp,udp
Next extensions.conf, replace the content of your file with the following settings
[general] static=yes writeprotect=no [globals] [default] ;dialling other extensions starting with 1 followed by three digits exten=>_1XXX,1,Dial(SIP/${EXTEN},20) exten=>_1XXX,n,hangup() ;send every digit after 9 to Skype for Asterisk exten=>_9.,1,Dial(Skype/${EXTEN:1},20) exten=>_9.,n,hangup() ;dialling other extensions starting with 2 followed by three digits exten=>_2XXX,1,Dial(SIP/Lync_Trunk/${EXTEN},20) exten=>_2XXX,n,hangup() [from-lync] ;dialling other extensions starting with 1 followed by three digits exten=>_1XXX,1,Dial(SIP/${EXTEN},20) exten=>_1XXX,n,hangup() ;send other calls to Skype for Asterisk exten=>_.,1,Dial(Skype/${EXTEN},20) exten=>_.,n,hangup()
This dial plan will enable call routing between Lync , Asterisk & SFA. Finally configure your chan_skype.conf
You will need to change the default_user to represent your Skype ID, in my case:
;default_user=james_bond changed to (general section)
default_user=imapcblog
update the password
;secret=goldeneye changed to (user section)
secret=myskypepassword
change the default context to match your dial plan
;context=demo changed to (user section)
context=default
route the inbound calls to your Lync extension, in my case 2001
;exten=s changed to (user section)
exten=2001
Once you have configured all three config files reboot Asterisk, type shutdown –r now. Congratulation, your Asterisk configuration is complete! Next we need to configure Lync and pre-supposing you followed my previous Lync install guide here, you will need to head back into the Lync Topology Builder – we didn’t add a PSTN gateway previously. Download your Topology from the existing deployment and save the file locally, then add a PSTN gateway (see both steps below)
Once you have added the PSTN gateway you will have to re-publish the Topology, this will update the existing Topology with the new configuration settings, click finish
To permit call flow between both Lync and Asterisk worlds we need to define our Voice Routing within Lync Server 2010. Open the Lync Server Control Panel and access the Voice Routing options, we’ll need to configure our Dial Plan, Voice Policy, Route and PSTN Usage. I won’t walk you through this configuration (some is based upon location preferences, in my case UK), but I will show you the resulting configuration within the Lync Control Panel.
First the dial plan summary (pay close attention to my normalisation rules) – this will route 1xxx to Asterisk, +44xxxxxxxxx to Asterisk and 2xxx internally (treated as local extension)
Next the Voice Policy, the default Global Policy should have the following PSTN usage records (these rules will handle our calls destined for Asterisk)
and the routes, as follows
Finally the PSTN usage, as follows
In my previous guide we created a test user, that user should now have his or her telephone details set, in our scenario tel:2001 (this is not best practice in a production deployment of Lync/OCS, but as a lab setup with a single PSTN number we should be given a free pass!) typically in production we would assign individual PSTN number and normalise to an internal DDI range i.e. +44208 555 2001 would normalise to 2001 when dialled.
With these settings committed successfully your setup should be complete, calls can now be made between both Asterisk and Lync, to setup a SIP based client I recommend X-Lite (for download and setup instruction follow my previous guide here)
Here we can see X-Lite to Lync
And the reverse Lync to X-Lite
Finally, let’s SkypeOut, first from Lync! (this illustration won’t mean a lot, but you will have to trust me – it works!)
That’s it, whilst I’m sure there are better ways of achieving PSTN breakout from OCS or Lync (with hardware/gateways), there is a certain amount of self-gratification from 100% software based VoIP.
I’m sure my configuration could have been applied in a number of different ways and you’ll probably notice that whilst X-Lite will permit Asterisk-to-Skype calls (dial 9 + Skype name), at this time Lync will not – only numbers can be passed (I’m happy to take suggestions on this). Otherwise let me know if you have spotted any errors or need guidance on issues (I’ll be moderating the comments below) and above all good luck and have some fun!
Great and inspiring article.
Just at this week I have talk with client. He wanted to integrate Skype with OCS (Lync).
Now I can see the way to do it.
Thank you, great article!
Nice article. I’m currently looking for any Remote Call Control help on Lync.
@Doug
Hi Doug, are you referring to RCC functionality within Asterisk?
Thanks for this – much appreciated!
Nice job
Awesome Doug, let me try it and wait for my comments..
I’m having some trouble routing calls even between Lync and Asterisk. How do I configure the mediation server? I cant route from the Asterix out to skype either it seems, but first thing’s first, the internal route.
Thank you for your great blog posts BTW!!
@Fredrik
Can you make calls Asterisk ext to ext? Which version of Asterisk are you using?
Hey there, I am having trouble with the dial in. It answers fine, put in the conf id, thats fine. When it try to join the confernce, it says i can’t connect to the confernce. In the event viewer, all I get is:
User failed to join the conference.
Microsoft.Rtc.Collaboration.ConferenceFailureException:The operation failed due to a response from the server. For more information, examine the properties on the exception and inner exception.
at Microsoft.Rtc.Signaling.SipAsyncResult`1.ThrowIfFailed()
at Microsoft.Rtc.Signaling.Helper.EndAsyncOperation[T](Object owner, IAsyncResult result)
at Microsoft.Rtc.Collaboration.McuSession.EndSendCommandInternal(IAsyncResult result)
at Microsoft.Rtc.Collaboration.AudioVideo.AudioVideoMcuSession.EndTransfer(IAsyncResult result)
at Microsoft.LiveServer.Caa.CaaCall.EndTransfer(IAsyncResult asyncResult, Boolean& retry, Exception& caught)
Detected at System.Environment.get_StackTrace()
at Microsoft.Rtc.Collaboration.ConferenceFailureException..ctor(String message, Exception innerException)
at Microsoft.Rtc.Collaboration.Conferencing.SendCommandAsyncResult.ProcessCccpResponse(SipMessageData messageData, responsetype response, Boolean& isPendingResponse)
at Microsoft.Rtc.Collaboration.Conferencing.SendCommandAsyncResult.ProcessStatusMessage(SipMessageData statusMessageData, responsetype response)
at Microsoft.Rtc.Collaboration.Conferencing.StatusMessageReceivedWorkItem.Process()
at Microsoft.Rtc.Signaling.AsyncWorkitemQueue.ProcessItems()
at Microsoft.Rtc.Signaling.SerializationQueue`1.ResumeProcessing()
at Microsoft.Rtc.Signaling.SerializationQueue`1.ResumeProcessingCallback(Object state)
at Microsoft.Rtc.Signaling.QueueWorkItemState.ExecuteWrappedMethod(WaitCallback method, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
Cause: Administration issues.
Resolution:
Verify that Conferencing Attendant is installed in a supported topology and the dependant Front End servers are functioning correctly.
Help please!!!
I’m wondering if I need to include Mediation server into this scenario or just PSTN Gateway… Please, let me know…
@TreeFox
The mediation service is deployed during the install, for PSTN termination a gateway or SIP trunking is required.
Call forwarding and simul ring to PSTN/Asterisk number does not work with this setup.
@BlaNon
Actually, just the Asterisk extension.
Try forwarding your OCS extension to PSTN or Asterisk extension. If you dial from the phone connected to Asterisk to the OCS extension, the call will not be forwarded. OCS sends the “INVITE” with from=@lyncserver, and Asterisk will not authorize it, except if you set insecure=invite on the Asterisk extension.
There must be a better way tho.
For me trunk between Asterisk & Lync is not showing UP…
asterisk*CLI> sip show peers
Name/username Host Dyn Nat ACL Port Status
1001/1001 192.168.100.100 D 29082 Unmonitored
Lync_Trunk 192.168.100.101 5060 UNREACHABLE
2 sip peers [Monitored: 0 online, 1 offline Unmonitored: 1 online, 0 offline]
I am getting below error for my Lync 2010 RTM trunk. I have configured PSTN gateway with TCP 5060 port without any issues.. I am able to make calls between asterisk extensions & as well as in between Lync extension… is I am missing anything?????
[Dec 1 11:11:36] ERROR[3294]: tcptls.c:350 ast_tcptls_client_start: Unable to connect SIP socket to 192.168.100.101:5060: Connection refused
Now I am able to get my trunk UP,
But not able to make calls in between Asterisk & Lync vice versa…
asterisk*CLI> sip show peers
Name/username Host Dyn Nat ACL Port Status
1001/1001 192.168.100.100 D 51890 Unmonitored
1002/1002 192.168.100.102 D 5060 Unmonitored
Lync_Trunk 192.168.100.101 5060 OK (2 ms)
3 sip peers [Monitored: 1 online, 0 offline Unmonitored: 2 online, 0 offline]
== Using SIP RTP CoS mark 5
— Executing [2001@default:1] Dial(“SIP/1001-0000000a”, “SIP/Lync_Trunk/2001,20”) in new stack
== Using SIP RTP CoS mark 5
— Called Lync_Trunk/2001
— SIP/Lync_Trunk-0000000b is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
— Executing [2001@default:2] Hangup(“SIP/1001-0000000a”, “”) in new stack
== Spawn extension (default, 2001, 2) exited non-zero on ‘SIP/1001-0000000a’
Getting “SIP/Lync_Trunk-0000000b is circuit-busy” error
Can you call out from Lync or Asterisk? Which scenarios work for you?
@Johnny
I noticed an error in my Asterisk SIP.CONF, the default Lync Server TCP listening port is 5068. Change your port and you should be all good (fingers crossed!)
Thanks Adam for this Awesome post. Now I am able to make calls from Asterisk to Lync extension without any issues. Problem was with my Lync extension telephone number previously I used default format (i.e. tel:+2001) that was causing the problem.. I have changed extension to tel:2001 & it works…
Still I have one issue, I am not able to make calls from Lync extension to Asterisk extension, I am working on it…
I would like if you post more on Lync Dial Plan.. This will help newbies like me…
Cheerssss!!!!!!!!!!!!
Hi Johnny,
This is more than likely a dial-plan issue (as correctly identified) – did you permit calls to route to 2xxx extentions via your Lync trunk configuration?
– Adam
Thanks Adam,
It works by adding PSTN gateway route for Asterisk extensions.
Cheerss!!!!!!!
Adam,
Much thanks. You got me rolling on Lync. Now to play and really dig in.
Going to do a little more on your Asterisk integration. I’m pretty familiar with Asterisk and FreePBX (trixbox, AsteriskNow, even my own UI). Perhaps we can add a little more on that config. to a real world scenario for those using FreePBX. Should be able to get some alone time in a week or so.
Hi Adam, I’m glad you have picked up Lync! If you have anything you’d like to contibute please let me know – happy to run a “special guest” article 🙂
All the best, another Adam
@Adam
Adam,
This is almost exactly what i’m looking to do and as a proff of concept was able to get things working with this. However we currently have a decent sized asterisk implementaion that hooks to the pstn. I want to hook things in to make my migration seemless but all the articles i’ve seen say rip out all that is in the cfg files right now.
Do you or anyone else have some guidance on how to integrate lync into an existing asterisk deployment?
Hi Jim,
You may be able to take elements of my code and merge with your existing config (taking into account changes to suit your environment). Is there a specific areas where you are struggling?
– Adam
Hello,
i geht the same error
ERROR[31807]: tcptls.c:367 ast_tcptls_client_start: Unable to connect SIP socket to 172.16.1.155:5068: Connection refused
but if i make telnet 172.16.1.155 5068 (to my Lync Server)
i get the following message
Trying 172.16.1.155…
telnet: Unable to connect to remote host: Connection refused
can anybody help me ?
Adam,
I’m setting up Lync in our test environment. I don’t have my SIP trunk yet, but do have enterprise voice enabled. I have X-Lite 4 downloaded but cannot get it to connect to the Lync server. A sniffer shows X-Lite trying to connect to port 5060 as expected, but when I go to my Lync server, Netstat shows that it is not listening on port 5060? Did I miss a step in installation/setup? I have no devices defined in the Clients tab.
Also could you share a screenshot of your X-Lite account setup page so that I can check my syntax?
Thanks for your help and for a great article.
Bryan Hunt
Hi Bryan, you can’t connect the x-lite client to Lync (only the Lync client can be used here) – configure it to point to the Asterisk server.
– Adam
Hi Goofy, is the firewall running on the server? Are all the Lync services running?
– Adam
Thanks for the response Adam. The Lync client is working perfectly.
Does this imply that MS plans for Lync to be a somewhat “closed” platform as far as SIP devices go? In other words, only phones and soft clients with firmware designed specifically for Lync will be able to connect to it? Not all devices that “speak” SIP?
Thanks.
Bryan Hunt
@Bryan Hunt
Glad to hear it is working Bryan!
Now onto your excellent question, OCS/Lync does utilise SIP, but as with most major telephony vendors it has been “enhanced” to include product specific functionality – as such device firmware needs to support the OCS or Lync SIP specification. Typically these devices will only work with these Microsoft products, however there are signs of change – one example are Snom’s IP Phones, these have dual firmware support. See here for more information.
I hope this helps?
– Adam
Hi Adam, have you perhaps experiences that PSTN Media Gateways for Home Office and are available and working with Lync? Audiocodes and Ferrari SBA’s are out of the question. These are too expensive for me just for testing @ home. Also a matching card from Divacom (for example Diva BRI-2 PCI v2, Diva V-BRI-2 PCI v2) eliminated for cost reasons.
Thanks for suggestions,
Ralf
Hi Ralf,
I am playing around with an AudioCodes MediaPack 114 gateway (chances are I will probably upload config guides in due course) – this device isn’t what I would call expensive approximately £250?
– Adam
Thank you Adam for the tip with the small audio codes device and of course a big compliment for your How-Tos on this Site. Thanks especially for the Lync Asterisk Howto.
Ralf
@Johnny
Hi Adam!
Where do I add the PSTN gateway route for Asterisk extensions?
Thanks
Chris
Solved – On Lync Server under Voice Routing -> Route -> Add Associated gateways
I just implemented this for OCS 2007r2, and, after a few modifications, it works like a charm!
When I bring up the Lync Control Panel, under Topology, what should my Asterisk PBX status be listed as?
Right now I am able to communicate internally between Lync Clients and Tanguay desk phones, but I seem to be having some troubles integrating Asterisk.
I currently use PBX-In-A-Flash for my Asterisk needs. It is Asterisk v1.8 with FreePBX v2.8.
I changed the dial plan to the following (since I live in North America, and my Asterisk extensions are in the 7xx range): http://img24.imageshack.us/img24/500/18534005.jpg
Right now when I try to call externally through my Tanguay phone I get a “Call unsuccessful. Cannot complete the call due to restrictions on your account” error.
And when I try to call through the Lync Client I get this: http://img443.imageshack.us/img443/540/captureodf.jpg
Not sure where to start in troubleshooting this problem.
Any help would be appreciated.
Thanks.
Hi Wayne,
First things first is there a SIP trunk successfully established between Lync/Asterisk? In Asterisk you can check this via the CLI – on Lync the server event log will report trunk related errors. Also ensure your PBXIAF is set to allow TCP – this is not enabled by default.
Let me know how you get on.
– Adam
Hi Adam,
I am using Linksys 3102 as my asterisk gateway to make outgoing calls to external world.. I am able to make calls in between asterisk & Lync extension vice versa without any issue.
Also I am able dial outside numbers i.e. local mobile number from my asterisk extension by dialing 8 then local mobile number & phones .. But i am not able to dial 8 + local mobile number/phone number via Lync client…I have addedd required route on lync control panel..is I am missing anything?
thanks in advance..
Cheers!!!!
Hi Johnny,
There a number of ways this can be achieved, my lab setup was configured to automatically prefix Lync PSTN routes with “9” as per my config – this will route via SFA. I hope this helps?
– Adam
@Calum MacRawe – did you ever get this figured out…I’m having the exact same issue on the final release of Lync.
@Goofy
– firewall is down
– Restart “Lync Server Mediation service” or all Lync service after publishing the topology
– you could be able to telnet your lync server on 5068
This guide is absolutely awesome. I used your Lync step-by-step guide to get a basic Lync server up and running and I’ll probably use this to get some awesome integration going.
Thanks for your feedback!
Hi adam
first i want to say this and the previous guide for exchange um are amazing:)
the coolest thing i ever saw:)
BUT in this guide i just wanted to test lync and asterisk going(no skype)
so i did exactly what you said(besides registering skype part)
and i just cant get this thing to work:(
i cannot dial not from the asterisk and not from lync
i get network busy and busy dial tone.
do you have any idea what i am missing here:)?
(can provide access to my lab if u have time:))
Thanks
small update, i rebooted the lync server and now i can call from lync to asterisk using 1001
but i still cannot dial from asterisk and x-lite to lync, i get busy signal like before
Hi there, firstly thanks for the feedback!
Chances are you have issues with your call routing, specifically within Lync. Does your Lync enabled user have an extension assigned? When calling what is the error reported within the Asterisk CLI – type asterisk -r on your Asterisk command line. Let me know how you get on.
– Adam
mm,
my user name is test
and his line uri is tel:2001
on the asterisk i dont see any specific error(i think) besides:
unable to connect sip socket to 192.168.10.4:5068: network is unreachable.
so i checked my lync server(forgot i had to reinstall my asterisk)
my subnet is 192.168.25.0
255.255.255.0
i changed the lync server entry ofcourse to point to my lync server which is 192.168.25.4
and set all other options and rebooted and still busy signal from x-lite 2001 to lync.
is there something else i need to do like register the 2001 number at asterisks(this is a brand new lab so not the one used for exchange um)
quick question(i know its stupid but still)
when im configuring the x-lite phone i configure it to register/login to the asterisk as 1001 right?
so when i dial 2001 how does it know to forward that to lync because of the trunk and rule we confiured?
another thing:
on my lab i only have 2 things under pstn usage and not 4 like your printscreen shows
i have local route and local extensions(both as global)
now for the weirdest thing:)
i added another xp machine with test2 user.
duplicated the 1001 to be 1002(so i have 2 locally attachwed extensions)
i configured it and logged on and bam
that one works perfect:)
how weird is that:)
i dial 1001 from lync get to x-lite dial 2002 from x-lite get to 1002:)
at this point im clueless as to what the heck is going on with the first user:)
found it:)
i configured user one(test) with topologhy tab
stupid i know
anyway when is set this thing to none all is good.
Thanks again
your hard work is highly appreciated
daily watcher of this web site:)
Used this article (which is brilliant by the way) and have got skypeout working fine, however I have got an online number setup on the skype account but having some issues routing the inbound to the lync client.
Here is what I see in the debug…
[Feb 21 20:13:49] NOTICE[3362]: core.cpp:2146 sfa_call_hangup: ending call
— Executing [2001@default:1] Dial(“Skype/{skype-signin-name}-1f762d98”, “SIP/Lync_Trunk/2001,20”) in new stack
== Using SIP RTP CoS mark 5
— Called Lync_Trunk/2001
— SIP/Lync_Trunk-00000006 is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
— Executing [2001@default:2] Hangup(“Skype/{skype-signin-name}-1f762d98”, “”) in new stack
== Spawn extension (default, 2001, 2) exited non-zero on ‘Skype/{skype-signin-name}-1f762d98’
Any help would be much appreciated!
@Craig Gauntlett
Hi Craig, now if you are trying to get assistance on account of your flattery then you are going the right way about it! 🙂
First off have you given the extension number 2001 to your Lync client? Next how have you triggered your trunk, the busy tone usually indicates a trunk/routing issue.
– Adam
Dear Adam, I have interesting issue.
My Setup:
“Asterisk” “Lync” “AudiocodesMP”
No direct routes between “Asterisk” and “AudiocodesMP”, both configured as voice gate in Lync.
From Lync I can call extensions on both “Asterisk” and “AudiocodesMP”.
From “AudiocodesMP” I was not able to call any extensions on “Asterisk” until i’ve configured New-CSAnalogDevice account in Lync for “AudiocodesMP” (TEL:+900). Now using +900 as CallerID I can call any number from “AudiocodesMP”. When calling +900 from Lync I can reach “AudiocodesMP”.
But when I call +900 from “Asterisk”, always get “SIP 404 Not Found” error. While monitoring Asterisk SIP log, i’ve noticed what when I call +900 from “Asterisk”, Lync is trying to call +900 extension on “Asterisk” instead of “AudiocodesMP”.
I’ve tried to create CSAnalogDevice account for “Asterisk”, when use its TEL:+950 us CallerID when I call from “Asterisk” to TEL:901 (which is routed to “AudiocodesMP”, but this number is not assigned to any Lync account). This Call is routed. But in this case i’m loosing my original Asterisk CallerID and this is not acceptable. Also, call to +900 still fails.
How can I solve my problems: enable calls from “Asterisk” to “AudiocodesMP” thru “Lync” and keep original CallerID?
Wow Igor, this one threw me a little (let’s put it this way I had to get Visio out!)
Q. For you, why are you not using the AudioCodes as a gateway for Lync and Asterisk? If you took this approach you could establish cross extension capability via a Lync to Asterisk trunk.
– Adam
I’m currently testing, but is there any way for Asterisk and Lync to share the same extension? What I’d like to accomplish is to ring our existing Asterisk IP desk phone and ring/show the incoming call on the users Lync client, basically a simultaneous ring using the same extension. Can’t figure out how to do it or if it’s even possible.
Thanks!
Would a simultaneous ring to yor Lync extension not achieve this? I don’t have the code to hand, let me know if I am missing something on this?
Does Skype Connect or SFA (described in article) allow two-way audio communication between cloud of Lync users and cloud of Skype users?
What about the same question about messages exchange between that clouds?
Hi Alex,
Unfortunately Skype does not allocate “cloud-based” DIDs, therefore Lync is unable to normalise the calls for Lync-2-Skype purposes (Asterisk can handle names so this is not an issue here). Potentially you might be able to setup a speedial within Asterisk and assign a number that could be reached via Lync but this starts to get complex.
The biggest win is being able to utilse Skype’s PSTN for outbound and for inbound you can use Skype-in or your Skype ID for other Skype based clients.
I hope this helps?
– Adam
Thanks, Adam,
Surely, we got an comfortable long distance prices from our provider, so cost optimisation via Skype is not an issue.
Problem is that users are requiring Skype to talk, chat and use videoconference with contragents and to minimise long-distance expenses, but this requires Skype client installation and interfere with security policies. Lync 2010 instead, fits the corporate security, meets all the internal corporate needs, but we’re stuck with Skype interoperability.
Potentially, there are number of solutions to integrate Skype and Lync, for example Skystone and Skystone Video. Will evaluate it.
Let me know how you get on Alex.
– Adam
Hi,
I am trying to set up a test environment (XLite–>Asterisk–>MS Lync Server 2010–>Lync Client) similar to that in this excellent guide,
but I’m having trouble calling from XLite to the Lync client.
1. According to wireshark on MS Lync Server, the header checksum of the Internet Protocol in each SIP packet sent by MS Lync Server is 0x0000.
2. I’m also getting the following error according to Lync Server Logging Tool,:
TL_WARN(TF_COMPONENT) [2]143C.133C::04/04/2011-22:45:37.959.00000746 (SIPStack,CSIPRequest::RouteRequestUriOnNonEdgeProxy:SIPRequest.cpp(3441))( 0000000006370440 ) User [2001@appserver.com] is not in enterprise or we do not serve this domain – using 404
TL_WARN(TF_DIAG) [2]143C.133C::04/04/2011-22:45:37.977.00000747 (SIPStack,SIPAdminLog::TraceDiagRecord:SIPAdminLog.cpp(145))$$begin_record
LogType: diagnostic
Severity: warning
Text: Non-trusted source sent an FQDN/IP that doesn’t match a routing table rule
Result-Code: 0xc3e93c5e SIPPROXY_E_ROUTING
SIP-Start-Line: INVITE sip:2001@appserver.com;user=phone SIP/2.0
SIP-Call-ID: 5f803ac8-ece1-47f8-9ac4-0981e5b3b617
SIP-CSeq: 57 INVITE
Data: user=”2001@appserver.com”
$$end_record
Any idea what might be causing these problems? Thanks.
Hi Max,
Stating the obvious first, have you properly assigned the extension no? Next have you looked at the Asterisk logging? Type asterisk -r via the command prompt. Is the trunk up? (again you can check this via the asterisk command prompt “sip show peers”)
Let me know how you get on?
– Adam
Hi, thanks for a great guide, just walked through this and got it all working, Thanks!
The only problem I ran into was that I got no audio from the Skype client to Lync, X-lite -> Lync and mobile (via SkypeIn) -> Lync where fine. The fix I found was to add the following to to chan_skype.conf in the user section
allow=ulaw,alaw
-Stephen.
I have disabled the firewall on Lync Server now the error is
Unable to connect SIP socket to 192.168.22.243:5068: Connection refused
Thanks for posting your workaround Stephen – was this not enabled by default?
– Adam
Hi Syed,
Apologies for not getting back to you sooner (I was on vacation) and thanks for your previous message, given that Windows Firewall is disabled you may want to check the ports – sometimes there can be some confusion on incoming/listening ports.
I’ld suggest you follow defaults and refer to this TechNet documentation for default port definitions.
– Adam
I don’t have a Chan_skype.conf file in the asterisk directory. Is this something I should create manually?
Hi David,
This is usually created when you add SFA – is this installed correctly?
– Adam
Far as I can tell. I added the License Key for the SFA and that didn’t give me any errors and it created the License File.
I’d strongly suggest re-installing something has gone wrong. This should definately be created as a part of the install.
– Adam
GREAT POST!!!!!! Thanks to your hard work I got my environment up and running. Lync users can call X-Lite. X-Lite users can call Lync. X-Lite users can connect out via SIP. Lync users can connect out via SIP. All working like a charm. Not that it happened easily. Some changes were required.
As I’m using another SIP provider and not Skype my dial plan looks like this:
[general]
static=yes
writeprotect=no
[globals]
[default]
;receive incoming calls to a connected phone
exten => s,1,Dial(SIP/1001)
; outbound calls (outside of your own PBX)
exten => _1XXX,1,Dial(SIP/${EXTEN},20)
exten => _1XXX,2,hangup()
exten => _0.,1,Dial(SIP/${EXTEN:1}@2talk)
exten => _0.,2,hangup()
exten => _2XXX,1,Dial(SIP/Lync_Trunk/${EXTEN},20)
exten => _2XXX,2,hangup()
[from-lync]
;dialling other extensions starting with 1 followed by three digits
exten=>_1XXX,1,Dial(SIP/${EXTEN},20)
exten=>_1XXX,n,hangup()
;send other calls to 2talk for Asterisk
exten => _.,1,Dial(SIP/${EXTEN}@2talk)
exten => _.,2,hangup()
This way all calls get routed nicely.
I found following commands very useful:
enter Asterisk: asterisk -r
Reload all config files: reload
Reload only the dial plan: dialplan reload
rebooting my asterisk server takes AGES. So reloading the configs is much much faster. Especially when testing different dial plans.
Thanks Alex (sorry for not getting back to you sooner), really appreciate you sharing this info for other readers.
– Adam
Hi Adam
Nortel CS1000M
/
Great post, I will try this on a topology Elastix – Cisco
\
Nortel BCM50
I guess it will be enough setting up the Lync-Asterisk part, I only have my doubts in the following:
1. Is it possible to have trouble using Asterisk 1.8?
2. Is there any codec support issue with Lync, like using codec g.729?
3. Will this have the same behavior when calling to an Asterisk Queue? because I’m using Elastix call center module and it works based on queues.
4. Is there a how-to for connecting Lync Server with Microsoft Dynamics CRM and Outlook?
If someone has any suggestion on this to be of consideration I will be great full if you share before I start deploying. I shall share the results and hopefully good answers to all this.
Thanks again for the great post.
hehe I guess it did’nt show up as I meant. I will try this in a topology with Elastix working with Cisco, Nortel CS1000M and Nortel BCM50. Wish me luck xD
Hi Andres,
A1. Asterisk 1.8 is absolutely possible for Lync Integration
A2. Lync supports g.711 ulaw/alaw – (supported by Asterisk too)
A3. I have not used Elastix, but I don’t see why not?
A4. So far as I am aware only an OCS -> CRM 4 out of the box integration is available at this time, see here
– Adam
I am really trying to work through this in my lab. I am running 2008 R2 SP1 Hyper-v server. The Linux Integration Tools do not install at all!
I can install Centos 5.2 fine but when I get to the integration tools I cannot access the command line nor install the tools. Any ideas?
Hi Bob,
I didn’t need to install the Linux integration tools, sorry.
– Adam
Hello Adam pls i will like if u can suggest to me a solution to this i got this from eventvwr
The Mediation Server service has received a call that does not support comfort noise. This event is throttled after 5 calls from a single Gateway peer.
The Mediation Server service has received a call that does not support comfort noise from the Gateway peer, 192.168.10.105
Cause: The Gateway peer does not support comfort noise.
Resolution:
Please ensure the comfort noise option on the Gateway has been enabled.
I cant call from my xlite to lync but i can call from lync to xlite
Hi Olay,
The comfort noise issue is unlikely to be the root cause, suggest as a first port of call you look into the Asterisk routing error. Access the Asterisk command line and examine the logging generated wen you try to initiate a call failure. The command line can be accessed by typing “asterisk -r” via the terminal.
– Adam
hi Adams
Thanks a lot i av gptten the error but what am i to do
the error is tcptls.c 350 ast_tcptls_client_start unable to connect sip socket to 192.168.10.20:5060 : no route to host
Within the Asterisk CLI type “sip show peers” – is your Lync trunk up?
– Adam
Adam
I type the command but it returns an error (-bash: sip : command not found)
Hi Ojay,
Try the Asterisk CLI, this is enabled by typing “asterisk -r” from your Linux terminal.
– Adam
HI Adam i am so sorry for disturbing you. i can get the sip peers now the trunk is unreachable. pls go through my configuration
[general]
context=default ; Default context for incoming calls
allowoverlap=no ; Disable overlap dialing support. (Default is yes)
udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
bindport=5060
bindaddr=0.0.0.0
tcpenable=yes ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
notifyhold = yes ; Notify subscriptions on HOLD state (default: no)
[1001] ; A locally attached SIP extension
type=friend
callerid=1001
canreinvite=no
dtmfmode=rfc2833
mailbox=1001
disallow=all
allow=ulaw
transport=udp
secret=password
host=dynamic
context=default
[Lync_Trunk] ; Our Lync trunk
type=friend
port=5068 ; This is the default Lync Server TCP listening port
host=192.168.10.20 ; This should be the IP address of your Lync Server
dtmfmode=rfc2833
context=from-lync
qualify=yes
transport=tcp,udp
Name Host Port Status
Lync_trunk 192.168.10.20 5068 unreacheable
My PSTN GATE is using port 5060
My Mediation Tls listening port:5067
My Mediation TCP listeneing port:5068
i even try to change the PSTN gateway port to 5068 all to no avail all i can get is a call from lync to xlite and not the other way round
Ojay,
You config looks good, something is stopping your Lync trunk from being established (from the Asterisk to Lync) – this is the root cause. Not sure if I have asked, do you have Windows Firewall enabled, could this be blocking the port? Also is 192.168.10.20 the IP address of your Lync server?
– Adam
Here is my issue
I have freepbx and OCS 2007r2
I just upgraded to Lync in parralel
note my connect-with-OCS trunk works fine
my connect-with-Lync trunk for some reason does not
I did reset the TCP listener from 5068 to 5060 on Lync and published it and verified it
yet when I route from-internal to Connect-with-Lync context I get no love
No firewalls are on and there on the same subnet.
If i revert to the working Connect-with-OCS trunk here is what works and what doesnt
and is my real issue.
from PBX sip client (PSC) to Lync user (LU) ext to ext work fine
from LU to PSC client ext to ext work fine
from LU to dial out PBX to my mobile phone works fine
BLOCKER
on the LU i set call forwarding
OCS to LU call forwarding works to mobile fine
LU to LU call forwarding works to mobile fine
PSC client then calls LU ext with call forwarding enabled
and it rings tries to route and fails.
So first issue is How do I get Lync to accept traffic from freepbx
when it has the same settings of my OCS trunks and configs
and my context from internal is pointed to the right trunk?
How do I get Lync to forward calls from a PSC client out to
the public mobile number.
Should I just revert and try to use port 5068 and see what happens?
SIP trace on Lync shows the forward traffic happening but my guess is
The routing rules did not result in a final response for PSTN caller and non-UM enabled callee”;source=”site1pool.foo.local”;Callee=”jdaugherty@foo.com”;appName=”InboundRouting”
Im just thinking since lync anc ocs calls forward correctly that somehow
I have to tell Lync or OCS to look at the PCS client number and that its ok to forward it off.
Hi Bacmallard,
I’ll be honest you have lost me a little! Nevertheless I would definately suggest you revert to 5068, I have this configuration setup and working with the default port configuration.
– Adam
@Bob K
How I got Hyper-V Integration Tools to work with AsteriskNOW (Hyper-V R2 SP1 Host)
Download http://www.microsoft.com/download/en/details.aspx?id=24247 and extract .exe
Mount extraced .iso file in Hyper-V
*Login as root*
yum -y groupinstall “Development Tools”
yum -y update
yum -y install kernel-devel
*Reboot*
*Login as root*
mkdir -p /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp -rp /mnt/cdrom /opt/linux_ic
unmount /mnt/cdrom
cd /opt/linux_ic/
make
make install
*Reboot*
*Done*
Btw: Fantastic article. Now I can finally get some real hands-on experience with Enterprise Voice.
Adam, just attempted to purchase license for AsteriskNOW and it seems that it is no longer available? Am I missing something on there website?
BOO!
Why is Skype for Asterisk no longer available?
Skype for Asterisk was developed as a result of an agreement between Digium and Skype to allow distribution of Skype proprietary software. This software enabled Asterisk to make use of proprietary Skype protocols and participate as a native client on the Skype network. Skype decided not to renew this agreement in 2011, so Digium had to cease sales of the product. Skype for Asterisk will be supported until July 26, 2013.
http://www.digium.com/en/docs/SFA/sfa_faq.php
Dang it!!!!
Hi Ben,
AsteriskNOW is free, download links here
– Adam
Error : SIP/Lync_Trunk-00000004 is circuit-busy Please help me….
Reloading SIP
— Unregistered SIP ‘1001’
— Registered SIP ‘1001’ at 192.168.1.47 port 23436
[Sep 17 17:41:37] NOTICE[3195]: chan_sip.c:23658 sip_poke_noanswer: Peer ‘Lync_Trunk’ is now UNREACHABLE! Last qualify: 1
[Sep 17 17:41:47] NOTICE[4035]: chan_sip.c:18912 handle_response_peerpoke: Peer ‘Lync_Trunk’ is now Reachable. (3ms / 2000ms)
== Using SIP RTP CoS mark 5
— Executing [2861@default:1] Dial(“SIP/1001-00000003”, “SIP/Lync_Trunk/2861,20″) in new stack
== Using SIP RTP CoS mark 5
— Called Lync_Trunk/2861
[Sep 17 17:41:48] WARNING[4035]: chan_sip.c:17726 reply_digest: missing Digest.
[Sep 17 17:41:48] NOTICE[4035]: chan_sip.c:18451 handle_response_invite: Failed to authenticate on INVITE to ‘”1001” ;tag=as790ee8f5’
— SIP/Lync_Trunk-00000004 is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
— Executing [2861@default:2] Hangup(“SIP/1001-00000003”, “”) in new stack
== Spawn extension (default, 2861, 2) exited non-zero on ‘SIP/1001-00000003’
localhost*CLI>
[Sep 17 17:42:51] NOTICE[3195]: chan_sip.c:23658 sip_poke_noanswer: Peer ‘Lync_Trunk’ is now UNREACHABLE! Last qualify: 3
[Sep 17 17:43:01] NOTICE[4039]: chan_sip.c:18912 handle_response_peerpoke: Peer ‘Lync_Trunk’ is now Reachable. (3ms / 2000ms)
[Sep 17 17:44:05] NOTICE[3195]: chan_sip.c:23658 sip_poke_noanswer: Peer ‘Lync_Trunk’ is now UNREACHABLE! Last qualify: 3
[Sep 17 17:44:15] NOTICE[4042]: chan_sip.c:18912 handle_response_peerpoke: Peer ‘Lync_Trunk’ is now Reachable. (3ms / 2000ms)
[Sep 17 17:45:19] NOTICE[3195]: chan_sip.c:23658 sip_poke_noanswer: Peer ‘Lync_Trunk’ is now UNREACHABLE! Last qualify: 3
[Sep 17 17:45:29] NOTICE[4045]: chan_sip.c:18912 handle_response_peerpoke: Peer ‘Lync_Trunk’ is now Reachable. (3ms / 2000ms)
[Sep 17 17:46:33] NOTICE[3195]: chan_sip.c:23658 sip_poke_noanswer: Peer ‘Lync_Trunk’ is now UNREACHABLE! Last qualify: 3
localhost*CLI>
Thanks
Bikash
@ojay
I have same problem trunk is unreachable Please help me
HI Adam i am so sorry for disturbing you. i can get the sip peers now the trunk is unreachable. pls go through my configuration
[general]
context=default ; Default context for incoming calls
allowoverlap=no ; Disable overlap dialing support. (Default is yes)
udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
bindport=5060
bindaddr=0.0.0.0
tcpenable=yes ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
notifyhold = yes ; Notify subscriptions on HOLD state (default: no)
[1001] ; A locally attached SIP extension
type=friend
callerid=1001
canreinvite=no
dtmfmode=rfc2833
mailbox=1001
disallow=all
allow=ulaw
transport=udp
secret=password
host=dynamic
context=default
[Lync_Trunk] ; Our Lync trunk
type=friend
port=5068 ; This is the default Lync Server TCP listening port
host=192.168.10.20 ; This should be the IP address of your Lync Server
dtmfmode=rfc2833
context=from-lync
qualify=yes
transport=tcp,udp
Name Host Port Status
Lync_trunk 192.168.10.20 5068 unreacheable
My PSTN GATE is using port 5060
My Mediation Tls listening port:5067
My Mediation TCP listeneing port:5068
i even try to change the PSTN gateway port to 5068 all to no avail all i can get is a call from lync to xlite and not the other way round
Hi Bikash,
At a guess you have some sort of connectivity/performance related issue impacting the Asterisk -> Lync trunk.
– Adam
Hi Adam,
Great site. Have you ever tried this with Sipxecs?
I setup a gateway to my sipxecs server and a dial plan that routes the calls (with a 46 prefix) but I can’t connect to the server. The client gets a fast busy. One of the errors I see in event viewer on the server is “There was no response from a gateway to an OPTIONS request sent by the Mediataion Server”. Any suggestions?
Thanks for the feedback Mike. I have not played with sipXecs but I know it is popular, without looking into it is your trunk UP?
– Adam
Thanks for reply Now Asteris is Workinf Fine and Also I have configure Elastix GUI for LYNC.
Thanks
Bikash
Glad to hear it Bikash! 🙂
– Adam
Hi!
Thanks for this great guide.
I’m totally new to Lync and SIP telephony in general and have just installed Lync and Asterisk for the first time.
I followed your tutorial though using another SIP provider and was able to make calls to PSTN from X-lite client as well as from Lync clients for a while.
Then this morning I was not able to enter numbers longer than 7 digits excluding the national prefix (in my case +46).
When entering a number in the Lync client it starts searching the address book directly and I am able to press the call button as long as I enter less than 8 digits. But when I enter the 9th digit nothing happens when I press the call button.
I’m not sure but it seems like this happend after I entered my phone numbers in the Lync client configuration. I removed them but the problem persists.
Does anybody have a clue where to start troubleshooting this? Cause I’m clueless. The only thing that differs from your Lync conf is the regexp for national calls which is ^(\+46\d{7}\d+)$ instead. A typical Swedish mobile phone number is +46734123456.
Any help would be greatly appreciated.
Seems like I solved it.
Deleted the GalContacts.db and GalContacts.db.idx files and ran reg add HKLM\Software\Policies\Microsoft\Communicator /v GalDownloadInitialDelay /t REG_DWORD /d 0 /f to force a new address book sync. Also ran the Update-CsAddressBook cmd on the Lync server before starting the client again.
And now it seems like I can make >8 digits calls again. Have not been able to try it since I’m on remote with my lab environment.
Thanks for sharing Nils.
Incidentally you’re doing pretty good considering you’re new to both Lync and Asterisk (my guides are obviously working out too!) 🙂
– Adam
Hello Adam and Nils,
Can you please let me know the other SIP vendors which I can use to call PSTN. Also please let me know the configuration.
I am trying to integrate Microsoft Lync 2010 with Trixbox. I have public line purchased from VoiP operator. I followed guide from this url to configure Trixbox: http://blogs.breezetraining.com.au/mickb/2009/07/31/FinallyConnectedOCS2007R2ToTrixboxAsteriskToAPSTNPBX.aspx
I am able to receive call from public network to my Lync client. However I am unable to call from Lync to anybody in outside world.
I examined the logs on Lync side. There is and error:
Start-Line: SIP/2.0 504 Cannot connect to gateway. Socket error: ConnectionRefused
I also examined logs on Trixbox side with doing: asterisk -r; sip set debug on. When i was placing a call there was no SIP traffic captured on Trixbox server.
I did network trace. I noticed that Trixbox is dropping connection from Lync. Lync sends SYN packet to port 5060 and Trixbox is replying with RST,ACK packet.
Here is trunk configuration from Trixbox to Lync and vice-versa:
[Connect-with-Lync]
disallow=all
host=10.48.22.182 ; Lync server IP
type=friend
port=5068 ; Lync listening port
insecure=port,invite
dtmfmode=rfc2833
qualify=yes
transport=tcp,udp
canreinvite=yes
allow=ulaw
context=from-lync
[from-Lync]
host=10.48.22.182 ;Lync IP
transport=tcp
port=5060 ;Trixbox port
insecure=port,invite
type=friend
context=from-Lync
Could you please help?
If I understand this configuration correctly you have two Trixbox trunks defined (each for calls in/out) – this is not neccessary and will confuse things. I’d suggest you create one and configure Lync accordingly.
– Adam
@JOhnny
hi, My Lync is still showing unreachable on 5060. can help me
I apologize for perhaps a dumb question here. I am aware that Asterisk based solution is about telephony; SIP/IAX/PSTN, etc. Now, Lync, is pure presence/IM platform. What benefit exactly do I get with integrating the two? If the answer is presence of the phone and IM’s then I still do not understand, because I can have OpenFire server on my Asterisk box providing IM/presence for those same extension via AsteriskIM plugin. Again, please correct me if I am wrong or missing something. IF there is a feature I can further enhance my solution, I am open to additional information. thank you.
I am using Bria which has integration with Asterisk, Outlook, and contains presence, click to dial, IM features, etc. What’s the purpose of having a huge product like Lync integrated with Asterisk? From ease of deployment, licensing cost, complexity of management, it seems to be an overkill.
Hi Jeff,
Lync is whole lot more than just presence and IM, since Office Communications Server 2007 the platform has very much incorporated voice, a/v conferencing and collaboration. OCS/Lync integration with Asterisk can deliver a number of benefits, such as the leverage of existing Asterisk PSTN break-out. I can also tell you (based upon traffic statistics that there is a very keen interest – around 150 vistors daily! 🙂
– Adam
Hi Jordon,
Asterisk is a great solution and it certainly offers a lot of capability found within OCS or Lync, I’d also hasten to add that it would never be my recommendation to deploy, support and maintain both products within a production environment. It may however be of value if you are looking to migrate to Lync or leverage existing services already available within your existing Asterisk deployment i.e. PSTN break-out.
Being familiar with both products I will say that you get what you pay for with Asterisk and Lync is now a mature enterprise-ready product with deep integration with the Microsoft stack. Of course if you are a start-up business or Contact Centre running Open Source technology, Asterisk will fit right in.
I hope this helps?
– Adam
Adam, a short question – I am trying to integrate 2 x Asterisk as gateways assosiated with a Mediation Pool consisting of the 3 FEs (collocated Mediation Servers) for some failover/redundancy testing. Do you have an idea how to configure the peer part of the sip.conf to let Asterisk communicate to all 3 DNS load balanced FEs or is this configuration not achievable at all.
Thanks
Hi Paul,
Interesting scenario. I’d probably try using the DNS name as a host (pointed at the pool name) – not sure how Asterisk will handle this though i.e. will it utilise round-robin or just fail…
Let me know how you get on?
– Adam
Hi Paul,
Probably one of the best Lync Asterisk integration guides out there. I’m working dedicatedly on Lync since past couple of years, but totally new to Asterisk. I’m trying to do what Alex did in Post #73 below i.e set this up with a Asterisk Sip Trunk Provider which unfortunately doesn’t work with Lync directly.
I’m using a Public IP on Asterisk and Lync Mediation and using TCP 5060 for communication between Lync and Asterisk. I’m unable to dial from X-lite or Lync and get an error Unable to create channel of type ‘SIP’ (cause 20 – Unknown)
Also sip show peers command shows Lync using 5060 correctly but also shows 1001 client also using 5060 and unmonitored, which should be some random port in my opinion.
Hi Favad,
Is the trunk up between your Asterisk server and Lync? As you previously stated, “sip show peers” will confirm.
– Adam
Hi Adam,
Thank You for your reply. Yes it is up according to the sip show peers command on TCP 5060. Also when dialing from Lync to X-Lite I get 480 temporarily unavailable on Lync Mediation and Sip 404 Not found when I call from X-Lite to Lync
Thank You
Try “asterisk -r” at the command line and replicate a call to see what is going on – it may be a route issue?
– Adam
Thanks for comprehensive – and funny howto. Great work!
arrrgghh okay so I have installed PIAF purple and trying to move off my old pbx that I had working with Lync just fine.
Where im at… Lync snooper logs simply state when placing a call to PIAF
Start-Line: SIP/2.0 503 Service Unavailable
CSeq: 1 INVITE
Call-ID: 37181e8685284502afb58faa5b279eb4
VIA: SIP/2.0/TLS 10.15.2.39:57786;branch=z9hG4bK62FB59E9.62B9C8E23E28080F;branched=FALSE,SIP/2.0/TLS 10.15.16.52:50364;ms-received-port=50364;ms-received-cid=3A49500
CONTENT-LENGTH: 0
SERVER: RTCC/4.0.0.0 MediationServer
ms-endpoint-location-data: NetworkScope;ms-media-location-type=intranet
ms-trunking-peer-state: down
ms-trunking-peer: 10.15.3.2
ms-enable-dns-failover: yes
ms-diagnostics: 10001;source=”site1pool”;reason=”Gateway did not respond in a timely manner (timeout)”;component=”MediationServer”
ms-diagnostics-public: 10001;reason=”Gateway did not respond in a timely manner (timeout)”;component=”MediationServer”
Message-Body: –
$$end_record
I have successful results in my sip peers that show OK in my Lync Trunk
My objective as it was before was to have all calls from lync route to either outside
if a public number dialed and be able to call PBX extensions as well.
Im not worried about anything right now but having the Lync be able to connect
I did switch my old ports from 5060 to 5068 triple checked Lync ports and config
patched and restarted Mediation services
As long as I can see traffic I can get through the rest. But for the life of me right now
I cant dechiper why Lync is stating the its trunking peer state is down.
Also in PIAF purple sip.conf is explicity stated not to edit it and to add your configs to sip_general_custom.conf instead
mine looks like this
tcpenable=yes
tcpbindaddr=0.0.0.0
alwaysauthreject=no
[Connect-with-Lync]
type=peer
host=10.15.2.39
qualify=yes
transport=tcp,udp
canreinvite=yes
allowexternalinvites=yes
port=5068
dtmfmode=rfc2833
disallow=all
allow=ulaw
context=from-lync
My Lync trunk has two entries as it did on my old pbx that was working just fine
except for the port change from 5060 to updated 5068
Connect-with-Lync
Outgoing settings
type=peer
host=10.15.2.39
qualify=yes
transport=tcp,udp
canreinvite=yes
allowexternalinvites=yes
port=5068
dtmfmode=rfc2833
disallow=all
allow=ulaw
context=from-lync
INCOMING Settings:
User context from-lync
type=peer
host=10.15.2.39
qualify=yes
transport=tcp,udp
canreinvite=yes
allowexternalinvites=yes
port=5068
disallow=all
allow=ulaw
context=from-lync
From this it looks at though your Asterisk server is talking to Lync, but Lync is not talking to Asterisk. Check your Lync SIP trunk out within topology builder – is it set to 5060?
– Adam
ok switched it to 5060 that seems to have done the trick
Thanks ADAM
I got traffic now just on to call routing from here so ill see how PIAF purple places contexts. Ill add my update here as well.
Question: Subject SIP Trunks:
My current sip trunk has only one DID is it possible for a SIP provider to have mulitple DIDs supported on a single sip trunk?
If so whats the average capacity per sip trunk to support multiple call volume. I know its based off of internet bandwidth but that aside whats the ball park capacity?
Call forwarding from Asterisk to Lync then forwarding calls from Lync back out Asterisk PBX
So say I want Lync users to utilize there client as there soft phone. That user wants to forward calls from Lync to their cell phone. That call will route out my Asterisk box.
I discovered that if you set a password on your Asterisk extension and have Lync set to Forward the call. It translates the call back to Asterisk as a known extension from an outside source (Lync) in this case that is attempting to say hey Im one of your extensions please forward this call.
The only work around I found wich is not ideal but does work is if you do not set a password on the extension. This way Asterisk does not try to validate a known extension from outside and allow it to pass the traffic.
Anyone try this or have a different way of engineering it to work with the Asterisk extension and having success forwarding Lync calls out?
Absolutely, you can have a range of DDIs assigned to a trunk. Capacity is based upon network capability and any associated service provider restrictions.
– Adam
Last at last, Okay so I have everything back on 5060 and now all seems to be happy again.
My last nudge here is. I want to set the follow me settings on the PBX to the Lync Extension.
I can dial the Lync number from PBX just fine but when I set the follow me settings to
5516 (lync extension) or 5516# it fails to forward over. Any ideas on how to get the follow me to ring to the Lync extension?
@bacmallard
Okay so couldnt find any hacks for the follow me to work
i set my Lync ext and my mobile in the PBX follow me list and ringall
It would go to Lync but then roll over to the cell
bit of duct tape here
What I did was create to local extensions 5516 and changed the context SIP to dial my lync extension over the trunk
I then set up extension 4416 and changed the context SIP to dial my cell phone number over the ExternalProvider trunk
set confirm calls
and now everything works just fine with ringall forward me
my office sounds like a ring tone party 🙂
@bacmallard
I’m trying something similar with PIAF. I have a working PBX with a Google trunk.. works really well. Now I’m trying to get the SIP trunk between Lync and the PBX up but just having a horrible time!. when you said you switched everything to 5060 do you mean even the config on Lync? did you switch 5068 to 5060? Cause for the life of me I can’t get the trunk to come up.
Have you enabled SIP over TCP on PIAF?
A