From a45d3fba6b5ebdadbec9fe5000674a7469d02695 Mon Sep 17 00:00:00 2001 From: Dominic Grimm Date: Thu, 1 Aug 2024 18:21:40 +0200 Subject: [PATCH] Fix service --- README.md | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 5012087..04345f1 100644 --- a/README.md +++ b/README.md @@ -23,18 +23,13 @@ ### Build PTLib - Version 2.18.6 - - Dependency of Opal, bundled with Opal source code (SourceForge) - - http://wiki.opalvoip.org/index.php?n=Main.BuildingPTLibUnix -- Wiki outdated: - - `libssl1.0-dev` -> `libssl-dev` - - **TODO: Remove dependencies, most of them are optional** ```bash sudo apt install \ - g++ git make autoconf libpcap-dev libexpat-dev libssl-dev libsasl2-dev libldap-dev \ + g++ git make autoconf libpcap-dev libexpat1-dev libssl-dev libsasl2-dev libldap2-dev \ unixodbc-dev liblua5.3-dev libv8-dev libncurses-dev libsdl2-dev \ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev ``` @@ -59,15 +54,12 @@ sudo make install - Version 3.18.6 - http://wiki.opalvoip.org/index.php?n=Main.BuildingOpalUnix -- Wiki outdated: - - `libsrtp-dev` -> `libsrtp2-dev` - - Dont use `capiutils`, we are not using ISDN capable cards - - Dont use `libavcodec-dev` -> Compile error +- Dont use `libavcodec-dev` -> Compile error - **TODO: Remove dependencies, most of them are optional** ```bash sudo apt install \ - lisrtp2-dev libgsm1-dev libspeex-dev libopus-dev libx264-dev \ + libsrtp2-dev libgsm1-dev libspeex-dev libopus-dev libx264-dev \ libvpx-dev libtheora-dev libspandsp-dev dahdi ``` @@ -101,14 +93,15 @@ sudo cp ./t38modem /usr/local/bin ### Init script - To automatically start t38modem, you need to create Systemd services, as well as start and stop scripts -- init.d script is adapted from https://web.archive.org/web/20111231021042/https://www.foriamroot.org/hylafax-6-0-debian-or-ubuntu-t38modem-1-0-asterisk-1-6/ +- script is adapted from https://web.archive.org/web/20111231021042/https://www.foriamroot.org/hylafax-6-0-debian-or-ubuntu-t38modem-1-0-asterisk-1-6/ +- `sudo mkdir -p /etc/t38modem/bin/` ```bash #!/bin/bash -# /etc/init.d/t38modem +# /etc/t38modem/bin/run export LD_LIBRARY_PATH=/usr/local/lib -export PTLIBPLUGINDIR=/usr/local/lib/ptlib-x.y.z:/usr/local/lib/opal-x.y.z # Adjust lib versions! +export PTLIBPLUGINDIR=/usr/local/lib/ptlib-x.y.z:/usr/local/lib/opal-a.b.c # Adjust lib versions! case "$1" in start) @@ -118,7 +111,7 @@ case "$1" in # - T38MODEM_SIP_PASSWORD # - T38MODEM_SIP_SERVER - COMMAND="t38modem -u 'T38modem' --ptty +/dev/ttyT38-1 --sip-proxy '${T38MODEM_SIP_USERNAME}:${T38MODEM_SIP_PASSWORD}@${T38MODEM_SIP_SERVER}' --sip-register '${T38MODEM_SIP_USERNAME}@${T38MODEM_SIP_SERVER},${T38MODEM_SIP_PASSWORD}' --sip-listen udp\$:5060 --route 't38:.*=sip:@${T38MODEM_SIP_SERVER}' --route 'sip:.*=t38:'" + COMMAND="t38modem -u T38modem --ptty +/dev/ttyT38-1 --sip-proxy ${T38MODEM_SIP_USERNAME}:${T38MODEM_SIP_PASSWORD}@${T38MODEM_SIP_SERVER} --sip-register ${T38MODEM_SIP_USERNAME}@${T38MODEM_SIP_SERVER},${T38MODEM_SIP_PASSWORD} --sip-listen udp\$:5060 --route t38:.*=sip:@${T38MODEM_SIP_SERVER} --route sip:.*=t38:" exec $COMMAND > /dev/null 2>&1 & PID=$! echo "Starting t38modem with pid $PID (pidfile /run/t38modem.pid)" @@ -146,7 +139,7 @@ exit 0 ``` ```bash -sudo chmod +x /etc/init.d/t38modem +sudo chmod +x /etc/t38modem/bin/run ``` - `-t` enables debugging @@ -165,8 +158,8 @@ T38MODEM_SIP_SERVER="voip.example.com" - Give only root access to the config ```bash -sudo chown root:root /etc/t38modem -sudo chmod 700 /etc/t38modem +sudo chown root:root /etc/t38modem/config +sudo chmod 700 /etc/t38modem/config ``` - You can now communicate with your modem `/dev/ttyT38-1` , just as if it was a real Hayes compatible modem (https://www.computerhope.com/atcom.htm) @@ -191,14 +184,16 @@ sudo chmod 700 /etc/t38modem # /etc/systemd/system/t38modem.service [Unit] Description=t38modem -After=network.target +After=network-online.target +Wants=network-online.target [Service] Type=simple -ExecStart=/etc/init.d/t38modem start -ExecStop=/etc/init.d/t38modem stop +ExecStart=/etc/t38modem/bin/run start +ExecStop=/etc/t38modem/bin/run stop PIDFile=/run/t38modem.pid KillMode=none +Restart=always [Install] WantedBy=multi-user.target @@ -216,4 +211,13 @@ sudo systemctl start t38modem.service ## HylaFax -- **TODO** \ No newline at end of file +- Version 6 +- `sudo apt install hylafax-server` + - Set Postfix Configuration to **Local only** in dpkg-reconfigure menu +- Run `sudo faxsetup` + - Add new modem + - Enter correct modem port (`ttyT38-1`) + - Enter dialing configuration + - Accept default configuration for everything else + - It should automatically detect it to be a `T38FAX` modem +