The pool is 100.120.224.10-100.120.255.254; a pool may now be up to a /16 (65536 addresses). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRVTwDhoXdaYHRwQ4BT
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. Each caller gets an address of[ppp_pool](100.120.224.10 to 100.120.255.254, the server is 100.120.224.1). For DNS, the internet and keeping callers off your LAN,make install-dialup(the dial-up network). 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.