Connecting PhreakNet to Testar using Asterisk

Connecting PhreakNet to Testar using Asterisk

Created: 26th November 2026

Introduction

PhreakNet is a VoIP network of hobbyists, collectors and "switchers", run by InterLinked. Each member runs their own exchange (usually Asterisk, sometimes fronting real electromechanical kit), and the exchanges call each other over IAX2.

From your server's point of view:


PhreakNet Parameters Required

The following parameters are required and ar available in the portal. The portal is at portal.phreaknet.org (login is your InterLinked account; note the login uses the username, not the email address).

Item Where on the portal Example
CLLI (exchange ID) Switch/exchange list LONDUKUBDSD
Hostname the network dials Switch list → Edit glasstty.com
Numbers Numbers list 835-0433, 835-0434
IAX2 user(s) and password "Your Users" phreaknet / secret
API key (optional) Could be in the account area in Interlinked.us profile (keep private)

Notes:


Network Prerequisites


Asterisk Configuration

iax.conf

[general]
bindport=4569
;bindaddr=x.x.x.x          ; REQUIRED on DigitalOcean reserved IPs — see section 7
relaxdtmf=yes
bandwidth=high
disallow=all
allow=ulaw
allow=alaw
jitterbuffer=no             ; keep off for modem traffic
delayreject=yes
autokill=yes
encryption=yes              ; allow encrypted calls (used automatically when both ends agree)
trunk=yes
maxcallnumbers_nonvalidated=64
calltokenoptional=0.0.0.0/0.0.0.0
requirecalltoken=no

; No "register =>" line is needed if your hostname has a fixed address.
; (voip.phreaknet.org no longer resolves — remove any old register line pointing at it.)

[phreaknet]
type = user
secret = <password set on the portal for this user>
context = from-phreaknet            ; first context listed is the default
context = from-phreaknet-operator

#tryinclude iax-phreaknet-rsa-out.conf

Rules of thumb:

Apply with:

asterisk -rx "iax2 reload"
asterisk -rx "iax2 show users"

extensions.conf — Globals and Includes

#include verification.conf
#include phreaknet.conf

[globals]
clli=LONDUKUBDSD
mainphreaknetdisa=8350433          ; one of your PhreakNet numbers
;interlinkedkey=<your API key>     ; optional; add when you have it

verification.conf is PhreakNet's standard verification subroutine file (do not edit it). It calls the PhreakNet API using ${interlinkedkey}. Without a key, calls are still accepted — they are simply marked as unverified — so the key is not needed to get working.

The verification code uses CURL(); check func_curl is loaded:

asterisk -rx "module show like curl"

phreaknet.conf — Routing

[from-phreaknet]
exten => _[0-9*#A-Za-z]!,1,Gosub(phreaknet-verify,s,1(${EXTEN}))
 same => n,ExecIf($["${GOSUB_RETVAL}"="1"]?Hangup(21))
 same => n,Goto(phreaknet-in,${EXTEN},1)

[phreaknet-in]
exten => 8350433,1,Set(VOLUME(TX)=2)
 same => n,Set(VOLUME(RX)=2)
 same => n,Answer()
 same => n,Softmodem(glasstty.com,6502,v(V23)ld(7)s(1)e)
 same => n,Hangup()

exten => 8350434,1,Set(VOLUME(TX)=2)
 same => n,Set(VOLUME(RX)=2)
 same => n,Answer()
 same => n,Softmodem(glasstty.com,6503,v(V23)ld(7)s(1)e)
 same => n,Hangup()

Use same => n for every step after priority 1. Repeating the extension number on each line invites typos — a single transposed digit (e.g. 8350433 on line 1 and 8530433 on the rest) leaves neither number working, with no obvious error.

Apply and check:

asterisk -rx "dialplan reload"
asterisk -rx "dialplan show phreaknet-in"
asterisk -rx "dialplan show globals"

Each number should show the full set of priorities (here, 1–5).


Testing Without a PhreakNet Line

You can test the whole inbound path from any other Asterisk box on the internet (e.g. an office PABX) with no special configuration — chan_iax2 just needs to be loaded.

On the receiving server:

asterisk -rvvv
iax2 set debug on

On the test box:

asterisk -rvvv
iax2 set debug on
channel originate IAX2/phreaknet:<password>@glasstty.com/8350433 application Wait 20

(No < > brackets in the real command. From a shell, wrap it: asterisk -rx "channel originate ...".)

Understanding the Results

What you see on the server Meaning
Nothing at all Packets aren't arriving — DNS, firewall, or port forward.
NEW received, CTOKEN sent, then the caller retries and gives up Replies aren't reaching the caller — see section 7.
Accepting UNAUTHENTICATED call Working, but the user has no password.
AUTHREQ / AUTHREP, then Accepting AUTHENTICATED call Working with a password.
RD-Frame / TE-Frame and garbled frame types like (90?) Normal — the call is encrypted.
RTKEY Normal — mid-call encryption key rotation.
Packet Decrypt Failed! after AUTHREQ Wrong password (with encryption on, a wrong password produces an undecryptable stream).
Softmodem ... Cannot connect to remote host (often ~2 minutes later) The call worked but Softmodem couldn't reach the target TCP port.

Also test the negative cases: a wrong password and no password should both be rejected.

To check Softmodem's target ports are reachable from the Asterisk server itself:

nc -vz glasstty.com 6502
nc -vz glasstty.com 6503

Common Faults

  1. None matching extension number in phreaknet.conf — calls answered by nothing.
  2. User on the portal with no matching section in iax.conf — calls rejected.
  3. Stale register => line to voip.phreaknet.org — harmless but produces getaddrinfo ... No address associated with hostname errors. Remove it.
  4. Softmodem pointing at a port nothing listens on (or that the cloud firewall blocks) — call connects then fails.
  5. DigitalOcean reserved IP + UDP — the big one. See below.

DigitalOcean: Reserved IPs and IAX2

Droplet IP Addresses

A droplet with a reserved IP and VPC networking has four addresses:

Address (example) What it is Where it lives Used for
46.101.15.76 Public IP eth0 on the droplet The droplet's own internet address. Changes if the droplet is replaced.
46.101.66.218 Reserved IP DigitalOcean's network edge — not on the droplet The permanent public address your DNS points at. Can be moved between droplets.
10.16.0.6 Anchor IP eth0 on the droplet The internal landing point for the reserved IP.
10.131.0.2 Private (VPC) IP eth1 on the droplet Droplet-to-droplet private networking. Not reachable from the internet.

The control panel shows the public, reserved and private IPs, but not the anchor IP. Find it on the droplet:

ip addr show eth0

It's the second address on eth0, typically in 10.16.0.0/16 or similar. Alternatively:

curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address

Don't confuse the two 10.x addresses. The anchor IP serves the reserved IP; the VPC IP is an unrelated private network. Binding Asterisk to the VPC IP would cut it off from the internet entirely.

Reserved IPs

The reserved IP isn't configured on the droplet, DigitalOcean's edge holds it...

Moving a reserved IP to another droplet just re-points it at that droplet's anchor IP.

Why IAX2 Fails

By default Asterisk listens on 0.0.0.0:4569. A call arrives via the reserved IP, but for an unbound UDP socket Linux picks the reply's source address from the routing table — which is the droplet's own public IP. The caller sent to 46.101.66.218 but gets a reply from 46.101.15.76, so its NAT/firewall discards it.

The symptom in the debug log: the server receives NEW and sends CTOKEN, but the caller never sees the CTOKEN, retries, and auto-congests after about 5 seconds. From the outside it looks exactly like a server that never answers.

TCP services (Telstar on 6502 etc.) are unaffected because a TCP connection automatically replies from the address it was received on.

Analogy: it's like a Post Office redirection. Letters to the old address reach you fine — but if you reply from your actual home address, the other party doesn't recognise the sender.

The Fix

Bind IAX2 to the anchor IP in iax.conf:

[general]
bindaddr=10.16.0.6

A reload isn't enough for a bind address change — restart Asterisk (live calls will drop briefly):

systemctl restart asterisk
ss -ulpn | grep 4569

The listener should now show 10.16.0.6:4569 instead of 0.0.0.0:4569.

Things to Remember

Connecting a Local Asterisk Server

Overview

The Telstar system operates with Two Asterisk servers. The main live server has trunk connections for incomming SIP lines (01756 664433/01756 664433) and IAX PhreakNet connections (835-0433/835-0434). A secondary server located locally (office server) is used for testing and includes Cisco and Mediatrix ATA devices to connect Telephones, Modems and Viewdata Terminals. It also hosts a SIP outgoing connection for testing purposes (sipgate.co.uk) and routing to the live server to allow outgoing connections to PhreakNet.

The configuration to connect the local system to the live system is as follows.

How the office Asterisk PABX reaches the outside world:


 Office phones ── VG204XM / Mediatrix / HT802 ──► s1 (Asterisk, 192.168.1.58)
                                                     │
                       dial 9 + 0…  ─────────────────┼──► sipgate.co.uk ──► PSTN
                                                     │
                       dial 8 + …   ─── IAX2 ────────┴──► docker-01 (glasstty.com)
                                                              └──► PhreakNet
Item Value
Office Asterisk s1, Fedora Server, 192.168.1.58
VG204XM gateway 192.168.1.55
Fixed-address range below 192.168.1.128 (DHCP hands out above .128)
Office public IP 213.18.157.199 (Gigaclear — may be dynamic, see section 6)
Live server docker-01, reached as glasstty.com

The sipgate line is office only. At shows the registration simply fails quietly in the background; internal extensions and the local Telstar snapshot are unaffected.


Sipgate Line on the Office Asterisk

Asterisk registers directly with sipgate, replacing the old Grandstream HT201. Only one device may be registered to the sipgate SIP-ID at a time — if the HT201 is ever plugged back in, the two will fight over incoming calls.

pjsip.conf

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0
local_net = 192.168.1.0/24

[sipgate]
type = registration
transport = transport-udp
outbound_auth = sipgate
server_uri = sip:sipgate.co.uk
client_uri = sip:<SIP-ID>@sipgate.co.uk
contact_user = <SIP-ID>
retry_interval = 60

[sipgate]
type = auth
auth_type = userpass
username = <SIP-ID>
password = <sipgate password>
realm = sipgate.co.uk

[sipgate]
type = aor
contact = sip:sipgate.co.uk

[sipgate]
type = endpoint
transport = transport-udp
context = from-sipgate
disallow = all
allow = alaw
outbound_auth = sipgate
aors = sipgate
from_user = <SIP-ID>
from_domain = sipgate.co.uk
rtp_symmetric = yes
force_rport = yes
rewrite_contact = yes

[sipgate]
type = identify
endpoint = sipgate
match = sipgate.co.uk

NAT notes:

Check registration:

asterisk -rx "pjsip show registrations"

Incoming calls — extensions.conf

[from-sipgate]
exten => <SIP-ID>,1,Dial(PJSIP/501,30)
 same => n,Hangup()

To ring several phones at once, whichever answers first gets the call:

 same => n,Dial(PJSIP/501&PJSIP/200,30)

Outgoing calls — dial 9

In [from-internal] (the context the office phones use):

exten => _90X.,1,NoOp(Outgoing via sipgate to ${EXTEN:1})
 same => n,Dial(PJSIP/${EXTEN:1}@sipgate,60)
 same => n,Hangup()

PhreakNet line — dial 8 via Live Asterisk Server

The office has no PhreakNet line of its own. Instead it sends calls over IAX2 to the live server, which is a PhreakNet switch (exchange LONDUKUBDSD, numbers 835-0433/0434) and places them on the network.

Live Server — iax.conf

A login usable only from the office IP:

[office]
type = user
secret = <long random password — e.g. openssl rand -hex 16>
context = phreaknet-out
deny = 0.0.0.0/0.0.0.0
permit = 213.18.157.199/255.255.255.255

Live Server — phreaknet.conf

[phreaknet-out]
exten => _X!,1,Set(CALLERID(num)=8350433)
 same => n,Gosub(phreaknet-out-verify,s,1)
 same => n,Gosub(phreaknet-lookup,s,1(${EXTEN}))
 same => n,Set(ARRAY(dialstr,flags)=${GOSUB_RETVAL})
 same => n,GotoIf($["${dialstr}"=""]?fail)
 same => n,Dial(${dialstr})
 same => n,Hangup()
 same => n(fail),Playback(ss-noservice)
 same => n,Hangup()

; Optional shortcut straight to Telstar, bypassing the PhreakNet lookup:
;exten => 835,1,Goto(phreaknet-in,8350433,1)

This relies on phreaknet-lookup and phreaknet-out-verify from verification.conf, and on interlinkedkey being set in [globals].

Reload:

asterisk -rx "iax2 reload"
asterisk -rx "dialplan reload"

On the Office Server — extensions.conf

In [from-internal]:

exten => _8X.,1,Dial(IAX2/office:<same password>@glasstty.com/${EXTEN:1})

Make sure nothing else in [from-internal] starts with 8. chan_iax2 must be loaded:

asterisk -rx "module show like iax"

Security Summary


Analog Gateways

The Telstar analogue gateways are provided by Cisco VG204XM devices, a MediaTrix 4116 device and some Grandstream HT801/HT802 devices. The analogue gateways only pass digits that match their own rules, so each new prefix must be allowed there as well as in Asterisk.

VG204XM Dial-Peers

Dial-peer Pattern Purpose
100 [2-6].. 3-digit internal extensions (includes 617/618)
101 90T dial 9 → sipgate
102 9[1-9]. 917/918 (Telstar softmodem extensions)
103 8T dial 8 → PhreakNet via docker-01

Template (shown for 103; 101 and 102 are the same apart from number and pattern):

configure terminal
dial-peer voice 103 voip
 destination-pattern 8T
 session protocol sipv2
 session target ipv4:192.168.1.58
 codec g711ulaw
 dtmf-relay rtp-nte
 no vad
end
write memory

Mediatrix 4116

Add to its allowed digit map:

Grandstream HT801/2

These generally pass 9- and 8-prefixed numbers as-is.


Testing

Test Dial Expect
sipgate in Call the sipgate number from a mobile Extension 501 rings, audio both ways
sipgate out 9 + mobile number + # Mobile rings, shows the sipgate number
PhreakNet out 8811 + # PhreakNet Business Office answers
PhreakNet loop 88350433 + # Telstar modem answers via the network

Useful console commands:

# office (s1)
asterisk -rvvv
pjsip set logger on
dialplan show <number>@from-internal

# docker-01
asterisk -rvvv
iax2 set debug on

Troubleshooting

Dialling gives engaged/fast busy immediately

One-way or no audio on sipgate calls — almost always NAT. Add external_media_address and external_signaling_address (office public IP) to the transport.

Dial-8 stops working one day — the office public IP has probably changed (Gigaclear is likely dynamic unless the £2/month static IP add-on is taken). Find the new address from an office machine with curl ifconfig.me, update the permit line in docker-01's iax.conf, then iax2 reload. This fails safe: nothing insecure happens while it's broken.

Dial-8 lookup comes back empty — check interlinkedkey is set on docker-01 (dialplan show globals | grep -c interlinkedkey should print 1) and watch the phreaknet-lookup lines on the docker-01 console.


Backups

After any working change, back up: