Adding a Dedicated Virtual Fax Machine / DID & Sharing A VoIP DID w/ Fax - Part 1
Adding a Dedicated Virtual Fax Machine / DID & Sharing A VoIP DID w/ Fax
Sometimes, such as in the case of the HR department, or certain executives, it will be desirable to have a dedicated “virtual fax machine” that is privatized for these purposes. This also allows dedicated routing on receipt of fax, and dedicated Caller ID Header information sent with the faxes from these setups.
Its also nice to be able to “put a fax machine” on virtually any extension using NVDetect – so well work through preparing Asterisk for that, and deploying a combo Voice Extension/Fax Machine.
Adding a virtual modem to Hylafax isn’t complicated, but there are several details. Follow these carefully and you will be able to add as many modems as you like.
To accomplish this, we set up a FreePBX extension to function as the “virtual fax machine”. Then, we create a new iaxmodem in etc/iaxmodem, add a faxgetty, run the fax admoodem process in HylaFax, and then add the modem in Avantfax. Whew – well, I said there were a lot of steps!
Keep in mind however, that the total number of modems that can be supported depend upon a lot of factors. In general, more than four modems in use concurrently could be a problem – or might be just fine.
SetUp “Fax Machine” Extension in FreePBX
In FreePBX, Setup, Extensions, Add Extension, add a Generic IAX2 Device.
Create the extension with the following Characteristics:
Display Name: Bob’s Fax (Give it a Descriptive Name)
Outbound CID: As appropriate
Secret: An Appropriate STRONG secret
Save your changes. Then, open the newly created extension again and make the following characteristics:
notransfer = yes
host = 127.0.0.1
type = friend
port = 4574 <=== * Must be unique
qualify=yes
disallow = all
allow = ulaw
permit = 127.0.0.1/255.255.255.0
*This must be a unique port. I selected 4574 because the first 4 virtual modems are already set to use ports 4570-4573. Each time you add a new Virtual modem, increment this port by 1.
Do not enable voice mail or VMX.
SetUp “Fax Machine” Peer in iax_custom.conf (new instruction)
In freePBX using config editor, aqdd the following to the bottom of the iax_custom.conf file:
[iax-fax4]
type=friend
host=127.0.0.1
port=4574
context=from-internal
disallow=all
allow=ulaw
jitterbuffer=no
qualify=yes
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
secret= XXXXXX<=== The same strong secret you assigned to the shared fax occurrence, above.
Save your changes.
Create new IAX Modem
Next, we create the new iaxmodem in /etc/iaxmodem.We need to make a copy of one of the existing iaxmodem-cfg.ttyIAX files, and edit it to suit our needs. Copy one of the files to your desktop, and then rename the file to the next modemin the series. We will be naming the file:
iaxmodem-cfg.ttyIAX4.
Make sure that when you name the files, you match the case exactly as the other are done, or this wont work at all.
Open the file and edit the following lines as indicated. Do Not Change any other lines.
device /dev/ttyIAX4 <=== This is the 4th modem
port 4574 <=== This must match the port used when the FreePBX Fax Modem extension was created
peername xxx <=== Fax Extension number created in FreePBX
cidname B. Jones <===The Caller ID Name sent from this Fax Machine
cidnumber 1234567890 <=== The Caller ID Number sent from this Fax Machine
secret 274329 <=== NEW LINE. This is the secret used in the FreePBX fax extension created in FreePBX[FONT="]for [/FONT]this purpose
Save your changes, and copy the file to /etc/iaxfaxmodems
Update initab
Using your favorite editor, modify the file /etc/inittab.
Look at the bottom of the file and you will se the lines added for the other virtual modems, add a line that looks like this:
t4:23:respawn:/usr/sbin/faxgetty ttyIAX4 > /var/log/iaxmodem/iaxmodem.log
And Save your changes.
New Instruction: Reboot your PBX now - and then proceed with the remaining directions.
Run FAXADDMODEM
Logged in as root, run faxaddmodem
When you are prompted for the modem name, enter: [FONT="]ttyIAX4 (Case exact!)[/FONT]
Answer the remaining prompts as appropriate for your installation.
Add the New fax Category AvantFax
Log into the Avantfax UI as the super admin user, and Select FAX CATEGORIES from the drop down box. Enter Bobs Faxes and click CREATE.
Add the Modem to AvantFax
Still logged into the Avantfax UI as the super admin user, and Select MODEMS from the drop down box.
Make a new modem with the following characteristics:
Device = ttyIAX4 (case EXACT)
Alias = ttyIAX4 (Or, alternately, a friendly name like “Bobs Fax”
Contact = the email address that every fax received on this virtual fax machine will be sent to
Category = Bobs Faxes
Click on CREATE when you have the characteristics as desired.
Configure Bob's AvantFax User ID.
If you haven’t Created Bob’s AvantFax user id yet, do that NOW. Don’t forget to assign him to his own fax category (Bobs Faxes), and restrict him from seeing any modems other than his own (IAX4).
Fix the HylaFAX Modem Device File
Using your favorite Editor, locate and open the file: /var/spool/hylafax/etc/config.ttyIAX4
To the bottom of this file, add the following lines:
[FONT="]#[/FONT]
[FONT="]## AvantFAX[/FONT]
[FONT="]#[/FONT]
[FONT="]FaxRcvdCmd: bin/faxrcvd.php[/FONT]
[FONT="]DynamicConfig: bin/dynconf.php[/FONT]
[FONT="]UseJobTSI: true[/FONT]
[FONT="]JobReqNoAnswer: 180[/FONT]
[FONT="]JobReqNoCarrier: 180[/FONT]
Save your changes.
Its now time to reboot your system – so all the configs will take place correctly.
Configure DID for Virtual Fax Machine
From within FreePBX, Setup, Inbound Routes, create an inbound route for the DID that is to service this dedicated fax machine. Point it at the Extension we created for this virtual fax machine (Bobs Fax).
That’s it – all the heavy lifting is done. Test this out by sending a fax to the DID and note that it is being received on the IAX4 faxmodem.
I should point out that there are several other ways we could have achieved this same result –and in future article we might explore those methods. If you find one that you like – share it with us too.
The reasons I chose this method are really twofold. First, most of the work in FreePBX is done in the extensions interface, rather than be editing and creating conf file entries by hand. And second, this method translates very well into our next topic – sharing a DID with voice and fax.
See Adding a Dedicated Virtual Fax Machine / DID & Sharing A VoIP DID w/ Fax - Part 2