A signup made the account in the users file only. Now it makes the account in each backend of [general] auth that is set up to make accounts: the users file, SQL ([sql] insert_query), LDAP ([ldap] add_dn, added as add_bind_dn, the password set by Password Modify or unicodePwd for AD) and system accounts ([system] create_command, with a useradd sample script). [signup] backends limits the list. Before the account is made, each backend checks that the name is free. If one backend fails, the accounts already made are taken back (delete_query, entry delete, remove_command). With pending = yes, each backend must lock the account, or dmodem-login does not start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRRfuh3h6uNuHtaugux
6.5 KiB
dmodem-login on FreePBX
This is a configuration for FreePBX 16 and 17 that is ready to use. Callers dial in, and their modem connects to D-Modem. Then dmodem-login asks for a user name and a password and checks them against a text file. Then it shows its menu.
| file | goes to | |
|---|---|---|
| dmodem-login.conf | /etc/dmodem-login/dmodem-login.conf |
the login and the menu |
| dmodem-login.users | /etc/dmodem-login/dmodem-login.users |
the names and passwords of the callers |
| dmodem-login.service | /etc/systemd/system/dmodem-login.service |
runs dmodem-login for all calls |
| extensions_custom.conf | add to /etc/asterisk/extensions_custom.conf |
an optional test extension |
The files are in /etc/dmodem-login, not in /etc/asterisk. Thus the
fwconsole chown of FreePBX never gives the asterisk user access to the
users file.
How a call goes
caller's modem ──SIP──▶ FreePBX inbound route ──▶ D-Modem: menu
(dmodem-ari or app_dmodem)
│ unix socket, call details first
▼
dmodem-login -serve ──▶ login from dmodem-login.users
──▶ menu: PPP, last callers, password
One dmodem-login -serve answers all calls on
/run/dmodem-login/dmodem-login.sock. The socket belongs to the asterisk
group. Thus Asterisk and dmodem-ari can connect, and other users cannot.
Each call gets its own session.
Setting it up
Before you start, install the FreePBX module of D-Modem, with dmodem-ari or app_dmodem. Refer to docs/freepbx.md of D-Modem.
-
Build dmodem-login. It must have Go 1.22 or later. Debian 12 (FreePBX 17) has Go 1.19. Thus, build dmodem-login on a different machine, or use bookworm-backports. This configuration does not use PAM. Thus you can copy a static build to any x86-64 Linux:
CGO_ENABLED=0 make PAM=0 scp dmodem-login root@freepbx:/usr/local/bin/Alternatively, on the FreePBX machine, run
make PAM=0 install-freepbx. This command also does steps 2 and 3. It does not overwrite files that are already there. -
Install the files (as root):
install -d -m 755 /etc/dmodem-login install -m 644 freepbx/dmodem-login.conf /etc/dmodem-login/ install -m 600 freepbx/dmodem-login.users /etc/dmodem-login/ install -m 644 freepbx/dmodem-login.service /etc/systemd/system/ -
Add the callers.
dmodem-login -hashasks for a password and prints its bcrypt hash. Each caller is aname:hashline in/etc/dmodem-login/dmodem-login.users:echo "alice:$(dmodem-login -hash)" >> /etc/dmodem-login/dmodem-login.usersFor a first test, you can use
test:{PLAIN}changeme. Remove it after the test. dmodem-login reads the file at each login. Thus you do not have to restart after a change. -
Check and start dmodem-login:
dmodem-login -check -config /etc/dmodem-login/dmodem-login.conf systemctl daemon-reload systemctl enable --now dmodem-login ls -l /run/dmodem-login/dmodem-login.sock # srw-rw---- root asterisk -
Add the D-Modem profile in Applications > D-Modem > Profiles:
field value Name menuData goes to A server on a unix socket Socket /run/dmodem-login/dmodem-login.sockCall details first on Keep the default values for the other fields. This step writes a
[menu]profile withmode = unixandheader = yesinto/etc/asterisk/dmodem.conf. It also adds the destinationapp-dmodem,menu,1. -
Send calls to the profile. In Connectivity > Inbound Routes, select D-Modem: menu as the destination of the DID of the modem line. Click Apply Config. If you use dmodem-ari, restart it. Then it reads the new profile.
-
Test the configuration (optional). Add the lines of extensions_custom.conf to
/etc/asterisk/extensions_custom.conf. Then runfwconsole reload. A modem on one of your extensions (an ATA) can then dial6368. The call gets to the menu and does not go through the trunk.
Limit the trunk and the extension to one codec (ulaw or alaw), and disable fax detection. The line check page of D-Modem lists the problems that remain.
The menu
- PPP: dial-up networking. First, run
apt install ppp. Each caller gets an address from[ppp_pool](100.120.224.10 to 100.120.255.254). The server is 100.120.224.1. For DNS, for the internet and to keep callers away from your LAN, runmake install-dialup(the dial-up network). Dial-Up Networking of Windows logs in with PAP, not at the prompt. For Windows, enable[autoppp]and install thedmodem-login.soplugin of pppd. Ifppp-devis installed,makebuilds the plugin. - Last callers, and Change your password. Change your password writes the line of the caller in the users file again.
- Bulletin board (disabled until you add
bbsto[menu] items): D-Modem's BBS on its unix socket. The BBS accepts the caller as logged in.
Each call can continue for a maximum of one hour, and each user for a
maximum of two hours each day (time_limit, daily_limit). The menu
prompt shows the minutes that remain. To let callers make their own
accounts, set [signup] enabled = yes. Then "new" at the login prompt
adds a locked line to the users file. To unlock the line, remove its
!. If [general] auth also has SQL, LDAP or system accounts, the
signup can also make the account there. Refer to
New accounts in each backend.
When it does not work
journalctl -t dmodem-loginshows each call, login and selection.- If you see "The lines are busy", or if there is no menu: make sure
that
dmodem-login.serviceruns, and that the group of the socket isasterisk. Asterisk must be in that group (on FreePBX, it is). - If the screen shows no rate or caller ID: enable Call details first in the profile.
- With dmodem-ari, the dialed number that dmodem-login sees is the name of
the profile (
menu), not the DID. The cause is that FreePBX gets to it through theapp-dmodemcontext.