All of modemmenu was one package main in the repository's root. It is
now one module with the program and the pieces it is made of apart:
cmd/modemmenu/ the program (the login, the menu, access, limits,
the selections, -serve, AutoPPP, drop files, the
auth socket's server)
internal/config/ modemmenu.conf's sections and keys, {name} templates
internal/term/ the caller's line, terminal detection, PETSCII
internal/auth/ the backends and password changes
internal/telnet/ the telnet client of mode = telnet items
authd/ the auth socket's protocol and a client, for a BBS
to import (bbs's internal/menuauth is a copy of it)
samples/ the .conf, .users, .pam and .service samples
make builds ./cmd/modemmenu and installs the samples from samples/; the
docs, confref and the site's reference follow. The tests are where
their code is, none lost. TestSampleHasEveryKey now reads the keys of
internal/ too (and the exported Get, Bool...: it would have found none).
.gitignore's "modemmenu" ignored cmd/modemmenu/ as well: it is
/modemmenu now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRbjf74j8oq9R3PXhA
modemmenu on FreePBX
A ready-made setup for FreePBX 16 and 17: callers dial in, their modem connects to D-Modem, and modemmenu asks for a user name and password from a text file before showing its menu.
| file | goes to | |
|---|---|---|
| modemmenu.conf | /etc/modemmenu/modemmenu.conf |
the login and the menu |
| modemmenu.users | /etc/modemmenu/modemmenu.users |
the callers' names and passwords |
| modemmenu.service | /etc/systemd/system/modemmenu.service |
runs modemmenu for every call |
| extensions_custom.conf | add to /etc/asterisk/extensions_custom.conf |
an optional test extension |
The files live in /etc/modemmenu, not /etc/asterisk, so that FreePBX's
fwconsole chown never opens the users file to the asterisk user.
How a call goes
caller's modem ──SIP──▶ FreePBX inbound route ──▶ D-Modem: menu
(dmodem-ari or app_dmodem)
│ unix socket, call details first
▼
modemmenu -serve ──▶ login from modemmenu.users
──▶ menu: PPP, last callers, password
One modemmenu -serve answers every call on
/run/modemmenu/modemmenu.sock. The socket belongs to the asterisk
group, so Asterisk and dmodem-ari can connect and other users cannot.
Each call gets a session of its own.
Setting it up
This assumes D-Modem's FreePBX module is installed, with dmodem-ari or app_dmodem, as in D-Modem's docs/freepbx.md.
-
Build modemmenu. It needs Go 1.22 or later; Debian 12 (FreePBX 17) ships Go 1.19, so build it on another machine or use bookworm-backports. This setup does not use PAM, so a static build copies to any x86-64 Linux:
CGO_ENABLED=0 make PAM=0 scp modemmenu root@freepbx:/usr/local/bin/Or on the FreePBX machine itself:
make PAM=0 install-freepbx, which also does steps 2 and 3 without overwriting files that are already there. -
Install the files (as root):
install -d -m 755 /etc/modemmenu install -m 644 freepbx/modemmenu.conf /etc/modemmenu/ install -m 600 freepbx/modemmenu.users /etc/modemmenu/ install -m 644 freepbx/modemmenu.service /etc/systemd/system/ -
Add the callers.
modemmenu -hashasks for a password and prints its bcrypt hash; each caller is aname:hashline in/etc/modemmenu/modemmenu.users:echo "alice:$(modemmenu -hash)" >> /etc/modemmenu/modemmenu.usersFor a first test,
test:{PLAIN}changemewill do; take it out after. The file is read at each login, so changes need no restart. -
Check and start it:
modemmenu -check -config /etc/modemmenu/modemmenu.conf systemctl daemon-reload systemctl enable --now modemmenu ls -l /run/modemmenu/modemmenu.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/modemmenu/modemmenu.sockCall details first on Leave the rest at their defaults. This writes a
[menu]profile withmode = unixandheader = yesinto/etc/asterisk/dmodem.conf, and the destinationapp-dmodem,menu,1. -
Send calls to it. In Connectivity > Inbound Routes, pick D-Modem: menu as the destination of the modem line's DID. Click Apply Config. With dmodem-ari, restart it so that it reads the new profile.
-
Test it (optional). Add extensions_custom.conf's lines to
/etc/asterisk/extensions_custom.confand runfwconsole reload: a modem on one of your extensions (an ATA) dialling6368reaches the menu without going through the trunk.
Keep the trunk and the extension to one codec (ulaw or alaw), with fax detection off; D-Modem's line check page lists what is still in the way.
The menu
- PPP: dial-up networking.
apt install pppfirst. The sample gives one pair of addresses (192.168.77.1 for the server, .2 for the caller), so one PPP caller at a time; forward or masquerade 192.168.77.0/24 for the internet. Windows' Dial-Up Networking logs in with PAP instead of at the prompt: turn on[autoppp]and install pppd'smodemmenu.soplugin (makebuilds it whenppp-devis installed). - Last callers, and Change your password, which rewrites the caller's line in the users file.
- Bulletin board (off until you add
bbsto[menu] items): D-Modem's BBS on its unix socket, taking the caller as logged in.
Each call may last an hour and each user two hours a day
(time_limit, daily_limit); the menu prompt shows the minutes left.
To let callers make their own accounts, set [signup] enabled = yes:
"new" at the login prompt adds a locked line to the users file, which
you unlock by removing its !.
When it does not work
journalctl -t modemmenushows each call, login and selection.- "The lines are busy" or no menu: is
modemmenu.servicerunning, and is the socket's groupasterisk? Asterisk must be in that group (it is on FreePBX). - No rate or caller ID on the screen: turn on Call details first in the profile.
- With dmodem-ari, the dialed number modemmenu sees is the profile's
name (
menu), not the DID, because FreePBX reaches it through theapp-dmodemcontext.