Skip to content

Cloud Asterisk Configuration

Overview

Asterisk 20.18.2 runs on the cloud server (89.116.31.109) and handles all SIP signaling, media, and dialplan routing. It connects to the Tata SIP trunk via a WireGuard tunnel to the on-premise NUC.

PJSIP Tata Gateway (pjsip_tata_gateway.conf)

The Tata gateway endpoint connects to the NUC over WireGuard. Calls from Tata arrive at the NUC and are forwarded to the cloud Asterisk through the tunnel.

; Endpoint
[tata_gateway]
type=endpoint
context=tata-inbound
disallow=all
allow=alaw
allow=ulaw
transport=transport-udp
aors=tata_gateway
identify_by=ip
direct_media=no

; AOR - static contact via WireGuard tunnel
[tata_gateway]
type=aor
contact=sip:10.10.10.2:5060
qualify_frequency=0

; Identify by source IP
[tata_gateway]
type=identify
endpoint=tata_gateway
match=10.10.10.2

identify_by=ip

The Tata gateway uses IP-based identification rather than username/password authentication. This avoids PJSIP_EFAILEDCREDENTIAL errors caused by Asterisk auth incompatibilities.

qualify_frequency=0

Tata does not respond to SIP OPTIONS. Setting qualify_frequency=0 disables qualify checks. The endpoint will always show as "Unavailable" in pjsip show endpoints -- this is normal and expected.

PJSIP Transport (pjsip_transport.conf)

; Primary UDP transport
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
external_media_address=89.116.31.109
external_signaling_address=89.116.31.109

; Alternate UDP transport (ISP bypass)
[transport-udp-alt]
type=transport
protocol=udp
bind=0.0.0.0:5080
external_media_address=89.116.31.109
external_signaling_address=89.116.31.109

Alternate Port 5080

The transport-udp-alt on port 5080 exists because some ISPs block standard SIP port 5060. Clients behind such ISPs can register using this alternate transport.

Tata Gateway Dialplan (ext_tata_gateway.conf)

[tata-inbound] Context

Normalizes incoming DID numbers and routes to the DID routing context.

[tata-inbound]
; Normalize DID to E.164 format
exten => _X.,1,NoOp(Incoming Tata call for ${EXTEN})
 same => n,Set(DID=${EXTEN})
 ; ... normalization logic ...
 same => n,Goto(tata-did-route,${DID},1)

[tata-did-route] Context

Maps individual DIDs to their assigned organization contexts.

[tata-did-route]
exten => +918065978000,1,Goto(acme_inbound,s,1)
exten => +918065978001,1,Goto(org_mna9x47k_inbound,1001,1)
exten => +918065978002,1,Goto(tech_inbound,s,1)
exten => +918065978003,1,Goto(org_mna9x47k_inbound,0986,1)

Reload Commands

To apply configuration changes without a full restart:

# Reload PJSIP module (endpoints, transports, AORs)
asterisk -rx "module reload res_pjsip.so"

# Reload dialplan only
asterisk -rx "dialplan reload"

# Full restart (use only when necessary)
asterisk -rx "core restart now"

core restart now

A full restart drops all active calls. Use module reload and dialplan reload whenever possible. Only use core restart now when module reloads are insufficient.