NUC Asterisk Configuration¶
The NUC runs Asterisk 22 as the SIP gateway. This page documents the PJSIP and dialplan configuration in detail.
PJSIP Configuration¶
File: /etc/asterisk/pjsip.conf
Transport¶
[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060
local_net = 10.54.225.88/30 ; NNI subnet
local_net = 192.168.0.0/24 ; LAN
local_net = 10.10.10.0/24 ; WireGuard tunnel
The transport binds on all interfaces at port 5060. The local_net entries tell Asterisk which subnets are local so it can correctly set the Contact and Via headers for SIP messages leaving through different interfaces.
Tata Endpoint¶
[tata-endpoint]
type = endpoint
context = from-tata
disallow = all
allow = alaw
allow = ulaw
transport = transport-udp
aors = tata-aor
auth = none
identify_by = ip
direct_media = no
[tata-aor]
type = aor
contact = sip:10.79.215.102:5060
qualify_frequency = 0
[tata-identify]
type = identify
endpoint = tata-endpoint
match = 10.79.215.102
| Section | Purpose |
|---|---|
tata-endpoint | Defines the Tata SBC as an endpoint. Uses IP-based identification, no authentication. Incoming calls land in the from-tata context. |
tata-aor | Address of Record pointing to the Tata SBC. qualify_frequency=0 disables OPTIONS keepalives because Tata does not respond to them. |
tata-identify | Matches incoming traffic from 10.79.215.102 to the tata-endpoint. |
Note
direct_media=no ensures all RTP flows through Asterisk. This is required because the Tata SBC and cloud server cannot reach each other directly.
Cloud Endpoint¶
[cloud-endpoint]
type = endpoint
context = from-cloud
disallow = all
allow = alaw
allow = ulaw
transport = transport-udp
aors = cloud-aor
auth = none
identify_by = ip
direct_media = no
[cloud-aor]
type = aor
contact = sip:10.10.10.1:5060
qualify_frequency = 30
[cloud-identify]
type = identify
endpoint = cloud-endpoint
match = 10.10.10.1
| Section | Purpose |
|---|---|
cloud-endpoint | Defines the cloud Asterisk as an endpoint over the WireGuard tunnel. Incoming calls (outbound from cloud) land in the from-cloud context. |
cloud-aor | Contact is the cloud's WireGuard IP. qualify_frequency=30 sends OPTIONS every 30 seconds to monitor tunnel health. |
cloud-identify | Matches traffic from the cloud tunnel IP 10.10.10.1. |
Dialplan (extensions.conf)¶
File: /etc/asterisk/extensions.conf
Inbound: from-tata¶
[from-tata]
; Match all Tata DIDs (+918065978000 to +918065978029)
exten => _+9180659780XX,1,NoOp(Inbound call from Tata: ${EXTEN})
same => n,Dial(PJSIP/${EXTEN}@cloud-endpoint)
same => n,Hangup()
All calls matching the DID pattern +9180659780XX are forwarded to the cloud endpoint over the WireGuard tunnel, preserving the original DID in the request URI.
Outbound: from-cloud¶
[from-cloud]
; Outbound calls from cloud to Tata PSTN
exten => _X.,1,NoOp(Outbound call from Cloud: ${EXTEN})
same => n,Dial(PJSIP/${EXTEN}@tata-endpoint)
same => n,Hangup()
Calls arriving from the cloud (via WireGuard) are sent out through the Tata trunk to the PSTN.
Service Management¶
The Asterisk service is managed via systemd and depends on the WireGuard tunnel being up first.
# Start Asterisk (WireGuard must be running)
sudo systemctl start asterisk
# Stop
sudo systemctl stop asterisk
# Restart
sudo systemctl restart asterisk
# Check status
sudo systemctl status asterisk
# Enable on boot
sudo systemctl enable asterisk
Service dependency
asterisk.service depends on wg-quick@wg0.service. If WireGuard is not running, Asterisk will not start. Always ensure WireGuard is up before starting Asterisk.
Debugging¶
Connect to the Asterisk CLI¶
The -rvvvvv flag connects to the running instance with maximum verbosity.
Enable SIP Logging¶
From the Asterisk CLI:
This logs all SIP message bodies (INVITE, 200 OK, BYE, etc.) to the console, which is essential for troubleshooting call setup issues.
Useful CLI Commands¶
| Command | Purpose |
|---|---|
pjsip show endpoints | List all endpoints and their status |
pjsip show endpoint tata-endpoint | Show Tata endpoint details |
pjsip show endpoint cloud-endpoint | Show cloud endpoint details |
pjsip show contacts | Show registered contacts and qualify status |
core show channels | List active calls |
core show channel <name> | Detail on a specific active call |
dialplan show from-tata | Show the inbound dialplan |
dialplan show from-cloud | Show the outbound dialplan |