[Freeswitch-users] New approach for integrating FreeSWITCH and HylaFax

Markus Lindenberg markus.lindenberg at gmail.com
Tue May 13 17:28:04 MSD 2014


Hi Florent,

as you might know HylaFAX is a fax server suite for Unix. It is over 20
years old but still actively developed, and it is *very* stable and widely
used. Hylafax consists of a few daemons and tools that interact. It
provides a FTP-based network protocol to submit faxes from desktop clients
or other systems, a scheduler that schedules sending of queued faxes and
dealing with failed transmissions and backends to interact with fax modems.

The most important components are:

faxq - qeuue manager daemon for outgoing faxes
hfaxd - network protocol server daemon (receives jobs and hands them to
faxq)

faxgetty - modem daemon (one faxgetty waits for incoming faxes on one
particular modem)
faxsend - open a modem device and send outgoing faxes through that modem

As 20 years ago fax always meant using fax modems, HylaFax is natively made
to (only) work with fax modems through it's faxgetty and faxsend processes.
To use those, you *have* to have one or more fax modems that are
connected/exposed through a serial interface (/dev/tty* on Linux).

FreeSWITCH with its spandsp module can already provide a number of virtual
modems that HylaFAX can use, see http://wiki.freeswitch.org/wiki/HylaFax.
Connecting HylaFax and FreeSWITCH using tty devices has some drawbacks as i
mentioned.

The interface of faxgetty and faxsend is pretty easy to implement, faxsend
is called by faxq, it will take a .tiff fax file and send it using a fax
modem. faxgetty will receive a fax and place a .tiff file in HylaFax' spool
directory. After receiving, it will call a shell script that can dispatch
the fax (send it by mail, print it etc.).

What I did here was reimplement those two commands:

gofaxd - replacement for one or more faxgetty processes
gofaxsend - replacement for faxsend

The two replacement commands will talk to FreeSWITCH through the event
socket and send/receive faxes using mod_spandsp's rxfax/txfax applications.
This has a few advantages over using tty devices to connect to FreeSWITCH:

- No Fax modem emulation and tty device necessary (thus the stack becomes
simpler)
- Native T.38 without t38_gateway (more robust and less CPU usage)
- We can use and log all sorts of events and verbose debugging (SIP
headers, bad rows etc.) to HylaFax.
- Number of parallel incoming faxes not limited by number of virtual
modems.

The concept was used before in the open source capi4hylafax suite that
implemented c2faxsend and c2faxrcvd as replacement for faxsend and
faxgetty. capi4hylafax could talk to ISDN CAPI 2.0 devices instead of tty
fax modems.

Compared to t38modem or iaxmodem, which (as far as i know) are not
maintained anymore, the beauty in this system is that - apart from some
decent FreeSWITCH and HylaFax knowledge needed to implement it - all the
hard stuff (signal processing) is done in FreeSWITCH and mod_spandsp with
both are actively maintained and improved. GOfax.IP is only shifting
metadata like logs and queue files around and helping HylaFax and
FreeSWITCH talk to each other. That's not much more than basic text
processing, so it's easy to maintain and easy to improve without deeper
knowledge of Fax protocols, spandsp etc.

The remaining question is if it is a good idea to use HylaFax for new
projects at all. If I have to implement a new receive only fax system, I'd
probably just use rxfax in the dialplan and a Lua script to process the fax
and be done with it. I've done that before and it's easy to implement and
works really well.
The reason why we've built GOfax.IP is that we have a larger amount of
existing HylaFax setups that have been running for years (or even decades)
with existing incoming/outgoing document handling based on HylaFax.
Customers trust HylaFax and hesitate to completely redesign their fax
processing when wanting to move from legacy analog modems or ISDN to Fax
over IP. So it's more agreeable to all parties involved to switch the PSTN
connectivity in HylaFax than deploy a completely different solution.

Best regards,

Markus


On Fri, May 9, 2014 at 5:31 PM, Florent Krieg <fkrieg at sewan.eu> wrote:

>  Hi Markus,
>
> I don't know very well HylaFAX. How is your soft related to it? You tell
> us about 'backend' but that doesn't really help a novice like me.
> I'd be grateful if you could tell me briefly what are their roles (how
> they interact together).
>
> Thanks in advance!
>
> Best regards,
> Florent
>
> Le 09/05/2014 13:47, Markus Lindenberg a écrit :
>
> Hi,
>
>  We just open sourced GOfax.IP, a project i've been working on for the
> better part of the last two months.
> It's a new (and I think best yet) way to bring "native" Fax over IP using
> T.38 or G711 to HylaFAX Fax servers by directly connecting HylaFAX to
> FreeSWITCH's mod_spandsp without any modem emulation layer.
>
>  We replaced the faxgetty and faxsend processes with versions that use
> FreeSWITCH to handle incoming and outgoing calls.
>
>  https://github.com/gonicus/gofaxip
>
>  We wanted to have a solution that brings all the power of rxfax/tfax to
> HylaFax. FreeSWITCH's modem emulation has to be chained to t38_gateway to
> use T.38, and in my tests that didn't work as well as using txfax/rxfax, so
> I looked at how capi4hylafax hooks into HylaFax and implemented that
> approach for FreeSWITCH.
>
>  I'd love to hear thoughts/suggestions and am happy to accept bug reports
> and contributions.
>
>  Regards,
>
>  Markus
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:consulting at freeswitch.orghttp://www.freeswitchsolutions.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>
> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://wiki.freeswitch.orghttp://www.cluecon.com
>
> FreeSWITCH-users mailing listFreeSWITCH-users at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org
>
>
> --
> Florent Krieg
> Sewan Communications - Ingénieur R&D
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140513/490046d5/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list