Redone the configuring t38modem part

This commit is contained in:
Moritz Kempe 2024-08-06 00:16:55 +02:00
parent 71ad043f89
commit a9f1005c3e

View file

@ -72,7 +72,7 @@ cp /usr/local/lib/libopal.so.3.18.6 /lib
To install t38modem run To install t38modem run
```bash ```bash
cp t38modem /bin/t38modem cp ./t38modem /usr/local/bin
``` ```
### Ubuntu 20.04 LTS ### 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 - t38modem can only find Opal if `LD_LIBRARY_PATH` and `PTLIBPLUGINDIR` are environment variables to the program
#### Init script <hr/>
## Configuring t38modem
### Init script
- To automatically start t38modem, you need to create Systemd services, as well as start and stop scripts - 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/ - 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 ```bash
#!/bin/bash #!/bin/bash
# /etc/t38modem/bin/run # /etc/t38modem/bin/run
@ -210,16 +216,23 @@ esac
exit 0 exit 0
``` ```
And then we'll have to make it executable like this.
```bash ```bash
sudo chmod +x /etc/t38modem/bin/run 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 - `-t` enables debugging
- More `t`'s is deeper debugging (e.g. `-tttt`) - More `t`'s is deeper debugging (e.g. `-tttt`)
- You can of course run the t38modem command without this init script - 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 - 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` - Configuration is specified in `/etc/t38modem/config`
### Create the configuration file
Create a file using the following contents at `/etc/t38modem/config`.
```bash ```bash
# /etc/t38modem/config # /etc/t38modem/config
T38MODEM_SIP_USERNAME="USERNAME" T38MODEM_SIP_USERNAME="USERNAME"
@ -227,18 +240,19 @@ T38MODEM_SIP_PASSWORD="PASSWORD"
T38MODEM_SIP_SERVER="voip.example.com" T38MODEM_SIP_SERVER="voip.example.com"
``` ```
- Give only root access to the config You should give only root access to the config.
```bash ```bash
sudo chown root:root /etc/t38modem/config sudo chown root:root /etc/t38modem/config
sudo chmod 700 /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 - Test using minicom, configure it to point to our modem. Each command is initiated by a Return
- Dial a number: - Dial a number:
- Get the attention of the modem: `at` -> `OK` - 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 - If all works correctly you should be able to answer the phone and hear a single beep
- Answer a call: - Answer a call:
- Get the attention of the modem: `at` -> `OK` - 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! - Test the command before running the init script!
### systemd service ### 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 ```toml
# /etc/systemd/system/t38modem.service # /etc/systemd/system/t38modem.service
@ -270,8 +286,7 @@ Restart=always
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
Enable and start the service using the following commands:
- Enable the service:
```bash ```bash
sudo systemctl daemon-reload sudo systemctl daemon-reload