I am working with a 3CX to Asterisk trunk, expecting calls to be forwarded to extension 9876 when extension 9877 is dialed from 9874. I have tried many dial plans, with the one below being the last, but s@default is always processed instead. I intend 9876 to get the call and play back the demo-greeting.
extensions.conf:
[general]
static=yes
writeprotect=no
clearglobalvars=no
[default]
; Handle calls for 9877 and forward to 9876
exten => 9877,1,NoOp(Forwarding calls for 9877 to 9876)
same => n,Dial(PJSIP/9876@3cx-trunk,30) ; Replace ‘3cx-trunk’ with your trunk name
same => n,Hangup()
; Optional: Catch-all for other calls in the default context
exten => _.,1,NoOp(Catch-all for unmatched extensions)
same => n,Playback(demo-congrats) ; Optional: Play the demo greeting
same => n,Hangup()
pjsip.conf:
[global]
rtp_symmetric=yes ; Enable symmetric RTP
force_rport=yes ; Ensure responses go back to the source port
rewrite_contact=yes ; Rewrite the Contact header for NAT traversal
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=10.10.0.0/23
external_media_address=AsteriskPublicIP
external_signaling_address=AsteriskPublicIP
[3cx-trunk]
type=endpoint
transport=transport-udp-nat
context=default ; Use the same context as in extensions.conf
disallow=all
allow=ulaw
aors=3cx-trunk
outbound_auth=3cx-auth
dtmf_mode=rfc4733
[3cx-auth]
type=auth
username=user
password=pass
[3cx-trunk]
type=aor
contact=sip:3CXPublicIP:5060
qualify_frequency=30
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
[9877]
type=endpoint
context=default
disallow=all
allow=ulaw
aors=9877
auth=9877-auth
[auth9877]
type=auth
auth_type=userpass
username=user ; Use the Authentication ID from 3CX
password=pass; Use the Authentication Password from 3CX
[9877]
type=aor
contact=sip:9877@3CXfqdn:5060
max_contacts=1
[registration_9877]
type=registration
transport=transport-udp-nat
outbound_auth=auth9877
server_uri=sip:3CXfqdn:5060
client_uri=sip:9877@3CXfqdn
retry_interval=30
[3cx-server]
type=identify
endpoint=3cx-trunk
match=3CXfqdn ; Match the DNS name instead of the IP
Log:
Connected to Asterisk 20.6.0~dfsg+~cs6.13.40431414-2build5 currently running on SC3CX-Asterisk (pid = 8768)
– Executing [s@default:1] wait(“PJSIP/3cx-trunk-00000001”, “1”)
– Executing [s@default:1] answer(“PJSIP/3cx-trunk-00000001”, “”)
> 0x7766102c0370 – Strict RTP learning after remote address set to: 3CXPublicIP:9282
– Digit timeout set to 5.000
– Response timeout set to 10.000
– Executing [s@default:1] background(“PJSIP/3cx-trunk-00000001”, “demo-congrats”)
– <PJSIP/3cx-trunk-00000001> Playing ‘demo-congrats.slin’ (language ‘en’)
> 0x7766102c0370 – Strict RTP switching to RTP target address 3CXPublicIP:9282 as source
== Spawn extension (default, s, 1) exited non-zero on 'PJSIP/3cx-trunk-0000000
Thoughts?