Configuring AudioCodes MP-112 VoIP Gateway for Fax with Asterisk

I am setting up an Asterisk/Elastix system to work with a Cox PRI circuit, and I needed a gateway for managing faxes.  I had previously used the AudioCodes MP-202, which was fairly easy to set up, but that one is no longer available.  Its replacement appears to be the MP-112.  However, the setup is far more complicated, largely because the MP-112 has a lot more capability, but also because the defaults for the MP-112 were not helpful for my application.

This is a very flexible computer and router, capable of mastering DHCP, acting as a firewall, etc.  However, it is set by default to intercept any faxes and route them via T.38.  T.38 only works if the receiving system is expecting T.38 (Asterisk is not capable of taking T.38 and turning it into a regular fax).  If you don’t disable the T.38, simple faxes might squeak through, but even full page faxes will get intercepted.  The symptom will be that only part of the fax page goes through.

Configuring the MP-112 requires first configuring it to register as a SIP extension, and then configuring it to send calls to the Asterisk server (as the “proxy”), and then disabling fax detection so that fax calls go through as regular voice calls.

You connect to the MP-112 via the web interface.  The default IP is 10.1.10.10 .  The default username is Admin, and the default password is Admin .   Note that I (and others) have had trouble with Safari caching a cookie or something and having trouble authenticating.  I had better luck with Firefox or Chrome.  Note that, with Chrome, when I pressed the ‘t’ key, the whole page cleared!  If I needed a ‘t’, I was able to get it by pasting the text in.

For troubleshooting, you can view the MP-112’s log from the Status and Diagnostics tab, under the Status and Diagnostics folder within that tab, as “Message Log”.  Note that, as long as you are on that “Message Log” tag, the log is running.  I was able to select all and then copy the log to TextMate to review it.

Also under Status and Diagnostics/Gateway Statistics is “Registration Status”, which tell you whether your SIP “phones” have registered properly, as well as lots of other diagnostics.

Whenever you want to save the changes you have made on a page, click “Submit”.  You should do that for every page before leaving the page.  To save the changes permanently into flash (so they are not lost when the device is unplugged), press the “Burn” button.

There is lots of documentation on these very complex devices on the AudioCodes website.  This is just a “quick-start” for the common use case (for me) of using the AudioCodes to connect a fax machine or analog phone as a SIP extension on an Asterisk system.

Before you start, go to the Management tab, Software Update/Configuration File — from here you can download the configuration file from the MP-112 that describes the factory default.  If you ever want to go back, you can also upload a configuration file.  Once you get it working, after burning your configuration into the flash rom, save a configuration file so you can always go back.  With the hundreds of configuration settings for this device, the configuration file also gives you an easily-visualized view of the changes you have made.

AudioCodes nicely documents the configuration file format.  In the configuration file, there are sections indicated by [section name].  Those sections are only for human consumption, and do NOT have any effect on the function of the configuration file.  Thus, you can change the configuration file, and don’t have to worry about the sections.  The exception is the table configuration.  Tables are bounded by [ TABLENAME ] … [ TABLENAME ].  The tables have a very specific format, and for tables, the “section” names DO matter.  Also, if a configuration setting is not mentioned in the config file, generally a documented default is used.

When making changes to a page, be certain to hit the “submit” button on EACH page.  Don’t forget to hit “burn” when you are done.

First, you may want to go to the Configuration/Network Settings/IP Settings, and set the IP address,netmask, and default gateway.  Alternatively, the MP-112 will read its information from a DHCP server, if one is available, if DHCP is enabled on the device.  If you use DHCP, you will need to figure out the IP address assigned, so you can access the web interface.  If DHCP is available and enabled, it seems to override the setting under IP address.

The DHCP option is under Configuration/Network Settings/Application Settings/DHCP Settings/Enable DHCP, but it is hard to make it “stick” — Section 10.1.8 of the User Manual indicates that you have to do a reset with the reset button — however, that did not work for me.  I had to click “Submit”, and then “Burn”.  Then, unplugging and replugging the power cord worked to cause DHCP to be used.

Once you have IP configured, you have to get both ports to register with the SIP server (Asterisk) and route calls.

Regarding the call routing, the MP-112 can use a SIP proxy, a routing table, or both.  Unfortunately, the defaults do not favor either option.

Under Configuration/Protocol Configuration/Proxies-IPGroups-Registration/Proxy & Registration/Use Default Proxy, set this to Yes.  This is “IsProxyUsed” in the config file.  In the Proxy Sets Table (the button is on the same page), put the IP address of your Asterisk server under Proxy Address, and UDP under transport type.  You only need the one proxy, so just fill in the first line.

You need to set the authentication to Per Endpoint, so that each port can register. Set Configuration/Protocol Configuration/Proxies-IPGroups-Registration/Proxy & Registration/Authentication Mode to “Per Endpoint” Then, you need to set Configuration/Protocol Configuration/Proxies-IpGroups-Registration/Proxy & Registration/Enable Registration to Enable.

Open the Authentication page:Configuration/Protocol Configuration/Endpoint Settings/Authentication and enter the SIP username and password for each endpoint.  Each endpoint is configured as a separate extension.  In Elastix/FreePBX, the username is typically the extension number, although that’s not the most secure way to configure your PBX.

On Configuration/Protocol Configuration/Endpoint Number/EndPoint Phone Number, you can set the extension number for each of your ports.  If you put 1-2 under “Channels”, the “Phone Number” is the phone number for the first FXS port, and the phone number for the second is the phone number for the first, plus one.  If you put “1” under channel in the first line, and “2” under channel in the second line, you can assign independent extension numbers for each port.  Press “Register” to register with the Asterisk server.  You can check whether registration worked under Status & Diagnostics/Gateway Statistics/Registration Status, and/or from the CLI interface on Asterisk using SIP SHOW PEERS.

Make sure that the MP-112 shows “Registered” for your ports before you move on.

Next, you need to set Max Digits in Phone Num (Configuration/Protocol Configuration/Protocol Definition/DTMF and Dialing/Max Digits in Phone Num) to something like 30 (or at least a number no less than the greatest number of digits you want to be able to dial).  If you don’t, the default is 3, and every time you enter three digits, the MP-112 will try to connect the call using only those three digits.

Now, if SIP registration is working, you should be able to make phone calls into and out of your MP-112.  Test that before working on the fax setup.  You can use the Status & Diagnostics/Status & Diagnostics/Message Log to see the SIP messages and additional debugging info, but be certain NOT to leave that as the active tab in your browser.

Now, for the fax handling:

On the configuration/Protocol Configuration/Coders and Profile Definitions/Coders page, I left only G.711A-law and G.711U-law as the codecs being used.  If you want to use different codecs, enter them here, but some compression schemes may not work well transporting faxes.

To avoid the T.38 fax interception described above, you will need to use “Fax / Modem Transparent Mode”, as described in section 8.2.6.2.7 (page 252) of the MP-112 users manual.  This page shows the parameters you want:

First, set IsFaxUsed = 0 ; This is at Configuration/Protocol Configuration/Protocol Definition/SIP General Parameters/Fax Signaling Method: 0 = No Fax

Then, set FaxTransportMode = 0 ; This is at Configuration/Media Settings/Fax-Modem-CID Settings/Fax Transport Mode: 0 = Disable = transparent mode

Then, set the transport types:

V21ModemTransportType = 0 ; at Configuration/Media Settings/Fax-Modem-CID Settings/V.21 Modem Transport Type: 0 = Disable = transparent mode

Do the same for V22ModemTransportType = 0 (disable) , V23ModemTransportType = 0 (disable) , V32ModemTransportType = 0 (disable), V34ModemTransportType = 0 (disable)

The docs also say to set BellModemTransportType = 0 , but that is apparently NOT in the web interface.  However, 0 = disable is the default for BellModemTransportType.

Note that those parameters are as shown in the configuration file.  They are described in the table in section 10.9, “General SIP Parameters”. IsFaxUsed is mentioned on page 385. It is ISFAXUSED in the configuration file, and it is under Configuration/Protocol Configuration/Protocol Definition/SIP General Parameters/Fax Signaling Method in the web interface.

At this point, I was able to send and receive faxes with no problem.  If you have trouble, be sure to check out the troubleshooting tips above.

Yealink SIP-T38G Openvpn VPN not functional

Update — the nice people at Voipsupply.com got me a firmware upgrade (38.0.0.70) which is not posted anywhere on the Yealink website.  Although it does cause the phone to upload the vpn configuration file, it still doesn’t work.  Specifically, a Wireshark trace shows absolutely no packets going to the openvpn server.  That is in contrast to the exact same process on the T28 using the same configuration file (I know, but we are testing), which DOES send UDP packets to the openvpn server and correctly set up the vpn and register the phone.

I have sent them the Wireshark traces, config files, and syslogs from the phone.  We will see what they come up with.  But for know, the Openvpn on the T38 is still not functional.

Update — see below – although openvpn does not work on the Yealinlk SIP-T38G, it DOES work on the Yealink SIP-T28P

I was looking for a secure and simple way to provision an IP phone, and came across the Yealink SIP-T28 phone mentioned in the Elastix Asterisk distribution security documentation. Openvpn is easy to configure, and using Openvpn would allow a simple solution for data encryption (control and RTP), as well as firewall traversal. I saw several posts from individuals who had the SIP-T28 Openvpn working (in spite of poor documentation from Yealink). I have purchased a number of phones from Voipsupply.com, and looking at their website, I saw the SIP-T38G, which looked like an update of the T28, with a color screen as well. The docs for the SIP-T38G on the Yealink website, as well as the data sheet for the SIP-T38G on the Voipsupply.com website, said that the T38G had the Openvpn functionality as well, so I ordered a SIP-T38G from Voipsupply.

The other posts helped with the construction of the openvpn configuration file (they said that the hardest part was finding a tool to create a tar file using ‘.’ as the root, but actually the standard tar utility did that very easily, using something like ‘tar cvf ../client.tar .’, putting client.tar in the parent directory to avoid a warning from tar.) However, when I went to upload client.tar to the phone, there was no option to do so!

Below, you can see that the Openvpn functionality is advertised on the box that the phone came in. However, all of the vpn configuration sections are missing from both the web configuration page and the on-phone configuration menus. I have included the figure from the SIP-T38G manual which I downloaded from the Yealink website, as well as a screen capture showing that the configuration options are missing.

I wanted to contact someone from Yealink about this, but there is no usable contact information (other than a call to China, which I don’t consider a viable option). There is a Yealink UK website with a support forum, so I tried to register. I got an immediate email that my registration would be reviewed by their administrator, and would be inactive until it was. Five days later, I have not heard any more from them. I also tried sending an email to Voipsupply support asking them why the phone they sent did not have the capabilities advertised for it in the data sheet on their website (as well as on the box the phone came in), but five days later, I have heard nothing.

Since I bought this phone entirely for the Openvpn capability, what I now have is a very expensive paperweight (albeit one with a beautiful color screen). I posted this to save others the trouble. I have also ordered a T28, which others say they have made work with Openvpn.

Follow-up: I got my Yealink T28 — completely different story there. The VPN entry was on the advanced network configuration screen, right where it was supposed to be. Uploading the client.tar file was a snap (albeit because I had already constructed the client.tar for the T38G!), and configuration was quick and easy. After uploading client.tar and enabling the VPN, I just went to the Account tab on the web interface, entered the extension number under Label, Display Name, Register Name, and User Name, entered the SIP password under Password, and entered the Asterisk machine’s internal tun interface’s IP address under SIP Server, clicked “Confirm”, and I could make phone calls over the VPN!

If you have trouble, confirm that you have the tun interface’s IP address for the SIP Server (not the Asterisk machine’s external IP), that openvpn is started on the server, and that you can ping the Asterisk machine’s internal tun interface IP from the Asterisk machine. You should see the vpn being set up in the /var/log/messages log, along with the IP assigned to the phone’s end of the vpn, and you should be able to ping the tun interface in the phone from the Asterisk machine. And don’t forget to check that the firewall is not getting in the way.

Also, although I did not do this, if you run the openvpn server process on a machine other than the Asterisk machine, you will have to make sure you have the routing entries to get the packets to your Asterisk server. In that case, I would start by making sure that the vpn is set up correctly, and then work on the routing.