Friday, April 1, 2011

Analog Phone support with Lync 2010

In some cases, we must retain certain analog phones in our otherwise VoIP environment. Let’s configure Analog Device support in our Lab.

This task requires the following steps:
  1. Configuring Gateway in our Lync Topology
  2. Configuring the Gateway (AudioCodes MP-114 in this case) to work with Lync
  3. Create contact Analog Device object in Lync.

As we can see, no mediation server is associated.

At this point, TB detects our topology is not valid.

Let’s associate the gateway with our co-located mediation.

***Note that I will use TCP and also the default ports to make it simple.

Now Lync is “happy” and we can publish the topology.

***ALERT! Always pay attention if there is a message from TB. In this case I am reminded two things – I must run “local setup” i.e. Lync Server Deployment Wizard on the front end (because the mediation is co-located and we just enabled TCP. Lync Mediation, as its predecessor OCS R2 Mediation, does not support dynamic change of ports thus the service must be restarted in order to star the listener on the new/changed port.

After completing the above steps, I will now move to AudioCodes (a.k.a. AC) gateway.
Refer to the AC documentation as of how to access the device for first time. Once done, the first step is to provision an IP address which we will use in conjunction with Lync.

Next, we will set “Use default Proxy” to “Yes” if it is “No” as in this case

At this point, proceed to “Proxy Set Table” and configure our “Proxy” (Mediation Server FQDN or IP address).

***Note that here I specified the port number. This is because above, we set Lync Mediation to listen on port 5068.

Navigate to “Sip General Parameters” and modify the following:
  1. Enable Early Media – Enable
  2. Fax Signaling Method – G.711 Transport
  3. SIP TCP Local Port – 5066
***This is because in our Topology, we specified Gateway Listening port = 5066

Navigate to “EndPoint Phone Number” and enter the phone number for this analog device. I will use “fake” number for our test. The reason I use 14785552020 and not E.164 is because in the previous post I instructed Lync to remove “+” from any outbound routing.

Navigate to “Hunt Group Settings” and configure as follow:

Make sure “Max Digits in Phone Num” is bigger than the phone number you intend to dial out.

***MP-114 have two FXS ports i.e. we could have as many as two analog phone connected to it, furthermore we want the phones to be discovered “By Dest Phone Number”

Go to “IP to Trunk Routing” and modify as shown:

Let’s now create our Analog Device contact:

New-CsAnalogDevice -LineUri tel:+14785552020 -DisplayName "My Test Analog Device" -RegistrarPool fe.drago.local -AnalogFax $False -Gateway -OU "ou=Telecommunications,dc=drago,dc=local"

This should be sufficient to test our Analog Phone.

From the analog phone, dial 14785554040 (the number of my Lync User 2). 

From Lync client, dial 14785552020 (the analog device phone number).

This is very simple setup. There are more advanced features like TLS inmplementation, FXO ports configuration etc, but for now our POC was successful.


Jack said...

Did you get this to work with TLS yet?

Drago said...

I have not (with MP-114 and the current firmware). Completed TLS setup on Mediant 1000 MSBG, which worked just fine with TLS.

I will test with MP-114 and post the result one of the next days.

Real said...

Drago, nice share..

I am using Audio Codes MP124 (24 port) with Lync to use my old analog phones..


Jack said...

I am using the MP124 also.

martin said...

Hey this is a much more simple setup than what is provided by audiocodes themselves: they are describing a complicated setup to route calls between a mediant 1000 gateway and mp-11x, which route calls to central gateway, back do mediation, then to ata, well let's have a look page 97

Drago said...


There is an obvious mismatch between the diagram and the actual implementation. While on the diagram ATA (Analog Device Adapter) devices are shown, the M1K configuration calls for FXS module installed on the chassis, which perhaps AC calls ATA.

In any case, the big question one must ask himself is – What is my environment and what my goal is. I worked with a company where even thou small, the number of analog devices (phones, faxes, paging systems etc.) were significant. The company elected to purchase MP-124 with 24 FXS ports and use it to provision all analog devices, while for PSTN connectivity a Direct SIP Trinking is utilized.

martin said...

Thanks for your reply.

No, audiocodes is clear: their setup concerns both embedded FXS and ATA devices (seperate parts in the doc). See Audiocodes deployment for lync page 97. There is a diagram with FXS and MP 1XX devices. However I suspect it reproduces an OCS 2007 setup and does not make use of the new analog device feature in Lync.

My deployment has one ATA with a Fax Machine, that's all. Mediant 1000 as pstn GW, Lync SE. Small deployment. I was able to configure my MP 112 with TCP and then TLS, just to match all pre-requisites/best practice. I configured media bypass just as requested (trunk on gw, trunk global, global network config). I am able to ring and call from/to internal analog device. I am able to send fax to the outside. However I cannot reach the analog device from the outside.

I have traced the thing (snooper). As far as I understood, the mediation server is supposed to instruct the media gateway (pstn mediant 1000) to reach the MP-112 directly (media bypass). It never does. It tries inbound routing, says "request was proxied to one or more registered endpoints" and then tries next hop, i.e. outbound routing and sends the call to the outside, we get a loop that will eventually die. Absolutely no reference to the ATA in the trace.

Any idea of what I miss ? Other incoming pstn calls work fine. It's just as if it ignores the fact this number is registered as analog device. Do we need to set up this ip to ip so that the media gateway reaches the ATA once the call is sent back to the pstn gw, as audiocodes suggests ?

Drago said...

I would call this a "bad case of copy and paste"

This statement - "The enterprise has deployed Audiocodes' Mediant 1000 Media Gateway. This Media gateway is connected with several trunks to the legacy PBX/PSTN, and provides integrated analog (FXS ports) card that serves analog fax machines" actually represents the real situation on my opinion.
I have not tested fax scenario yet,but no one could possibly design a device that would need two more devices in order to provide interop with Lync.
I would try to provision Analog Fax and have the fax machine directly connected to the M1K's FXXS port.

martin said...

More update...

I troubleshooted media bypass. I can see the effect of enabling it for calls through the Mediant 1000 and the ATA (incoming/outgoing pstn calls, internal calls to the ATA. wireshark udp rtp packets. enable: to gateways, disable: to mediation server)

However as a result I get exactly what is told in case of no bypass:
The gateway must present fax calls to Lync Server as G.711 audio calls; if presented as image calls, they will be rejected. These calls will be hairpinned to the gateway from which they were received. Bypass causes the hairpin to be moved to the gateway.

I tried a dirty configuration to route the incoming pstn calls directly to the ATA (from the mediant 1000), and declare the mediant 1000 as a proxy in the ATA. So I completely bypass lync (losing CDR, for what it's worth in this case...), but at least my fax answers. No deep tests at the moment since I don't know where I'm exactly going with that :)

Actually I do not have any FXS on the Mediant. And the documentation may be wrong, but for sure they did not mismatch FXS and ATA. ATA in their diagram have specific IPs (FXS don't), and 5.2 describes Analog Devices (ATA’s) Configuration Assuming the ATA devices are AudioCodes MP-11x series, the following configurations should
be made:
I think their configuration is a workaround of the hairpinning with no bypass, no analog devices declared, but still the call go through lync. And since the diagram refers OCS, I think this is an older config. Anyway I cannot set it up: I have no ip2ip license...

martin said...

concerning audiocodes, I have re-read all doc, and implementation corresponds to the diagram, you have routing to ATA devices and configuration of the ATA themselves.

back to lync, I set analogfax to $false and not only the call is now correctly routed to the ATA but I can receive/send fax from the PSTN, 10 out of 10 tested outgoing and incoming, so I get confused :-S. Bypass is working, I have direct RTP between my PSTN and my FXS ATA gateway, G711 of course in this case, Transparent fax detected, perfect transmission...

analogfax $true is what makes the call routed back to the pstn. I guess I misunderstand MS doc and this hairpin is a normal behavior for fax calls. And as it is told by MS, fax machines "must" be connected to a gw with PSTN. So it must be the same gw for pstn and fax if I correctly understand their best practice design, and calls are routed back where they come from to avoid mediation server and IP transmission of packets... And this is kind of consistent with Audiocodes scenario, which adds ip to ip routing from gw to ata on top of that.

Another goal of this feature would be in case of several fax machines connected to lync and calling each other, if it's fax call it will re-route through PSTN as well, using TDM rather than IP for fax transmission (as explained here )

Now it seems I have two dirty workarounds, cheating about not being a fax and having media bypass g711 btw gateways. This transparent fax over ip setup is supported in other vendors infrastructure as Cisco so I don't understand why it's not here, while it is working fine -for now.

The other one is routing to the ATA directly from the PSTN gateway and bypass all Lync infrastructure, which I guess would be ok for a standalone fax machine that do not interact with the rest of lync.

Well, sorry for the long comments, I try to share my experience and understanding in RT :)

John Crouch said...

Martin, it sounds like we have had similar experiences.

I have Dialogic DMG gw to pstn, AC MP-124s with analog phone & fax, and Lync FE. I am not using Media Bypass right now, however.

I also saw the analogfax $true issue of calls going through Lync not going to the MP-124. I have implemented "Lync Bypass", where all inbound and outbound fax calls go directly between the Dialogic and AudioCodes gateways, bypassing Lync entirely.
Unfortunately, I have found reliability of fax, especially inbound, to be not good.

I would be curious to know what fax settings your are using for your MP-1xx - FaxTransportMode & IsFaxUsed.

martin said...

Actually I posted a more precise comment but it was never published.

Basically I think I misunderstood MS technet doc:
hairpinning is a normal behavior when you set your analog device with analogfax to $true. It routes the call back to the PSTN Gateway which must handle the call (connect its FXS, and since media bypass is configured, the RTP flow will go directly from the GW to the FXS port bypassing mediation/lync server). This is as design and avoid Fax over IP while keeping signaling / CDR in Lync. If you have 2 fax machines in Lync in two different site communicating which each other, analogfax $true will also enable them to communicate through PSTN rather than IP. So basically what MS says is that your fax must be connected to the PSTN GW.

To get a fax working on my ATA without complex routing what I did is set AnalogFax to $false so my call gets routed to the MP-1xx like a normal phone. As I have media by-pass configured everywhere in Lync, RTP flow goes directly from PSTN gw to ATA. So it is "clean" "direct" G711 IP traffic. Then in the gateways I set up G711transport as fax signaling. And I have my faxes in and out is this "by chance" ?

Without media by-pass and correct GW setup, you'll go through mediation server, so your call gets proxied and may even be transformed depending on your setting (codec, srtp etc). While this is ok for voice call (you will still understand whatever the codec is), analog fax signaling cannot survive that.

Anthony said...

Hi Drago

I have many audiocodes 1000 deployed as lync gateway and my only issues with these is getting analog devices working via FXS ports on the device

I am not using the Lync Csanalog methtod but doing the routing all on the Audiocodes 1000

I would love for Lync to take care of this have you had this working correctly in your deployments?

Anonymous said...

Hi Drago,
Great post as reference for use with MP114. I have MP114 [ Firmware Version 5.80A.023.006 ] with 4 FXO ports (different from what you have used).
Will this works with Lync 2010?
It's few years old, no support.

When trying to call to external lync client just end with error "The call could not be completed due to a busy network. Please try again later."

Any ideas what's wrong?

Can you please post (or email) your exported lync server Voice Routing configuration?


Lync Server Reports' call diagnostic shows:

Diagnostic header:

10025; source=""; reason="Gateway peer in outbound call is not found in topology document"; component="MediationServer"

Additional Diagnostic Header
12006; reason="Trying next hop"; source=""; PhoneUsage="PSTNUsage1"; PhoneRoute="Route1"; Gateway="172.x.x.x"; appName="OutboundRouting"

Arve said...

Great post, was really helpful as we're deploying Lync for over 100 MP-112's.

I have to questions which I've been unable to find an answer to:

- Is it possible to get presence from a MP-112?
- Is it possible to associate the analog device contact with an AD user?

Drago said...

Analog phone provides two presence states only - "Available" and "On call"

As of the second question... I don't think this is possible and if someone managed to do it - it is definitely not supported.

Arve said...

Thanks for the reply, Drago.
I've tried following your guide for use with an MP-112, and I'm only getting status as "Offline" for the boxes.

I assume that it's probably just a misconfiguration somewhere, either with the analog device or with Lync, but have you encountered this problem before? And if so, what did you have to do to fix it?

Tom said...

Hi Drago.
Is it possible to have a screenshot showing the presence of an analog device?
Working with Arve on this one, and we're having trouble figuring out how this is supposed to work...

Subin John said...

Hi Drago,

The set up worked just fine with myLync 2010 and 2 analog phones on MP-114. There is a small problem. Whenever a call is placed to the analog phones, the phones do not 'ring', but i can see the Caller ID on the phone display. When we pick up the analog phone to answer, it sort of dials out and then the call is connected. Any clue on this :-(

Drago said...


I do not have this device on hand at the moment, but if remember correctly, the gateway is the one that sends presence update (on hook = Available; Of Hook = On call).

make sure you use latest firmware compatible with Lync 2010.

Drago said...


On SIP General Options, make sure you set "Enable Early Media" to "Enable" and "Play Ringback tone to Tel" to "Play local until remote media arrives"


Neil O'Connor said...

Has anyone used the lower cost Cisco/Lynksys SPA 112, We need POE for our application and this ATA is the only one at the necessary 5 Volts.

Anonymous said...

Hi Drago,

thanx for great post. We have an interesting issue. We are using Lync 2010 with AC MP 112 for analog fax devices. We are able to receive fax messages but cannot send fax message. When I test it with analog phone I'm able to receive calls and make calls to any PSTN without any problem.

Any advise?

Thanks Matej

Okan Bostan said...

Hi, thanks for your post,
I'm using audiocodes Mediant 800, could you help me configuring it? It's hard to find a guide about it.
I did the similar settings as menationed in this post to my m800&lync2013 enviroment. But I cant call outgoing numbers.
Also I used AC mp118 and its working.

Regards, okan.

Hany Abd El-Wahab said...

Hi, dargo Really excellent post
did any required version of Gateway's Software to do that?

Drago said...

The latest publicly available firmware from the manufacturer’s site is always preferred.

David Holt said...

You have any updated documentation for Lync Server 2013. For the most part I'm able to follow along by finding the new sections in Lync 13 but I'm still having some trouble with the MP-114.

KP said...

Iam having a hard time getting my fax machines to work. Starts recieveing the fax but then it hangs up. My Incomming sip provider (interoute) does not support Media bypass so its not enabled on the incomming or in the global setting. Could that be the problem and is there a work around?

Hemang Shah said...

Fax over SIP Trunking is not supported in Lync 2013.