Context: Indian FTTH, ISP-managed ONT (ASFiber AS-541GWV-D, Boa web UI). The landline is a carrier-hosted SIP account on a private voice network — registrar 10.5.45.6, backup on 10.5.20.122, voice subnet 10.7.0.0/22, VLAN 660 terminated by the ONT. FXS port on the ONT gives dial tone; nothing SIP-shaped is exposed on the LAN side.
Goal: terminate the line myself, no ATA, and expose it to softphones over a tailnet.
Why a B2BUA, not a SIP proxy or direct registration
The line permits exactly one registration. Registering a softphone directly kills the ONT's registration, and two devices can't share the account. So the only sane architecture is a B2BUA that owns the single registration toward the carrier and presents its own registrar to my endpoints:
carrier (10.5.45.6) <-- REGISTER/INVITE --> Asterisk <-- REGISTER --> softphones (tailnet)
That also gets me media anchoring, which matters because the softphones are on a different address space entirely.
Getting the traffic to the box
The voice WAN is an IPoE service on VLAN 660. Router mode terminates it inside the ONT; there's no SIP ALG or LAN-side relay. The ONT's WAN service table has an itfGroup bitmask (ports 1/2/4/8), so the fix was to flip the voice service to bridge and pin it to LAN4:
lkname=2_VOICE_R_VID_660
cmode=0 # bridge
itfGroup=8 # LAN4
vid=660
vlan=1
VLAN 660 now arrives untagged on LAN4. Internet stays on PPPoE/VLAN 100 across the other ports. The ONT's SIP stack is out of the picture — which is what I wanted, since it can't be the registrar and the UA at the same time here.
Trunk config that actually registers and matches inbound
PJSIP, Asterisk 20:
[trunk]
type=endpoint
transport=transport-udp
context=from-carrier
disallow=all
allow=ulaw
outbound_auth=trunk-auth
aors=trunk-aor ; plural — see below
direct_media=no
rtp_symmetric=yes
force_rport=yes
[trunk-auth]
type=auth
auth_type=userpass
username=1206XXXXXX
password=********
[trunk-aor]
type=aor
contact=sip:10.5.45.6:5060
qualify_frequency=30
[trunk-identify]
type=identify
endpoint=trunk
match=10.5.45.6/32
Two things that cost an hour each:
aors= is plural. aor= parses without complaint, logs nothing useful, and the endpoint never loads. pjsip show endpoint trunk shows no AOR and you wonder why registration does nothing.
The endpoint name must match the AOR name. If they differ, REGISTER gets rejected with "No matching endpoint found" — the inbound request is matched by name against the endpoint list, not by the AOR reference.
The identify section is what makes inbound work: carrier INVITEs come from 10.5.45.6, and match=10.5.45.6/32 routes them to the trunk endpoint instead of falling through to the default context. Without it, outbound works fine and inbound rings into nowhere.
Result: outbound OK, inbound rings the extension, RTP bidirectional at 64 kbps PCMU, no transcoding.
Registration state and NAT
Keep qualify_frequency low enough to notice a dead registration but not so low you spam the carrier. 30s has been fine.
direct_media=no is not optional here — the endpoints are on a tailnet, so Asterisk must anchor RTP.
rtp_symmetric=yes + force_rport=yes handles the carrier's NAT expectations; the carrier sees one stable source and keeps sending to it.
Only Asterisk registers. Softphones register to Asterisk, which means re-registration storms on the tailnet never touch the carrier.
What I'd like to know
Has anyone seen a consumer ONT that actually trunks a service VLAN to a LAN port cleanly, instead of leaking a few tagged frames and calling it a trunk? Everything I probed (DHCP, PPPoE discovery on 100/660/661, tagged OPTIONS) said no.
Carrier SIP passwords derived from the phone number: common? Mine was sip@<number>. I asked for a rotation, which was an interesting conversation.
Anyone running a B2BUA with more than one carrier trunk and a shared dialplan? I'd like to hear how you namespace extensions.
Config snippets above are sanitised. Happy to share the full dialplan if useful.