TUTORIAL Incredible PBX - Raspberry Pi B - Setup Hylafax / AvantFax Tutorial With Google Voice Trunk - Part 1

Ken Goddard

New Member
Joined
Sep 12, 2014
Messages
11
Reaction score
1
I created this tutorial or walk-through because I didn't find one tutorial that would help me do it successfully in/out faxing. So here it goes:
Hardware

Raspberry Pi B with 8 GB San SD Card
1.) Download Software
Software:
Incredible PBX Incrediblepi-3.11.11.final
Avantfax: Avantfax 3.3.3
I am not going to go through the installing of Incredible PBX on the Pi as there are plenty of good walk-through tutorials for that. Once you get incredible PBX up and running and login as
username: root and password: raspberry you will be prompted to complete some tasks: such as changing the root password and updating the system, be sure to complete these steps.
2.) incredible PBX post install tasks
Once you are at the prompt ~/ aka root directory you can do a ls and copy the name of the script raspi-setup.sh e.g.:
./raspi-setup
OvfCZws.png

At this point you want to expand your SD card to allow you to use all the space on it.
select expand_rootfs
note: this will require a reboot.
u2VdlPT.png

OK now we are ready to install hylafax and good news is there is already a script that works in the same directory we ran the other commands.
12c9bf8c-0e8c-47ed-ae5d-9471ee40581a.png

3.) FreePBX Setup / Module Upgrades


First things first, you should change your admin password, this is done under the following menu: Admin -> Administrators -> (then select admin and change the password)
Next you will want to upgrade all the install modules and get the system up-to-date. This is done by checking (Show only upgradeable) and clicking Upgrade All link, then Process.
NeDE8Kn.png

Now you will want to install Fax Configuration
rAWpQod.png

4.) Setup Google Voice Trunks

I have two trunks one for voice and one for faxing. Below you fill out your Google account information and phone number.
I won't go into much detail here as there are great walk-through tutorials for this also.

Note: some details about settings on this post: Link
x1Kkonv.png

5.) Create inbound Route to your fax modems

In freePBX this is located under Connectivity-> Inbound Routes


Give it a description such as the one I did fax-in
Change the DID to you GV number from the trunk you are using as your fax.
9QCe9Z4.png

6.) Before you continue lets test Hylafax

You want to have two sessions of putty going for this.
In the first session run the following command: watch faxstat -s


fRWlv50.png

In the second window type: sendfax -d 18884732963 /etc/network/interfaces this will send a fax to HP's fax machine test, which in fact will in turn send you a fax back.
krevb4R.png

If all is well you should see a fax in /var/spool/hylafax/recvq
bPn6uAC.png

At this point you should be sending and receiving faxes through your google voice number.
 

Ken Goddard

New Member
Joined
Sep 12, 2014
Messages
11
Reaction score
1
Part II


7. AvantFax

I had some issues with PHP Strict Error Checking being turned on and this is turned on in /includes/config.php script at the top. I would suggest that you turn off notice and depreciated
Because I made changes to the AvantFax download I have included that, but ultimately you will want to download the original put it in a temp folder in /var/www/, I did mkdir /var/www/tmp and retrieved the file untar'd it and ran the debian-install.sh.
Steps.
1. Create tmp dir in /var/www/ : mkdir /var/www/tmp
2. Get the file from sourceforge: wget http://downloads.sourceforge.net/project/avantfax/avantfax-3.3.3.tgz
3. Untar it: tar -xzvf avantfax-3.3.3.tgz|cd avant*
4. Give permissions to run script: chmod +wx debian-install.sh
5. Run script: ./debian-install.sh (follow prompts which are self explanatory, e.g. fax number etc...) Note this script will uninstall exim4 and install postfix and it will download 16 MB
Now heres where the work comes in:
Few things are not going to happen in this script, one it doesn't prompt for mysql info, second is it is going to add info to your apache default site configuration which will need to be corrected, and finally some of the links are not properly created, so to fix that post install do the following:
1. Edit apache site config:
nano /etc/apache2/sites-enabled/000-default
remove this:
<VirtualHost *:80>
DocumentRoot $INSTDIR
ServerName avantfax
ErrorLog logs/avantfax-error_log
CustomLog logs/avantfax-access_log common
</VirtualHost>
add this alias /avantfax /var/www/avantfax
GFsqeO4.png

at least on the raspberry pi runs in /var/www/html but avantfax defaults to install in /var/www/ being that I was not certain that some of my issues installing were
not related to static path issues, I removed that from the factoring by doing it this way.
2. Create sym links to files
Then run the following commands:


ln -s /var/spool/hylafax/bin/faxrcvd.php /var/www/avantfax/includes/faxrcvd.php
ln -s /var/spool/hylafax/bin/dynconf.php /var/www/avantfax/includes/dynconf.php
ln -s /var/spool/hylafax/bin/notify.php /var/www/avantfax/includes/notify.php
ln -s /usr//bin/faxcover /var/www/ /avantfax/includes/faxcover.php
ln -s /usr/share/misc/magic /usr/share/file/magic
ln -s /usr/share/misc/magic.mgc /usr/share/file/magic.mgc
ln -s /usr/share/misc/magic.mime /usr/share/file/magic.mime
ln -s /usr/share/misc/magic.mime.mgc /usr/share/file/magic.mime.mgc
3. Fix permissions on directories:
chmod -R 777 /var/www/avantfax
chown -R asterisk:asterisk /var/www/avantfax
chown -R asterisk:uucp /var/www/avantfax/tmp /var/www/avantfax/faxes
I also copied the following from the includes:
faxrcvd.php
notify.php
Here are my permission / owners on avantfax directory
yk0VpQD.png

Note: on your iaxmodem configurations you want to make sure you do the following:
nano /var/spool/hylafax/etc/config.ttyIAX0
add to bottom of file
#
# AvantFAX
#
FaxRcvdCmd: bin/faxrcvd.php
DynamicConfig: bin/dynconf.php
UseJobTSI: true
JobReqNoAnswer: 180
JobReqNoCarrier: 180

ModemRate: 14400 # rate for DCE-DTE communication
Now we need to get the mysql up to date:
In the download of Avantfax are the SQL dumps create_user.sql create_tables.sql
In freePBX you want to goto: Other -> phpmyadmin
1. Click on import, then browse and select create_user.sql this will create the avantfax db and setup the users.
2. Click the newly created db avantfax
3. Click on import and import the reset of the tables create_tables.sql
aKwhzZf.png

Now you are ready to login to AvantFax
username admin
password password
it will prompt you to change the password.
Once you login you need to click the button right below settings:
Rdnv3IP.png

Right next to the superman symbol.
Select modems from the drop down menu:
Enter the modems just like below
e.g. ttyIAX0 in the device field and the alias field do this for each modem 0 - 3
zcCpiAD.png

Create fax category
Under the menu select fax categories
MOGD5F5.png

Go back to the user drop down and make sure that it looks like below. Above this is your name company etc fill out as required.
hD5pSRv.png

Go back to inbox and your screen should look like so. The only thing left is to test a fax by sending it to HP test machine again 18884732963 which will in turn fax you back.
Mal3hhP.png
 

Terrylbs

New Member
Joined
Jan 27, 2014
Messages
5
Reaction score
0
I have followed these instructions and I actually got faxes to send and receive, however when I reboot faxing will not work anymore unless I reset everything back up. Another issue I am having is that I am unable to access my incrediblePBX GUI it only renders a complete white screen. Avantfax panels are accessible. I have tons of time into to this trying to make this work and I really hope you can shed some light on this. Please help :smash:
 

Terrylbs

New Member
Joined
Jan 27, 2014
Messages
5
Reaction score
0
This is notes of different things I have tried to get it just to the point where it would sent and receive faxes. These are not necessarily in order of what did them in. As i said these are just notes.
/root/update-my-pi
/etc/wpa.conf
/root/fax-enable
raspi-config
1NXXNXXXXXX
ln -s /usr/bin/faxcover /var/www/avantfax/includes/faxcover.php
ln -s /var/spool/hylafax/bin/faxrcvd.php /var/www/html/avantfax/includes/faxrcvd.php
ln -s /var/spool/hylafax/bin/dynconf.php /var/www/html/avantfax/includes/dynconf.php
chmod -R 777 /var/www/html/avantfax
chown -R asterisk:asterisk /var/www/html/avantfax
chown -R asterisk:uucp /var/www/html/avantfax /var/www/html/avantfax/faxes
chown -R asterisk:asterisk /var/www/html/avantfax/faxes
/usr/lib/hylafax/bin
raspberry
mkdir /etc/apache2/logs
cd /etc/apache2/logs
nano avantfax-error_log
touch /etc/apache2/logs/avantfax-error_log
/etc/init.d/apache2 restart
cd /var/www/html/avantfax
chmod +wx debian-install.sh
**************************************
nano /var/spool/hylafax/etc/hosts.hfaxd
add 127.0.0.1
**************************************
*****************************************************************************************************************************************
That’s right, I said Apache would fail to restart. And a moment ago I said it will give you some false information. Apache fails to restart because the entry it added to your /etc/apache2/sites-enabled/000-default has a bit of broken-ness to it. Is broken-ness a word? Yes, you could have edited the script to fix it, but I like doing things the hard way. Anyhow, open the /etc/apache2/sites-enabled/000-default file and scroll to the bottom. You’ll be looking for these two entries:
nano /etc/apache2/sites-enabled/000-default
paste at the bottom:
<VirtualHost *:80>
DocumentRoot /var/www/html/avantfax
ServerName avantfax
ErrorLog /var/log/apache2/avantfax-error_log
CustomLog /var/log/apache2/avantfax-access_log common
</VirtualHost>
"ErrorLog logs/avantfax-error_log"
"CustomLog logs/avantfax-access_log common"
Change them to:
nano /var/log/apache2/avantfax-error_log
nano /var/log/apache2/avantfax-access_log common
Save them empty > /etc/init.d/apache2 restart > Done!
"ErrorLog /var/log/apache2/avantfax-error_log"
"CustomLog /var/log/apache2/avantfax-access_log common"
Or change them to reflect where you want to keep your logs files for Avantfax in the case that you don’t like the way I did it. But the important thing is to make sure that the directory exists and www-data can write to it. That’s what caused this mess.
*********************************************************************************************************************************************
wget http://sourceforge.net/projects/avantfax/files/avantfax-3.3.3.tgz
tar -xvzf avantfax-3.3.3.tgz
cd avantfax-3.3.3
nano debian-prefs.txt
make sure you have these lines in there
# The domain name for configuring email to fax
FAXDOMAIN=fax.mydomain.com (you can insert you FQDN here, but not important)
# The installation directory for AvantFAX
INSTDIR=/var/www/html/avantfax
# The root directory where HylaFAX bin files are stored (typically, /usr or /usr/local)
HYLADIR=/usr/lib
# HylaFAX $SPOOL directory (typically, /var/spool/hylafax or /var/spool/fax)
SPOOL=/var/spool/hylafax
# These are the database settings AvantFAX will create and use
USER=avantfax
PASS=d58fe49
DB=avantfax
# if the MySQL password for root is set, specify it here
ROOTMYSQLPWD=raspberry
# The user and group which Apache runs as (typically, apache, wwwrun, nobody, etc...)
HTTPDUSER=asterisk
HTTPDGROUP=asterisk
The run the avantfax debian install script
./debian-install.sh
!!!!!!!!!!!!!!!Terry also create these files with nano!!!!!
This will restart apache /etc/init.d/apache2 restart
*********************************************************************************************************************
nano /etc/apache2/apache2.conf !!!!Here add "ServerName localhost" without quotes!!!!!!
 

Ken Goddard

New Member
Joined
Sep 12, 2014
Messages
11
Reaction score
1
Thanks for the update, so I assume you can now receive and send.... BTW I had developers say it was not possible to get Google Voice # to fax but this tutorial proves that wrong. :)


With regards to the gui I did find that I had to put the whole address e.g. : http://yoursitename.com/admin and then I would not have an issue. I just never spent the time to see if there was an error in the log that pointed to this problem I just bookmarked the gui page, but if you find the solution I would be glad to post that here.

What you missed in regard to the Apache file was this:

1. Edit apache site config:
nano /etc/apache2/sites-enabled/000-default
remove this:
<VirtualHost *:80>
DocumentRoot $INSTDIR
ServerName avantfax
ErrorLog logs/avantfax-error_log
CustomLog logs/avantfax-access_log common
</VirtualHost>
add this alias /avantfax /var/www/avantfax
GFsqeO4.png

In regards to links and permissions that info was in #2 & #3

2. Create sym links to files
Then run the following commands:


ln -s /var/spool/hylafax/bin/faxrcvd.php /var/www/avantfax/includes/faxrcvd.php
ln -s /var/spool/hylafax/bin/dynconf.php /var/www/avantfax/includes/dynconf.php
ln -s /var/spool/hylafax/bin/notify.php /var/www/avantfax/includes/notify.php
ln -s /usr//bin/faxcover /var/www/ /avantfax/includes/faxcover.php
ln -s /usr/share/misc/magic /usr/share/file/magic
ln -s /usr/share/misc/magic.mgc /usr/share/file/magic.mgc
ln -s /usr/share/misc/magic.mime /usr/share/file/magic.mime
ln -s /usr/share/misc/magic.mime.mgc /usr/share/file/magic.mime.mgc
3. Fix permissions on directories:
chmod -R 777 /var/www/avantfax
chown -R asterisk:asterisk /var/www/avantfax
chown -R asterisk:uucp /var/www/avantfax/tmp /var/www/avantfax/faxes
I also copied the following from the includes:
faxrcvd.php
notify.php
Here are my permission / owners on avantfax directory
yk0VpQD.png

Note: on your iaxmodem configurations you want to make sure you do the following:
nano /var/spool/hylafax/etc/config.ttyIAX0
add to bottom of file
 

Terrylbs

New Member
Joined
Jan 27, 2014
Messages
5
Reaction score
0
Yes, faxing can be done through Google Voice I have confirmed that, however getting Avantfax to work correctly is a whole other story.

I have tried http://192.168.1.199/admin which only displays white screen, this address worked before avantfax is installed. I have tried everything in your post multiple ways and when I have done the sym links it says that all of the files are already there. I have never made it the myphp step you show where you go back into incredible pbx after avantfax is installed and this is because http://192.168.1.199/admin is white screen. What logs files should I look in?

Thank you.
 
Joined
Nov 19, 2007
Messages
180
Reaction score
8
Thanks for this tutorial. I was able to add AvantFAX to my IPBX 3.11 on Raspberry Pi rather easily. I did have a few problems.

First, the faxstat and other commands wanted a password. I had to modify /var/spool/hylafax/etc/hosts.hfaxd to have these entries at the end:
Code:
# hosts.hfaxd
# This file contains permissions and password for every user in
# the system.
#
# For more information on this biject, please see its man page
# and the commands faxadduser and faxdeluser.
localhost:21::
127.0.0.1
192.168.254.30
Second, I couldn't find the root mysql password in order to use phpMyAdmin to create the AvantFAX database. I had to stop mysql and rerun it with the "--skip-grant-tables" command, get the hashed password, then use crackstation.net to give me the root password. BTW, it's raspberry. I couldn't find that documented anywhere, so I may have missed it and not need to go the back door.

Finally, I don't use GV for regular outbound calls, so I only wanted faxes to come in and out of the GV trunk only. That two specific changes.

1. Modify GV outbound route
Connectivity->Outbound Routes->[your GV route]​
Modify dial patterns with:​
Prefix: 9 Match Pattern: 1NXXNXXXXXX​
Prefix: 9 Match Pattern: NXXNXXXXXX​
That will allow any number prefixed with a "9" to go out GV trunk.​
2. Modify Hylafax dial rules:
nano /var/spool/hylafax/etc/dialrules​
Modify the last part of the DialString to look like this:​
Code:
DialString := [
[-${WS}.]+              =                      ! strip syntactic sugar
[abcABC]                = 2                    ! these convert alpha to numbers
[defDEF]                = 3
[ghiGHI]                = 4
[jklJKL]                = 5
[mnoMNO]                = 6
[prsPRS]                = 7
[tuvTUV]                = 8
[wxyWXY]                = 9
^[+]${Country}          = ${LDPrefix}          ! long distance call
^[+]                    = ${IDPrefix}          ! international call
^[0-9]{10,}$            = 9&                    ! Add 9 to get GV trunk
]
That modification will allow all fax numbers to be either 10 or 11 digits, but hylafax will prefix the 9 to the number (in case someone add the "1" to the fax number).​
So once the fax number is modified to be prefixed with a 9, Asterisk will send it to the GV trunk after stripping off the "9".

I think those were the major things I hit and how I got around them.
 
Joined
Nov 19, 2007
Messages
180
Reaction score
8
Totally forgot this, which is the "white screen" problem. After installing Avantfax, you will need to revert your pear database version back:

Code:
pear uninstall db
pear install db-1.7.14
 

miguel

Member
Joined
May 22, 2013
Messages
276
Reaction score
8
I have the white screen problem but I am on centos 6.6 will this commands work? and would it not affect anything else? I am on piaf 3.0.6.7 asterisk 11 freepbx 12

thanks for your time.

Best regards,

MN
 
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top