Getting a dial-up modem working with VoIP

Recently I’ve been doing a lot of Retro computing, mostly with the BBC Master 128 last year & this year I’m going to be doing more with other older systems ranging from a Commodore 64 that’s ready to be worked on to operating systems like CP/M & Bulletin Boards (BBS).

As I’m intending on doing some videos later on how bulletin boards were accessed in the old pre-Internet days. Now these days we have WiFi modems available which emulate a dial-up modem & then connect to a bulletin board (they do still exist) over the internet.

But that’s too clean & modern so how about using an old modem? So to do that I wanted to setup a pair of modem’s so that we can reproduce an old dial-up experience.

US Robotics 56K modem we will use to dial in with

Most people don’t have a land line anymore, nor are there many BBS’s online that are connected to the old phone system, so the only option is using VoIP to connect them. However if you read online, most people say it’s either not possible or would be painfully slow.

So, let’s see if we can get something working.

VoIP POTS adaptors

First we need some way to connect the modems to the network. For this you need a VoIP Phone Adaptor. These are available online with prices ranging from £30 up, depending on where you look.

I managed to get my hands on a pair of Linksys PAP2T’s for £1.20 in an eBay auction (that’s for both not each, with postage total was £9.20!). These provide 2 POTS ports to connect old phones, fax machines & modems & a 100Mb ethernet port.

Linksys PAP2T VoIP POTS adaptor.

These come with a simple (but unsecured) web interface (they default to 192.168.0.5 as their IP address) which you can use to configure them.

As I had two of them I’ve setup one in my home office & the other in my main rack.

Linksys adaptor sitting in my main 42U rack with a USR Robotics modem connected to Extension 05

Configuring the PBX

Next was to configure them on the PBX. I’m running 3cx on a Raspberry PI 3B+ as my home PBX but you can use Asterisk as well. I created 4 new extensions, 2 for each of these adaptors.

ExtensionDevice
05Rack Modem we will dial in to
06Spare, available for a second modem
07Office modem we will dial out from
08Spare
The new extensions created for POTS use

Now in the Linksys admin page we have to setup the extension. There’s two sections in the config we need to change.

First is the Proxy and Registration & Subscriber Information sections:

Here the Proxy & Outbound proxy is the address of our PBX.

Under Subscriber Information: User ID is the extension number whilst Password & Auth ID are the authentication it needs to connect to that extension. In 3cx these last two are auto generated and available in the extensions config page.

Below that there’s the Auto Configuration section, make certain it’s set with the following values:

The main part here is that the Preferred Codec is G711a & Use Pref Codec only is set. Using any other codecs (including G711u) there causes the modems not to sync. I’ve also disabled Echo and fax support as that causes it to change the codecs.

Modems

Now for the modems. I’m using a pair of US Robotics modems, as that’s the type I had used back in the late 1980’s & 1990’s. You can get hold of these of eBay for about £20.

Just make certain you get the Hardware versions (i.e. with a proper RS232 port) and not a Software modem, specifically if you see one with USB stay clear of it. Software modems do not have a controller on board & rely on software on the computer to work, so if you want to connect it to a retro system it will not work! Same goes for trying to get a software modem running on Linux – it won’t, most of them have outdated drivers which are for Windows 95, NT or XP only.

Raspberry PI Dial-up Server

I’m using a Raspberry PI as the server I also used an RS232-USB adaptor cable to connect the modem to it. These you can easily get for about £8 off Amazon and have a 9 pin male connector on one end. If your modem doesn’t have a cable then you’ll also need an adaptor cable as the modems tend to have a full 25 pin RS232 connector. Most (but not all) modem cables have 9pin on the computer end & 25 pin on the modem end.

To get the PI to answer calls we need some software. As initially I want just the standard login prompt I’m using mgetty which does just that, manages the modem & presents a login prompt:

sudo apt update
sudo apt install mgetty

Next we need to create the systemd script /etc/systemd/system/mgetty.service with the following:

sudo vi /etc/systemd/system/mgetty.service
[Unit]
 Description=Extension 05 Modem USB
 Documentation=man:mgetty(8)
 Requires=systemd-udev-settle.service
 After=systemd-udev-settle.service

[Service]
 Type=simple
 ExecStart=/sbin/mgetty -x0 -s 57600 /dev/ttyUSB0
 Restart=always
 PIDFile=/var/run/mgetty.pid.ttyUSB0

[Install]
 WantedBy=multi-user.target

This presumes the USB serial adaptor has presented itself at /dev/ttyUSB0. If it’s the sole one then it will be it.

Next we need to edit /etc/mgetty/mgetty.config and append the following:

port ttyUSB0
   speed 9600
   data-only y
   toggle-dtr n
   login-prompt @ \P login:\040
   login-time 60
   term vt102

Now start the service:

sudo systemctl daemon-reload
sudo systemctl start mgetty

Testing dial-up works

For an initial test I’m just using another Linux box with another modem connected via a USB adaptor. For a terminal I’m using minicom

sudo apt update
sudo apt install minicom

With the modem connected it should appear at /dev/ttyUSB0 so start minicom:

minicom -D /dev/ttyUSB0

If this fails you might need to ensure you are in the dialout group.

Once minicom is running you should find the modem is connected. Type ATZ and it should show OK

Welcome to minicom 2.7.1
OPTIONS: I18n 
Compiled on Dec 23 2019, 02:06:26.
Port /dev/ttyUSB0, 14:11:29

Press CTRL-A Z for help on special keys

atz
OK

Now try dialing. Here I’ve got the server on extension 05 so thats the phone number we will dial.

So enter st&N4dt05 & press enter:

at&N4dt05
CONNECT 4800/ARQ/V34/LAPM/V42BIS
Debian GNU/Linux ttyUSB0 57600 (4800/ARQ/V34/LAPM/V42BIS)

cl-002 ttyUSB0 login: 

If you see that then you have successfully dialed your Raspberry PI.

Now in that example we used &N4 which for US Robotics modems tells them to connect at 4800 bps. Remember I said that speeds can be affected with VoIP. Here’s a simple table of some &N commands relate to which speed:

CommandExampleLink Speed
&N0AT&N0Highest link speed
&N1AT&N1300 bps
&N2AT&N21200 bps
&N3AT&N32400 bps
&N4AT&N44800 bps
&N6AT&N69600 bps
&N8AT&N814400 bps
&N9AT&N916800 bps
&N10AT&N1019200 bps
&N14AT&N1428800 bps
Link speeds set by the &N command

I’ve only shown some of the options here, you can find more on this page.

Also, if you are going to use a faster speed than 9600 then make certain you have the speed in mgetty.config on the server set to the maximum you want to support.

Demonstration

Here you can see a quick video of this in action.

Demonstration of connecting to a Raspberry PI over a modem at various line speeds.

That’s it for this post. The next one on this subject will be showing this working with something from that era

Links

Author: petermount1

Prolific Open Source developer who also works in the online gaming industry during the day. Develops in Java, Go, Python & any other language as necessary. Still develops on retro machines like BBC Micro & Amiga A1200

One thought on “Getting a dial-up modem working with VoIP”

Leave a comment