How to Dial Dynamic SIP URI with PJSIP in Asterisk (Retell AI Integration)

Hi everyone,

I’m trying to forward incoming calls from my Netgsm(local voip service) SIP trunk to a Retell AI SIP endpoint. Retell provides me with a SIP URI in the format:

sip:call_xxx@5t4n6j0wnrl.sip.livekit.cloud

I receive this SIP URI from my webhook as part of an AGI script, and then I pass it into the Dial() function like this:

exten => _X.,n,Dial(PJSIP/${RETELL_SIP_URI},30,b)

I also tried:

exten => _X.,n,Dial(PJSIP/${RETELL_SIP_URI}@retell-generic,30,b)

However, I keep getting this error:

Unable to create PJSIP channel - endpoint '5t4n6j0wnrl.sip.livekit.cloud' was not found

I already defined a generic endpoint for Retell in pjsip.conf like this:

[retell-generic]
type=endpoint
context=from-netgsm
disallow=all
allow=ulaw,alaw
aors=retell-aor
direct_media=no
transport=transport-udp
force_rport=yes
rewrite_contact=yes
allow_any_uri=yes

[retell-aor]
type=aor
contact=sip:5t4n6j0wnrl.sip.livekit.cloud

Despite setting allow_any_uri=yes, Asterisk still fails to route the call using the full SIP URI.

My goal is to forward inbound calls (from Netgsm) directly to Retell using the SIP URI provided dynamically by my webhook.

What is the correct way to define a generic endpoint or route such dynamic SIP URIs in Asterisk?

This option doesn’t exist. If you tried to use AI to solve this, it lied to you.

There’s a docs page on dialling for PJSIP:

Which shows that the format would be:

PJSIP/<endpoint>/<URI>

So therefore:

PJSIP/retell-generic/sip:call_xxx@5t4n6j0wnrl.sip.livekit.cloud

thank you so much