Overview
Iqra AI supports SIP trunking for enterprise-grade telephony deployment. Connect your existing phone infrastructure or use cloud telephony providers to route calls through Iqra AI’s conversational agents. The platform implements a two-tier SIP architecture:- Proxy layer - Load balances incoming SIP INVITE requests across backend servers
- Backend layer - Handles media processing and AI conversation orchestration
Supported providers
Iqra AI integrates with multiple telephony providers:- Twilio
- Telnyx
- Vonage
- Direct SIP
Twilio configuration
Twilio uses TwiML and WebSocket streaming for real-time audio.Authentication: Basic auth with Account SID and Auth TokenKey features:- Voice URL webhook configuration
- Status callback for call lifecycle events
- Media streaming via WebSocket
- Support for both inbound and outbound calls
IqraInfrastructure/Managers/Telephony/TwilioManager.cs:136Twilio requires
VoiceReceiveMode set to “voice” for full-duplex audio streaming.Architecture
SIP proxy service
The proxy service handles initial call routing and load balancing:Validate business and number
Extract business ID and phone ID from SIP URI parameters:Validates:
- Business exists and is active
- Number is configured for the business
- Number provider matches (SIP, Twilio, etc.)
- Route ID is configured
Check plan limits
Validates call concurrency limits based on subscription tier before accepting the call.
Apply ACL rules
For SIP numbers with IP restrictions, validates source IP against
AllowedSourceIps list.Select backend server
Chooses optimal backend server based on:
- Region affinity
- Current capacity
- Admin bypass rules
IqraInfrastructure/Managers/SIP/SipProxyService.cs:134
SIP backend listener
The backend service handles actual media processing:Accept redirected call
Backend listener receives the redirected INVITE with call queue ID parameter.
Validate queue entry
Retrieves call queue entry and verifies:
- Queue exists and is in
ProcessedProxystate - Region and server ID match
- Not already processing
Create conversation session
Hands off to
BackendCallProcessorManager to:- Initialize conversation orchestrator
- Create AI agent
- Setup telephony client
- Configure audio pipeline
IqraInfrastructure/Managers/SIP/SipBackendListenerService.cs:99
Deployment patterns
Provider-based routing
Route calls through cloud telephony providers: Use cases:- Quick deployment without infrastructure
- Global phone number provisioning
- Built-in redundancy and failover
Direct SIP trunking
Connect enterprise PBX directly to Iqra AI: Use cases:- Existing telephony infrastructure
- Regulatory compliance requirements
- Cost optimization for high call volumes
Hybrid deployment
Combine provider and direct SIP:- Use Twilio for US/Canada numbers
- Use direct SIP for internal extensions
- Use Telnyx for international markets
Configuration
Number registration
Register phone numbers in the Iqra AI platform:Provider credentials
Store provider credentials securely:- Twilio
- Telnyx
- Vonage
Audio codecs
Supported audio formats for SIP:| Codec | Sample Rate | Description |
|---|---|---|
| PCMU (μ-law) | 8000 Hz | G.711 mu-law, common in North America |
| PCMA (A-law) | 8000 Hz | G.711 A-law, common in Europe |
| G.722 | 16000 Hz | Wideband audio |
| OPUS | 48000 Hz | Modern codec with WebRTC |
Call lifecycle
Inbound call flow
Outbound call flow
Monitoring and troubleshooting
Call queue tracking
Each call creates an entry in theInboundCallQueue collection:
Common issues
Status codes
| SIP Code | Description | Common Cause |
|---|---|---|
| 100 Trying | Processing request | Normal |
| 200 OK | Call established | Success |
| 302 Moved Temporarily | Redirecting to backend | Normal proxy operation |
| 403 Forbidden | ACL rejection | Source IP not whitelisted |
| 404 Not Found | Number/route missing | Configuration error |
| 503 Service Unavailable | No capacity | All backends busy |
Best practices
Use regional backends: Deploy backend servers in the same region as your customers to minimize latency.
Configure failover: Set up multiple providers for redundancy. If Twilio fails, route to Telnyx.
Monitor concurrency: Track
CallConcurrency metrics to avoid hitting subscription limits during peak hours.Secure SIP trunks: Always use IP whitelisting for direct SIP connections. Consider TLS for encryption.
Next steps
- WebRTC integration - Add browser-based voice calls
- WebSocket integration - Custom audio streaming
- Voice configuration - Configure AI voice settings