Sending Faxes from User Panel to FreePBX
- From the sandbox
- Tutorial

Hi, Habr!
Email has long been the primary way to exchange documents. But after I replaced the old siemens and panas with Asterisk PBX in many organizations in my city, I encountered a reluctance to refuse faxes (especially in budget organizations), and it is clear - this is faster and easier for an employee than to mess with a scanner. Since they installed aster mainly due to the expansion of the staff and with the desire to save money, faxes for new employees must also be virtualized. There shouldn’t be any problems with receiving faxes to e-mail; I had to rack my brains with a simple and free sending method.
On the Internet, I found an easy way to send a fax through the FreePBX web interface. Easy to configure, works with a bang. It is hardly suitable for the active use of faxes in a large office, but for a small office with little fax traffic or for beginners in aster or * nix - just right.
We have a virtual machine in a small office with Ubuntu 12.04 on board. Installed Asterisk 11 + FreePBX 2.11. Log in via ssh to the server and proceed.
1. Install the fax module. You can also use the spandsp module, there are no restrictions in it, reminds us of Malamut , then this item can be skipped
We register on the Digium website , go to the module page , click "Get 1 Free license", place an order, and wait for a letter with a code.
From here we download the utility for registering our module, put it in / tmp, mark the execution for the owner and run it.
cd /tmp
wget http://downloads.digium.com/pub/register/x86-32/register
chmod 500 register
./register
You will see a text menu with a prompt to enter:
Digium Product Registration - Version 3.0.5
Copyright (C) 2004-2007, Digium, Inc.
Use the '-l' option to see license information for software
included in this program.
Please select a category
1 - Digium Products
2 - Cepstral Products
0 - Quit
Your Choice:
We select 1, then 9, enter the key that came in the mail, agree and fill in the data.
We take the module here , select the version for our server, pick up the link below, unpack it and put res_fax_digium.so in your $ {ASTMODDIR}. For example, I have
cd /tmp
wget http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-11.0/x86-64/res_fax_digium-11.0_1.3.1-generic_64.tar.gz
tar -xvf res_fax_digium*
cd res_fax_digium*
cp res_fax_digium.so /usr/lib/asterisk/modules/
2. Download the files we need and unpack them into a temporary directory.
cd /tmp && wget http://faxgui-ari-module.googlecode.com/files/faxgui-ari-module.tar.gz && tar xvf faxgui-ari-module.tar.gz
3. We copy everything in its place and set the rights.
cp faxgui-ari-module/sendfax.module /var/www/recordings/modules/ # проверьте ваш параметр %AMPROOT%
cp faxgui-ari-module/sendfaxnotify.php /var/lib/asterisk/bin/ # проверьте ваш параметр ${ASTVARLIBDIR}
chown asterisk:asterisk /var/www/recordings/modules/sendfax.module
chown asterisk:asterisk /var/lib/asterisk/bin/sendfaxnotify.php
dos2unix /var/lib/asterisk/bin/sendfaxnotify.php # перекодировка файла, установите пакет dos2unix
3. Create a context for outgoing faxes in a file /etc/asterisk/extensions_custom.conf.
[outboundfax]
exten => s,1,Set(FAXOPT(filename)=${FAXFILE})
exten => s,n,Set(FAXOPT(ecm)=yes)
exten => s,n,Set(FAXOPT(headerinfo)=${FAXHEADER})
exten => s,n,Set(FAXOPT(localstationid)=${LOCALID})
exten => s,n,Set(FAXOPT(maxrate)=14400)
exten => s,n,Set(FAXOPT(minrate)=2400)
exten => s,n,SendFAX(${FAXFILE},d)
exten => s,n,System(${ASTVARLIBDIR}/bin/sendfaxnotify.php INIT "${EMAIL}" "${DESTINATION}" "${TIMESTAMP}" "NO_STATUS" "NO_PAGES")
exten => h,1,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
exten => h,n,NoOp(FaxStatus : ${FAXSTATUS})
exten => h,n,NoOp(FaxStatusString : ${FAXSTATUSSTRING})
exten => h,n,NoOp(FaxError : ${FAXERROR})
exten => h,n,NoOp(RemoteStationID : ${REMOTESTATIONID})
exten => h,n,NoOp(FaxPages : ${FAXPAGES})
exten => h,n,NoOp(FaxBitRate : ${FAXBITRATE})
exten => h,n,NoOp(FaxResolution : ${FAXRESOLUTION})
exten => h,n,System(${ASTVARLIBDIR}/bin/sendfaxnotify.php NOTIFY "${EMAIL}" "${DESTINATION}" "${TIMESTAMP}" "${FAXSTATUSSTRING}" "${FAXPAGES}")
; end of outboundfax context
3. Restart and check.
amportal restart
We go to the User Panel of our server, ip_aster / recordings , log in as any user, enter the password for voicemail. On the left appeared the Send Fax item. Checking the shipment.

For the convenience and speed of user training, I noted the algorithm for sending numbers, it is much more clear.
That's all, I hope my post helped someone with setting up a VoIP server.
In the future I plan to regularly describe such small and subtle moments with customization.
When writing the article, the following materials were used:
hiousi.tumblr.com/post/2745684940/a-freepbx-ari-module-to-send-fax-from-the-user-portal
trentdev.blogspot.ru/2013/04/send- fax-using-asteriskfreepbx-with.html
www.digium.com/en/products/software/fax-for-asterisk
wiki.freepbx.org/display/ST/Faxing+and+T38
A small addition
Now I set up sending to the client according to my manual, I remembered a few more points.
1. Install ghostscript for PDF support
aptitude install ghostscript # мой случай
2. Do not forget about the options in sip.conf, or in the web interface
t38pt_udptl=yes,redundancy,maxdatagram=400
faxdetect=no
3. When checking, look at the license in the CLI
fax show licenses
Do not register several keys per 1 box, fraught with further invalidity