IAXmodem 1.3.3 hylafax+ 7.0.3 FreePBX

We are trying to configure a new FreeBSD-16 host to use HylaFax+ and IAXModem to handle fax traffic through AvantFax. The Asterisk/FreePBX configuration has been carried out by restoring a FreePBX backup from our running FreePBX-13 system which has this fax setup.

We do not use Linux elsewhere and have no experience with systemd. We are using the default scripts that come with iaxmodem and hylafax+. The new system does not have any POTS lines attached but the 8 port FXO card is installed and appears to be recognized.

At the moment I am trying to get IAX to run as a service and failing. systemctl status iaxmodem@ttyIAX0 gives this following a system restart:

# systemctl status -l iaxmodem@ttyIAX0
● [email protected] - iaxmodem ttyIAXttyIAX0
   Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2023-10-12 10:46:05 EDT; 12min ago
 Main PID: 815 (code=exited, status=203/EXEC)

Oct 12 10:46:05 inet29.internal.harte-lyne.ca systemd[1]: Unit [email protected] entered failed state.
Oct 12 10:46:05 inet29.internal.harte-lyne.ca systemd[1]: [email protected] failed.
Oct 12 10:46:05 inet29.internal.harte-lyne.ca systemd[1]: [email protected] holdoff time over, scheduling restart.
Oct 12 10:46:05 inet29.internal.harte-lyne.ca systemd[1]: Stopped iaxmodem ttyIAXttyIAX0.
Oct 12 10:46:05 inet29.internal.harte-lyne.ca systemd[1]: start request repeated too quickly for [email protected]
Oct 12 10:46:05 inet29.internal.harte-lyne.ca systemd[1]: Failed to start iaxmodem ttyIAXttyIAX0.
Oct 12 10:46:05 inet29.internal.harte-lyne.ca systemd[1]: Unit [email protected] entered failed state.
Oct 12 10:46:05 inet29.internal.harte-lyne.ca systemd[1]: [email protected] failed.

Is this in anyway related to the lack of a carrier on the configured fax port or does this indicate some sort of configuration issue with systemd services? How is this resolved?

Hylafax doesn’t have support for PHP 7 or greater. FreePBX 16 runs on PHP 7.x. That might explain why the service can’t load.

Hylafax is running. It is iaxmodem that is failing.

# systemctl status hylafax-hfaxd
● hylafax-hfaxd.service - HylaFAX hfaxd (client service)
   Loaded: loaded (/usr/lib/systemd/system/hylafax-hfaxd.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-10-12 11:45:13 EDT; 8s ago
 Main PID: 19991 (hfaxd)
   CGroup: /system.slice/hylafax-hfaxd.service
           └─19991 /usr/sbin/hfaxd -d -i hylafax

Oct 12 11:45:13 inet29.internal.harte-lyne.ca systemd[1]: Started HylaFAX hfaxd (client service).
Oct 12 11:45:13 inet29.internal.harte-lyne.ca HylaFAX[19991]: Listening to 0.0.0.0:4559
Oct 12 11:45:13 inet29.internal.harte-lyne.ca HylaFAX[19991]: HylaFAX INET Protocol Server: restarted.
Hint: Some lines were ellipsized, use -l to show in full.

# systemctl status hylafax-faxq
● hylafax-faxq.service - HylaFAX faxq (job scheduler service)
   Loaded: loaded (/usr/lib/systemd/system/hylafax-faxq.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-10-12 11:46:30 EDT; 7s ago
 Main PID: 20329 (faxq)
   CGroup: /system.slice/hylafax-faxq.service
           └─20329 /usr/sbin/faxq -D

Oct 12 11:46:30 inet29.internal.harte-lyne.ca systemd[1]: Started HylaFAX faxq (job scheduler ser...).
Oct 12 11:46:30 inet29.internal.harte-lyne.ca FaxQueuer[20329]: HylaFAX (tm) Version 7.0.3
Oct 12 11:46:30 inet29.internal.harte-lyne.ca FaxQueuer[20329]: Copyright (c) 1990-1996 Sam Leffler
Oct 12 11:46:30 inet29.internal.harte-lyne.ca FaxQueuer[20329]: Copyright (c) 1991-1996 Silicon Gr....
Hint: Some lines were ellipsized, use -l to show in full.

#  systemctl status iaxmodem@ttyIAX0
● [email protected] - iaxmodem ttyIAXttyIAX0
   Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2023-10-12 11:47:53 EDT; 6s ago
  Process: 21887 ExecStart=/usr/bin/unbuffer /usr/bin/iaxmodem iaxmodem-cfg.ttyIAX%i (code=exited, status=203/EXEC)
 Main PID: 21887 (code=exited, status=203/EXEC)

Oct 12 11:47:53 inet29.internal.harte-lyne.ca systemd[1]: Unit [email protected] entered f...e.
Oct 12 11:47:53 inet29.internal.harte-lyne.ca systemd[1]: [email protected] failed.
Oct 12 11:47:53 inet29.internal.harte-lyne.ca systemd[1]: [email protected] holdoff time o...t.
Oct 12 11:47:53 inet29.internal.harte-lyne.ca systemd[1]: Stopped iaxmodem ttyIAXttyIAX0.
Oct 12 11:47:53 inet29.internal.harte-lyne.ca systemd[1]: start request repeated too quickly for ...ce
Oct 12 11:47:53 inet29.internal.harte-lyne.ca systemd[1]: Failed to start iaxmodem ttyIAXttyIAX0.
Oct 12 11:47:53 inet29.internal.harte-lyne.ca systemd[1]: Unit [email protected] entered f...e.
Oct 12 11:47:53 inet29.internal.harte-lyne.ca systemd[1]: [email protected] failed.
Hint: Some lines were ellipsized, use -l to show in full.

ttyIAXttyIAX0 !!?? fix that first .

hylafax+ does not involve php of any version so don’t sweat that, however your documentroot for avantfax will need to be serving php5.6, FreePBX’ documentroot can mostly be served with PHP7.4.

Where is ttyIAXttyIAX0 coming from?

This is the service file:

cat /etc/systemd/system/ttyiax0.service
[Unit]
Description=HylaFAX faxgetty for ttyIAX0

[Service]
User=root
Group=root
Restart=always
RestartSec=30
ExecStart=/usr/sbin/faxgetty ttyIAX0 &

[Install]
WantedBy=multi-user.target

Dis you write a systemd service for iaxmodem ? it is usually started with

/etc/init.d/iaxmodem start

so try

/etc/init.d/iaxmodem status

There is no /etc/init.d/iaxmodem. FreePBX 16 uses systemd. There is a default servce file named: /usr/lib/systemd/system/[email protected]. This is what I get when I just pass the tty number to [email protected]:


 systemctl status iaxmodem@0
● [email protected] - iaxmodem ttyIAX0
   Loaded: loaded (/usr/lib/systemd/system/[email protected]; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2023-10-12 16:31:45 EDT; 19s ago
  Process: 20826 ExecStart=/usr/bin/unbuffer /usr/bin/iaxmodem iaxmodem-cfg.ttyIAX%i (code=exited, status=203/EXEC)
 Main PID: 20826 (code=exited, status=203/EXEC)

Oct 12 16:31:45 inet29.internal.harte-lyne.ca systemd[1]: Unit [email protected] entered failed ...e.
Oct 12 16:31:45 inet29.internal.harte-lyne.ca systemd[1]: [email protected] failed.
Oct 12 16:31:45 inet29.internal.harte-lyne.ca systemd[1]: [email protected] holdoff time over, s...t.
Oct 12 16:31:45 inet29.internal.harte-lyne.ca systemd[1]: Stopped iaxmodem ttyIAX0.
Oct 12 16:31:45 inet29.internal.harte-lyne.ca systemd[1]: start request repeated too quickly for ...ce
Oct 12 16:31:45 inet29.internal.harte-lyne.ca systemd[1]: Failed to start iaxmodem ttyIAX0.
Oct 12 16:31:45 inet29.internal.harte-lyne.ca systemd[1]: Unit [email protected] entered failed ...e.
Oct 12 16:31:45 inet29.internal.harte-lyne.ca systemd[1]: [email protected] failed.

FreePBX doesn’t actually ‘use’ any startup system, that is an OS thing :wink: so any systemd service will depend on the ‘script’ you used to install iaxmodem traditionally that was set to startup ant iaxmodems in /etc/iaxmodem/ via init.d/iamodem, But systemd ‘services’ need to either ‘enabled’ (which will happen on boot) or ‘started’ by some other method, you have, in your case as it is a systemd @user service it must started by the ‘user’ using it.

but your log of a failed start is too garbled to be of any use. Start with man iaxmodem , show ls /etc/iaxmodem and the user in your /etc/iaxmodem/ttyIAX0

# man iaxmodem
IAXMODEM(1)                           General Commands Manual                           IAXMODEM(1)

NAME
       iaxmodem - software modem with IAX2 connectivity

SYNOPSIS
       iaxmodem [configname]

DESCRIPTION
       iaxmodem  is  a  software modem with IAX2 connectivity designed to connect fax software like
       HylaFAX or efax to a PBX system such as Asterisk.

OPTIONS
       iaxmodem runs as a standalone daemon when no configname is specified on  the  command  line,
       spawning  one  process per config file found under /etc/iaxmodem/*. Otherwise, iaxmodem runs
       as a single soft modem using the specified configname (/etc/iaxmodem/configname).

AUTHOR
       iaxmodem was written by Lee Howard <[email protected]>.

       This manual page was written by Julien BLACHE <[email protected]> and contributed  to
       the Debian project, but may be used by others.

                                         February 27, 2006                              IAXMODEM(1)
~
 Manual page iaxmodem(1) line 1/28 (END) (press h for help or q to quit)

# ll /usr/lib/systemd/system/[email protected]
-rw-r--r-- 1 root root 254 Jul 31  2021 /usr/lib/systemd/system/[email protected]
# ll /etc/iaxmodem/*
-rw-r--r-- 1 uucp root 278 Sep 29 10:29 /etc/iaxmodem/ttyIAX0
-rw-r--r-- 1 uucp root 278 Sep 29 10:30 /etc/iaxmodem/ttyIAX1
# systemctl status -l iaxmodem@0
● [email protected] - iaxmodem ttyIAX0
   Loaded: loaded (/usr/lib/systemd/system/[email protected]; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2023-10-12 17:13:33 EDT; 10s ago
  Process: 27691 ExecStart=/usr/bin/unbuffer /usr/bin/iaxmodem iaxmodem-cfg.ttyIAX%i (code=exited, status=203/EXEC)
 Main PID: 27691 (code=exited, status=203/EXEC)

Oct 12 17:13:33 inet29.internal.harte-lyne.ca systemd[1]: Unit [email protected] entered failed state.
Oct 12 17:13:33 inet29.internal.harte-lyne.ca systemd[1]: [email protected] failed.
Oct 12 17:13:33 inet29.internal.harte-lyne.ca systemd[1]: [email protected] holdoff time over, scheduling restart.
Oct 12 17:13:33 inet29.internal.harte-lyne.ca systemd[1]: Stopped iaxmodem ttyIAX0.
Oct 12 17:13:33 inet29.internal.harte-lyne.ca systemd[1]: start request repeated too quickly for [email protected]
Oct 12 17:13:33 inet29.internal.harte-lyne.ca systemd[1]: Failed to start iaxmodem ttyIAX0.
Oct 12 17:13:33 inet29.internal.harte-lyne.ca systemd[1]: Unit [email protected] entered failed state.
Oct 12 17:13:33 inet29.internal.harte-lyne.ca systemd[1]: [email protected] failed.

Sorry can’t help you further without knowing exactly how you installed iaxmodem and faxaddmodem

If you can allow me root access I can take a look for you. I have setup FreePBX 16 with

Asterisk 20.4.0
AvantFax 3.4.0
IAXModem 1.3.4
HylaFax 7.0.7
PHP 7.4

I have literally just clean installed another system rebuilding my script so it makes life easier for me.

We are using Ubuntu 22.04 this will also work with Ubuntu 20

But pretty much you have to make sure of the following when configuring IAXModem

  1. Create IAX extensions first and assign each extension its own IAX port number ie 4570, 4571, 4572 etc. not 4569 of course in advanced settings.

  2. Use the Asterisk IAX Settings Module Addon and set the following:

Other IAX Settings

Setting Value

requirecalltoken no
maxcallnumbers 16382
calltokenoptional 0.0.0.0/0.0.0.0

  1. Configure your modems for IAXModem

nano /etc/iaxmodem/ttyIAX1.conf

device /dev/ttyIAX1
owner uucp:uucp
mode 660
port 4570 #SAME PORT AS EXTENSION
refresh 60
server 127.0.0.1
peername extension #EXTENSION NUMBER
secret faxpassword #PASSWORD
codec ulaw
cidname Fax Server
cidnumber 5555551212
nojitterbuffer

  1. Create Hylafax config for new modem

nano /var/spool/hylafax/etc/config.ttyIAX1

CountryCode: 1 #COUNTRY CODE
AreaCode: 555 #AREA CODE
FAXNumber: 555.555.1212 fax NUMBER IN THIS FORMAT
LongDistancePrefix: 1
InternationalPrefix: 011
DialStringRules: “etc/dialrules”
ServerTracing: 1
SessionTracing: 1
RecvFileMode: 0600
LogFileMode: 0600
DeviceMode: 0600
RingsBeforeAnswer: 1
SpeakerVolume: off
GettyArgs: “-h %l dx_%s”
LocalIdentifier: “17745057136”
TagLineFont: etc/lutRS18.pcf
TagLineFormat: “From %%l|%c|Page %%P of %%T”
MaxRecvPages: 200
JobReqNoCarrier: 180
JobReqNoAnswer: 180
FaxRcvdCmd: bin/faxrcvd.php
DynamicConfig: bin/dynconf.php
NotifyCmd: bin/notify.php
ModemType: Class1 # use this to supply a hint
ModemResetCmds: “ATH1\nAT+VCID=1” # enables CallID display
ModemReadyCmds: ATH0
Class1AdaptRecvCmd: AT+FAR=1
Class1TMConnectDelay: 400 # counteract quick CONNECT response
Class1RMQueryCmd: “!24,48,72,96” # V.17 fast-train recv doesn’t work well
Class1TMQueryCmd: “!24,48,72,96” # V.17 fast-train recv doesn’t work well
CallIDPattern: “NMBR=”
CallIDPattern: “NAME=”
CallIDPattern: “ANID=”
CallIDPattern: “NDID=”

  1. Set permissions

cd /var/spool/hylafax/etc
chown uucp:uucp config.ttyIAX1

  1. Create startup scripts

nano /etc/systemd/system/faxgetty1.service

[Unit]
Description=HylaFAX faxgetty for ttyIAX1

[Service]
User=root
Group=root
Restart=always
RestartSec=30
ExecStart=/usr/local/sbin/faxgetty ttyIAX1 &

[Install]
WantedBy=multi-user.target

nano /etc/systemd/system/iaxmodem1.service

[Unit]
Description=IAXModem for ttyIAX1

[Service]
Type = simple
Restart=always
RestartSec=30
ExecStart=/usr/local/sbin/iaxmodem ttyIAX1

[Install]
WantedBy=multi-user.target

nano /etc/systemd/system/hfaxd.service

[Unit]
Description=Hylafax hfaxd

[Service]
Type=forking
ExecStart=/usr/local/sbin/hfaxd -i hylafax

[Install]
WantedBy=multi-user.target

nano /etc/systemd/system/faxq.service

[Unit]
Description=faxq

[Service]
Type=forking
ExecStart=/usr/local/sbin/faxq

[Install]
WantedBy=multi-user.target

systemctl enable hfaxd.service
systemctl enable faxq.service
systemctl enable iaxmodem1.service
systemctl enable faxgetty1.service

  1. Run services and modem

systemctl start hfaxd.service
systemctl start faxq.service

systemctl start faxgetty1.service
systemctl start iaxmodem1.service

You should now have a working fax modem. Repeat steps as necessary to add additional modems. Hope this helps!

1 Like

Hylafax was installed from sng-epel. iaxmodem was installed from an rpm obtained from: http://repo.iotti.biz/CentOS/8/x86_64/iaxmodem-1.3.3-1.el8.lux.x86_64.rpm` .

Faxaddmodem is part of the hylafax+ rpm.

Sorry , I’m not a redhat guy.

I use the source

https://iaxmodem.sourceforge.net/
https://hylafax.sourceforge.io/

TWFM

Thank you. The iaxmodem RPM package that I used expects that the files in /etc/iaxmodem/ have names in the form iaxmodem-cfg.ttyIAXn. Likewise, the [email protected] file expects just the modem number as an argument. In other words: systemctl start iaxmodem@0. I prefer to stay with the scripts provided by the packages themselves unless they simply cannot be made to work.

I discovered that there is an undeclared dependency in the iaxmodem rpm for the expect package. The [email protected] file requires /usr/bin/unbuffer to work properly. However, the unbuffer script is told to look for the iaxmodem binary in /usr/bin/ whereas the iaxmodem rpm places this in /usr/sbin/. I dealt with this using a soft link: ln -s /usr/sbin/iaxmodem /usr/bin/iaxmodem.

These changes now permit the iaxmodem@0 service to run.

# systemctl status -l iaxmodem@0
● [email protected] - iaxmodem ttyIAX0
   Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2023-10-13 12:20:44 EDT; 4min 19s ago
 Main PID: 24254 (tclsh)
   CGroup: /system.slice/system-iaxmodem.slice/[email protected]
           ├─24254 tclsh /usr/bin/unbuffer /usr/bin/iaxmodem iaxmodem-cfg.ttyIAX0
           └─24260 /usr/bin/iaxmodem iaxmodem-cfg.ttyIAX0

Oct 13 12:24:34 inet29.internal.harte-lyne.ca unbuffer[24254]: [2023-10-13 12:24:34.976729] Registration completed successfully.

I am still seeing this is the status report:

Oct 13 12:24:34 inet29.internal.harte-lyne.ca unbuffer[24254]: [2023-10-13 12:24:34.975541] strange... tx.in_bytes: 32739, tx.out_bytes: 0, DSP_BUFSIZE: 4096
Oct 13 12:24:34 inet29.internal.harte-lyne.ca unbuffer[24254]: [2023-10-13 12:24:34.976062] strange... tx.in_bytes: 32739, tx.out_bytes: 0, DSP_BUFSIZE: 4096
Oct 13 12:24:34 inet29.internal.harte-lyne.ca unbuffer[24254]: [2023-10-13 12:24:34.976499] strange... tx.in_bytes: 32739, tx.out_bytes: 0, DSP_BUFSIZE: 4096

Is this caused by the lack of a carrier on the modem FXO ports?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.