I’m experimenting with connecting Asterisk to an external SIP-based AI voice agent service (ElevenLabs) for real-time customer interactions.
Setup:
Asterisk Server: AWS EC2 instance in a private subnet (no public IP).
Inbound Calls: From telecom provider X via AWS Direct Connect → Asterisk (works fine).
Call Flow: Once a call is answered, Asterisk plays a welcome message, then forwards the call to an ElevenLabs AI agent for real-time two-way communication.
Problem: ElevenLabs receives my audio, processes it, and generates a spoken response (confirmed via their dashboard), but that audio never reaches my Asterisk server.
SIP traces show that Asterisk advertises its private IP (e.g., 10.x.x.x) in SDP, so ElevenLabs tries to send RTP to that unreachable private IP.
The inbound RTP path from ElevenLabs fails due to NAT/private addressing.
Goal:
Without changing the existing telecom provider X → Private EC2 Direct Connect architecture, I’d like to allow ElevenLabs to send RTP audio back to my Asterisk server for testing. Ideally by exposing only what’s necessary for the return audio path.
Questions:
Can Asterisk be configured to use a different public IP in its SDP just for the ElevenLabs SIP trunk, while still keeping the telecom provider X trunk as-is?
Is there a recommended NAT traversal setup (e.g., Kamailio, RTP proxy, or Asterisk externaddr settings per peer) that can bridge a private Asterisk to an external SIP provider without giving the EC2 instance a permanent public IP?
Any best practices for handling mixed public/private SIP legs in Asterisk?
Hi David,
Just to clarify — you mean switching from my current sip.conf (chan_sip) setup to chan_pjsip (pjsip.conf) would solve this?
Right now the issue is that Asterisk always advertises its private IP 10.167.x.x in the SDP and Contact headers, so ElevenLabs sends RTP to that unreachable address. Outbound audio reaches them fine, but their inbound audio never comes back because it’s going to that private IP.
Would moving to chan_pjsip let me configure a different public external_media_address / external_signaling_address just for the ElevenLabs trunk, while keeping my Telco X trunk on the private Direct Connect?
chan_pjsip allows you to have different transports for different endpoints, and those transports indirect the basic transport type and include information like the external addresses.