Lync 2013 and Fax machines over SIP trunk

Welcome to the world of the unknown.

There are many factors in this equation, and each one has its own influence on the final result. I found out what works for most of my implementations, using the following configurations:

  • I use a direct SIP trunk to an ITSP – walking through firewalls and dedicated routes, but no gateways along the way. I found that converting traffic from analogue to digital to analogue is usually a guarantee to break the connection.
  • My ITSP is NOT Microsoft certified. I can use either TLS or TCP SIP, as long as it works.
  • For any analogue device you’re going to connect to Lync, you’ll need an analogue translation and port. an ATA (Analogue Telephone Adapter) is a small box that knows how to do just that. I usually use AudioCodes MP series ATAs.
  • If I do use a gateway to the PSTN, I’d prefer taking all fax calls and redirect them to FXS ports on the gateway before they arrive to the Lync Mediation server. This way it stays analogue all the way. . I’d strongly recommend having these ports on your gateway as there’s always a use for an extra analogue interface. Trust me.

So Basically, in an ideal Lync implementation, you’ll have the following:


So by now you probably have all of the above, just need to make sure it works. As soon as you have the ATA configured as an additional PSTN gateway, you can go ahead and add the analogue device.

First let’s start with adding the fax as an analogue device:

New-CsAnalogDevice -LineUri tel:+35315556789 -DisplayName "Your Fax Description" -RegistrarPool LyncFE.domain.local -AnalogFax $False -Gateway <Gateway IP or FQDN> -OU "OU=LyncDevices,DC=domain,dc=local"

Now you’re not wrong: It says -AnalogFax $False for a reason. I followed James Cussen’s interesting and very detailed post on connecting fax to Lync, and tested all options until I figured out which one works for me.

Next thing would be to configure your AudioCodes ATA. Assuming you’re comfortable with configuring its IP and DNS settings, I’ll only go through the settings relevant for the fax to work:

Configure Lync as your ATA’s next hop. Go to VoIP-> SIP Definitions-> Proxy &Registration and Choose “Use Default Proxy” and click the small arrow beneath it to enter your Mediation server’s details:

Use default Proxy

Then enter your Mediation server’s FQDN and choose TCP for protocol:

Set Proxy

For fax to go through I configure all fax coding to use G.711:

Go to VoIP-> Media-> Fax/Modem/CID Settings and configure Fax Transport Mode to ByPassEnable.
I usually disable all the other settings as a precaution, but you don’t have to do that. Set your Coder type to Alaw or Ulaw, based on your location:

Fax Settings

Next, go to VoIP-> Coders And Profiles -> Coders and set your coder to Alaw or Ulaw based on your location:

Coder profiles

On the same pane, scroll a little down to Tel Profile Settings and configure the Fax signalling Method to G.711:

Fax Signaling Method

And one more on the same pane, go to IP Profile Settings and configure Fax signalling Method to G.711:

Fax Signaling Method2

Now, configure your fax number for the ATA port you’re going to connect it to. On the following screenshot, I configured port 1 to use the number +35315556789. Remember to use the exact same number you used when ran the New-CsAnalogDevice command, as this is the exact number tat will be sent to the ATA. If the number is different – the ATA will reply with “Number can’t be found”. This is done at VoIP-> Hunt Group-> EndPoint Phone Number:

Endpoint phone number

Next, to allow outgoing faxes through Lync, we’ll need to configure where analogue traffic is going to. Go to VoIP-> Routing-> Tel to IP Routing and configure the IP and port of your Mediation server:

Tel to IP Routing

That’s about it. Fax should be going in and out.

AudioCodes uses an INI file to save the configuration of your ATA. Alternatively, you can upload a file with most of the configurations already done for you and only change the relevant settings.
I created an INI file with all the above configurations, all you’ll have to do is change the IP addresses and names and you can upload it to your ATA to only configure the Endpoint numbers.

Open the INI file with a text editor and search for anything that start with <Change Here = >. Replace the existing values with your values and reboot the ATA.

You can download the file here.



20 thoughts on “Lync 2013 and Fax machines over SIP trunk

    1. Thanks Avi.
      However, this suggests that I terminate the connections at the Fax server, and this is not what this post is about.

  1. Hello
    G711 passthrough especially on MP-112 is very sensitive to packet loss. Remember if your network will loose more than 0,5% of packets you’ll experience speed reduction and pages retransmissions.

  2. Hi,
    What should be in -gateway section? I researched and found I should create a PSTN gateway in my topology with IP address of my ATA? The post mentioned put port 5068 but that port is closed on these ATA devices. Can you perhaps give a paragraph on what to do on Lync server side before the configuration of ATA? I would really appreciate.

    1. Hi Quasar,

      The -gateway should represent the IP or FQDN of your ATA.
      You must add your ATA as a PSTN gateway to your topology.
      You can use any port you choose that the ATA allows you.
      On the Lync Server side I only add the ATA as a regular PSTN gateway and run the following Command:
      New-CsAnalogDevice -LineUri "tel:+35315267890;ext=7890" -SipAddress "" -RegistrarPool LyncFE01.y0av.local -DisplayName "Test Analog Device" -DisplayNumber 015267890 -Gateway -AnalogFax $false -OU "OU=AnalogDevices,DC=y0av,DC=local"

      1. Hi Y0AV,

        Thank you for your reply. I have already got that far. The issue I am seeing now is that when I try to send a fax it gets rejected. I did a packet capture and found something interesting. The SIP invite is actually sent to 416@MY-SERVER-IP where as the destination fax number is 4161111111. I tried this with many different numbers and it seems that the ATA which (as suggested by your post) is an Audio Codes MP sends the fax to the first 3 digits.

        Any idea why that would be?

      2. Hi Quasar,

        AudioCodes gateways have a setting called “Max Digits In Phone Num”. Go to Configuration-> VoIP-> GW and IP to IP-> DTMF and Supplementary-> DTMF & Dialing. This should be the first setting on the page.
        The default value is 3, which explains why you can only send the first three digits of your number. Change that to 30 and submit the changes.

    1. That’s gray area Tony… I consulted my licensing guru and the conclusion was that every device that has a line uri assigned to it, must have a plus CAL. Not an enterprise voice CAL, only the basic and a plus CAL to cover the voice piece. The ATA does not require a license since it’s only acting as a gateway, but every analog device attached to it should be covered by a Plus CAL.

  3. Followed your guide. Thanks for posting it.
    I can call my fax machine, doesn’t seem to be any issues there. But if I try to send a fax, Lync kicks back a 400 Bad Request to the Audiocodes device. Ever seen that before?

    The invite line it is rejecting looks along the lines of:
    INVITE;user=phone SIP/2.0

    1. Got it figured out. My “Gateway Name” on the AudioCodes device under VoIP > SIP Definitions > Proxy and Registration was not set to properly identify my device. I ended up putting in the IP address of the AudioCodes device since I wasn’t using DNS names.

      Thanks again for your excellent post.

  4. First off, thanks for your article, it’s great!

    I used this guide to configure our system with an MP118 and are able to get calls in and out of the device properly.

    However the fax machines seem to be having issues with answering calls. When you call in with a phone you hear the initial handshake squelch for about 2 seconds and then the line goes silent.

    Sending faxes to the machines results in a “No-Answer” failure on the transmitting machines side. Outbound faxes are also a bit hit and miss.

    It almost sounds as though there is some silence suppression going on but I have verified that it is disabled on the device along with echo cancellation.

    Any suggestions?

    1. Hi Ben,
      I suggest tracing the calls and trying to get some information about how the calls are handled.
      Different providers might use different signalling.

      1. Thanks for the fast reply!

        Now the inbound calls are working but not the outbound calls, I get rejected on the Skype for Business Server, did you had this problem?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.