Configure inbound calls with a custom SIP PBX
Step-by-step guide to route calls from your custom SIP PBX, Zadarma, or other SIP-based telephony systems to Agoralia AI agents.
Overview
With Agoralia you don't buy phone numbers directly from us. Instead, you connect the numbers you already own on providers like Twilio, Telnyx, MessageBird, Plivo, Vonage, Sinch, or your own SIP PBX.
This guide shows how to:
- Connect your SIP PBX or custom telephony setup to Agoralia
- Configure your SIP system so that when someone calls your numbers, Agoralia answers
- Test that your AI agent picks up the call correctly
This setup works with any SIP-compatible PBX including Asterisk, FreeSWITCH, Zadarma, or custom SIP implementations.
Prerequisites
Before you start, make sure you have:
- ✅ A SIP PBX or custom telephony system (Asterisk, FreeSWITCH, Zadarma, etc.)
- ✅ At least one phone number configured in your SIP system
- ✅ An AI agent created and published in Agoralia
- ✅ A phone number record in Agoralia marked as "custom" provider
- ✅ Admin or editor access to your Agoralia workspace
1. Enable inbound calls in Agoralia
- Sign in to your Agoralia workspace
- Go to Settings → Phone numbers
- Find or create the phone number record for your custom setup and click Edit
- Set the Provider to "custom"
- Scroll to the Inbound calls section
- Enable the toggle "Enable inbound calls"
- In Inbound call agent, select the AI agent that should answer incoming calls on this number
- (Optional) Configure the Event webhook URL if you want Agoralia to notify your backend about call events
Agoralia will now show you an Inbound SIP Target, specific to this phone number and tenant.
2. Copy the SIP target from Agoralia
Still in the Edit Phone Number page in Agoralia:
-
In the Inbound calls section, look for the Custom SIP block
-
You'll see a field like:
sip:{tenantId}-{phoneNumberId}@inbound.agoralia.app -
Click Copy to copy the SIP target to your clipboard
You will configure your SIP PBX to forward calls to this SIP target.
3. Configure your SIP PBX
The configuration depends on your specific SIP PBX system. Here are examples for common setups:
For Asterisk (extensions.conf)
; In your extensions.conf
[agoralia-inbound]
exten => _X.,1,NoOp(Incoming call to ${EXTEN})
exten => _X.,n,Dial(PJSIP/${EXTEN}@agoralia-inbound)
exten => _X.,n,Hangup()
; In pjsip.conf or sip.conf
[agoralia-inbound]
type=endpoint
transport=transport-udp
context=agoralia-inbound
disallow=all
allow=ulaw,alaw
direct_media=no
connected_line_method=invite
For FreeSWITCH
<!-- In your dialplan -->
<extension name="agoralia_inbound">
<condition field="destination_number" expression="^(.*)$">
<action application="bridge" data="sofia/external/$1@inbound.agoralia.app"/>
</condition>
</extension>
For Zadarma
-
Log in to your Zadarma account
-
Go to Settings → PBX → Routing
-
Create a new routing rule for inbound calls
-
Set the Destination to the SIP target you copied from Agoralia:
sip:{tenantId}-{phoneNumberId}@inbound.agoralia.app -
Save the routing rule
Generic SIP PBX Configuration
For any SIP PBX:
-
Create a SIP trunk or outbound route pointing to
inbound.agoralia.app -
Configure the dial pattern to forward all inbound calls to:
sip:{tenantId}-{phoneNumberId}@inbound.agoralia.app -
Ensure your PBX allows outbound calls to this domain
4. How the call flow works
Once everything is configured:
-
Caller dials your phone number
-
Your SIP PBX receives the call and forwards it to:
sip:{tenantId}-{phoneNumberId}@inbound.agoralia.app -
Agoralia receives the SIP call:
- Validates the tenant and phone number from the SIP URI
- Checks that inbound is enabled and an agent is assigned
- Creates a CallRecord for tracking
- Starts the configured voice engine
- Establishes the SIP/RTP connection with your PBX
-
Your AI agent answers the call and handles the conversation in real time
The audio flows directly between your PBX and Agoralia's voice engine.
5. Test your setup
Once your SIP PBX and Agoralia are configured:
-
Use a different phone (mobile or landline)
-
Call the phone number configured in your SIP PBX
-
Expect the following behavior:
- The call is picked up automatically after a short ring
- You hear the AI agent greeting (according to the agent's prompt)
- The call appears in Agoralia under Calls with direction
inbound
If the call is not answered or the AI doesn't speak, see the troubleshooting section below.
Troubleshooting
Calls are not reaching Agoralia
Check the following:
-
In Agoralia:
- Confirm the phone number is marked as "custom" provider
- Ensure "Enable inbound calls" is turned on
- Make sure an Inbound call agent is selected
-
In your SIP PBX:
- Confirm the SIP target matches exactly:
sip:{tenantId}-{phoneNumberId}@inbound.agoralia.app - Check that your PBX can reach
inbound.agoralia.app(port 5060 UDP/TCP) - Verify firewall rules allow SIP traffic
- Confirm the SIP target matches exactly:
SIP registration/connection fails
Common issues:
- Firewall blocking: Ensure ports 5060 (SIP) and 10000-20000 (RTP) are open
- NAT issues: If behind NAT, ensure proper SIP NAT traversal
- Codec mismatch: Ensure your PBX supports G.711 (ulaw/alaw) codecs
- DNS resolution: Confirm
inbound.agoralia.appresolves correctly
The call connects but the AI is silent
Possible causes:
- The selected agent is not published
- The voice engine configuration for that agent is incomplete
- SIP/RTP audio is not flowing properly
What to try:
-
In Agoralia, open the Agent edit page and:
- Confirm the agent is published
- Test the agent using the Test / Preview feature
-
Check SIP logs on your PBX for RTP/media issues
-
If preview works but SIP calls don't, contact support with:
- Call timestamp
- Caller number
- SIP call logs from your PBX
Wrong tenant/phone number routing
- In Agoralia, double-check the SIP target format
- Ensure the
{tenantId}and{phoneNumberId}in the SIP URI are correct - If you changed the phone number configuration recently, restart your SIP PBX
Advanced Configuration
Custom SIP Domains
If you need to use a custom SIP domain instead of inbound.agoralia.app:
- Contact Agoralia support to set up a custom SIP domain
- Update your PBX configuration to use the custom domain
- Ensure DNS and firewall rules are updated accordingly
Multiple Numbers
For multiple phone numbers:
-
Create separate phone number records in Agoralia for each number
-
Configure different SIP targets for each:
sip:{tenantId}-{phoneNumberId1}@inbound.agoralia.app
sip:{tenantId}-{phoneNumberId2}@inbound.agoralia.app -
Route calls accordingly in your PBX dialplan
Next steps
Once inbound calls are working with your SIP PBX, you can:
- Add more numbers and assign them to different agents (sales, support, after-hours, etc.)
- Configure event webhooks in Agoralia to send call outcomes to your backend or CRM
- Use the Calls section in Agoralia to review transcripts and improve your agents
If you also use other providers, see: