From d9bacacbd0a49578df64e7b22d9261833e9e7e74 Mon Sep 17 00:00:00 2001 From: Moritz Kempe Date: Sun, 4 Aug 2024 22:25:33 +0200 Subject: [PATCH 1/4] restructurized and added Debian 12 guide --- README.md | 116 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 96 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 2502b7b..52d55a7 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,96 @@ # Linux Fax Stack Setup (HylaFax & SIP) -- ***This guide is WIP*** -- Ubuntu 20.04 LTS VM (VirtualBox, LXC?) -- **TODO: Test on Debian / RockPi / RaspberryPi** -- **TODO: Test on Eventphone Infra** +Linux Fax Stack using Hylafax and t38modem. -
+***THIS GUIDE IS WIP*** -## Setup t38modem +This guide was created using information from the opalvoid wiki (http://wiki.opalvoip.org/index.php?n=Main.HomePage) -- **TODO: Package t38modem with service files and config** +## Softwarestack -## Opal +### ptlib +(legacy) library for doing a little bit of everything. -- http://wiki.opalvoip.org/index.php?n=Main.HomePage +### Opal +Voice codec used by e.g. mumble. + +### t38modem +Emulates a serial modem from SIP connetion + +### Hylafax +Enterprise grade software, managing physical and emulated modems. + +Has some problems: https://github.com/lexbailey/compilerfax/blob/main/hylafax_is_broken + +## Operating Systems +Unfortunately this software stack uses a lot of legacy software. Because of this, this guide was only tested on specific software versions + +### Debian 12 Bookworm +For Debian 12, we´ll only install dependencies which are hard requirements. +For this guide we'll use ptlib 2.18.6 and opal 3.18.6. + +#### Installing Requirements +First we'll need some packages +```bash +apt-get install build-essential git wget pkg-config libssl-dev libsrtp2-dev -y +``` +#### Download sourcecode +Versions: +- libpt (2.18.6) https://sourceforge.net/projects/opalvoip/files/v3.18 Cygni/Stable 6/ +- opal (3.18.6) https://sourceforge.net/projects/opalvoip/files/v3.18 Cygni/Stable 6/ +- t38mdem (4.6.2) https://github.com/hehol/t38modem/releases/tag/4.6.2 + +#### ptlib +```bash +./configure +make +make install +''' + +#### opal +```bash +./configure +make -j5 +make runtest +make install +''' + +#### t38modem +If you are getting error about `-1` not being able to be casted to a `long unsigned int` due to `-Wnarrowing` inside `dle.cxx`, you can add `-Wno-narrowing` after the `CPPFLAGS` in the Makefile to disable this error + +'''bash +git clone https://github.com/hehol/t38modem +cd t38modem +make +''' + +If running the t38modem executable, you should run these commands +```bash +cp /usr/local/lib/libpt.so.2.18.6 /lib +cp /usr/local/lib/libopal.so.3.18.6 /lib +``` + +To install t38modem run +```bash +cp t38modem /bin/t38modem +``' + +### Ubuntu 20.04 LTS +Was tested on Ubuntu 20.04 LTS VM (VirtualBox, LXC?) + +You can relies heavily on http://wiki.opalvoip.org/index.php?n=Main.HomePage + +Versions: +- libpt (2.18.6) https://sourceforge.net/projects/opalvoip/files/v3.18 Cygni/Stable 6/ +- opal (3.18.6) https://sourceforge.net/projects/opalvoip/files/v3.18 Cygni/Stable 6/ +- t38mdem (4.6.2) https://github.com/hehol/t38modem/releases/tag/4.6.2 + +Follow http://wiki.opalvoip.org/index.php?n=Main.BuildingPTLibUnix and http://wiki.opalvoip.org/index.php?n=Main.HomePage **but** - Don't use `libavformat-dev` -> Compile error in Opal -- https://sourceforge.net/projects/opalvoip/files/ -- Version 3.18.6 -- **TODO: Test out other versions** -- `.tar.bz2` files for *nix +- Configure script needs `pkg-config` to be installed to find ptlib install +- On SourceForge downloads `.tar.bz2` files for *nix -### Build PTLib +#### Build PTLib - Version 2.18.6 - Dependency of Opal, bundled with Opal source code (SourceForge) @@ -31,7 +101,7 @@ sudo apt install \ 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 + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev pkg-config ``` - PTLib will be installed in the `/usr/local` tree -> set `PKG_CONFIG_PATH` to be findable (compile time) @@ -50,7 +120,7 @@ make sudo make install ``` -### Build Opal +#### Build Opal - Version 3.18.6 - http://wiki.opalvoip.org/index.php?n=Main.BuildingOpalUnix @@ -76,11 +146,11 @@ make sudo make install ``` -## t38modem +#### t38modem - https://github.com/hehol/t38modem, Version 4.6.2 - - Could also use https://github.com/T38Modem/t38modem, not as maintained -- If you are getting error about `-1` not being able to be casted to a `long unsigned int` due to `-Wnarrowing` inside `dle.cxx`, you can add `-Wno-narrowing` to the `CPPFLAGS` in the Makefile to disable this error + - https://github.com/T38Modem/t38modem could also be used, but seems to be not as maintained +- If you are getting error about `-1` not being able to be casted to a `long unsigned int` due to `-Wnarrowing` inside `dle.cxx`, you can add `-Wno-narrowing` after the `CPPFLAGS` in the Makefile to disable this error ```bash cd t38modem-x.y.z/ @@ -90,12 +160,13 @@ sudo cp ./t38modem /usr/local/bin - t38modem can only find Opal if `LD_LIBRARY_PATH` and `PTLIBPLUGINDIR` are environment variables to the program -### Init script +#### Init script - To automatically start t38modem, you need to create Systemd services, as well as start and stop scripts - 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/` +## Using t38modem (requires systemd) ```bash #!/bin/bash # /etc/t38modem/bin/run @@ -252,3 +323,8 @@ FaxMaster: $USER # replace with fax admin account ## FaxDispatch - https://legacy.hylafax.org/content/Advanced_Permissions_with_6.0 + +## TODO +- **TODO: Test on Debian / RockPi / RaspberryPi** +- **TODO: Test on Eventphone Infra** +- **TODO: Package t38modem with service files and config** From ca75ef705090957f9050e30d102c08a295688968 Mon Sep 17 00:00:00 2001 From: Moritz Kempe Date: Sun, 4 Aug 2024 22:30:45 +0200 Subject: [PATCH 2/4] repaired bad codeblocks --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 52d55a7..035f369 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Versions: ./configure make make install -''' +``` #### opal ```bash @@ -53,16 +53,16 @@ make install make -j5 make runtest make install -''' +``` #### t38modem If you are getting error about `-1` not being able to be casted to a `long unsigned int` due to `-Wnarrowing` inside `dle.cxx`, you can add `-Wno-narrowing` after the `CPPFLAGS` in the Makefile to disable this error -'''bash +```bash git clone https://github.com/hehol/t38modem cd t38modem make -''' +``` If running the t38modem executable, you should run these commands ```bash From 71ad043f8919f8a125349c2b6a6ebe85ee6aafd5 Mon Sep 17 00:00:00 2001 From: Moritz Kempe Date: Sun, 4 Aug 2024 22:32:30 +0200 Subject: [PATCH 3/4] fixed another bag codeblock --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 035f369..1511696 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ cp /usr/local/lib/libopal.so.3.18.6 /lib To install t38modem run ```bash cp t38modem /bin/t38modem -``' +``` ### Ubuntu 20.04 LTS Was tested on Ubuntu 20.04 LTS VM (VirtualBox, LXC?) From a9f1005c3e6b0e89f2469491964f21c6adabb1df Mon Sep 17 00:00:00 2001 From: Moritz Kempe Date: Tue, 6 Aug 2024 00:16:55 +0200 Subject: [PATCH 4/4] Redone the configuring t38modem part --- README.md | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1511696..e676d27 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ cp /usr/local/lib/libopal.so.3.18.6 /lib To install t38modem run ```bash -cp t38modem /bin/t38modem +cp ./t38modem /usr/local/bin ``` ### Ubuntu 20.04 LTS @@ -160,13 +160,19 @@ sudo cp ./t38modem /usr/local/bin - t38modem can only find Opal if `LD_LIBRARY_PATH` and `PTLIBPLUGINDIR` are environment variables to the program -#### Init script +
+ +## Configuring t38modem +### Init script - To automatically start t38modem, you need to create Systemd services, as well as start and stop scripts - 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/` -## Using t38modem (requires systemd) +First we'll create the configuration directory under `/etc` using `sudo mkdir -p /etc/t38modem/bin/`. + +Then create a file named `/etc/t38modem/bin/run` using the following content. +It will be the script to manage the current status of t38modem. + ```bash #!/bin/bash # /etc/t38modem/bin/run @@ -210,16 +216,23 @@ esac exit 0 ``` +And then we'll have to make it executable like this. + ```bash sudo chmod +x /etc/t38modem/bin/run ``` +#### Quick script overview +- Using that script, it is possible to `start` or `stop` the emulated modem. - `-t` enables debugging - More `t`'s is deeper debugging (e.g. `-tttt`) - You can of course run the t38modem command without this init script - If t38modem says it was able to create the virtual modem but `/dev/ttyT38-1` is not available, you do not have sufficient permissions - Configuration is specified in `/etc/t38modem/config` +### Create the configuration file +Create a file using the following contents at `/etc/t38modem/config`. + ```bash # /etc/t38modem/config T38MODEM_SIP_USERNAME="USERNAME" @@ -227,18 +240,19 @@ T38MODEM_SIP_PASSWORD="PASSWORD" T38MODEM_SIP_SERVER="voip.example.com" ``` -- Give only root access to the config +You should give only root access to the config. ```bash 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) +### Testing your setup +- 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) - Test using minicom, configure it to point to our modem. Each command is initiated by a Return - Dial a number: - Get the attention of the modem: `at` -> `OK` - - Dial: `atd0123456789` + - Dial: `atd[NUMBER]`, replace '[NUMBER]' using the number, you want to call - If all works correctly you should be able to answer the phone and hear a single beep - Answer a call: - Get the attention of the modem: `at` -> `OK` @@ -251,6 +265,8 @@ sudo chmod 700 /etc/t38modem/config - Test the command before running the init script! ### systemd service +If you want to run a fax server, you can create a systemd service to let your emulated fax modem start automatically on system boot. +To do this you have to copy paste the following into `/etc/systemd/system/t38modem.service`. ```toml # /etc/systemd/system/t38modem.service @@ -270,8 +286,7 @@ Restart=always [Install] WantedBy=multi-user.target ``` - -- Enable the service: +Enable and start the service using the following commands: ```bash sudo systemctl daemon-reload