Connect to Any Carrier
Integrare flexibilă cu multiple carriers: cloud APIs (Twilio, Vonage), SIP trunking direct, sau hybrid pentru redundanță și cost optimization.
Supported Carriers
Twilio
Global coverage, developer-friendly API.
RecommendedVonage
Enterprise features, strong EU presence.
SupportedBandwidth
US-focused, competitive pricing.
SupportedTelnyx
Low latency, global mission control.
SupportedTwilio Integration
// Twilio SIP Trunk Configuration
{
"trunk_sid": "TKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"friendly_name": "Voice AI Primary",
"origination": {
"enabled": true,
"uri": "sip:voice-ai.company.com:5060",
"priority": 10,
"weight": 100
},
"termination": {
"enabled": true,
"sip_url": "voice-ai.sip.twilio.com",
"authentication": {
"credential_list_sid": "CLxxxxxxxxxxxxxxxx"
}
},
"disaster_recovery": {
"enabled": true,
"url": "sip:backup.company.com:5060"
}
}
// Incoming webhook for call control
app.post('/twilio/incoming', (req, res) => {
const twiml = new twilio.twiml.VoiceResponse();
// Connect to Voice AI via websocket
twiml.connect().stream({
url: 'wss://voice-ai.company.com/stream'
});
res.type('text/xml');
res.send(twiml.toString());
});Vonage Integration
// Vonage (Nexmo) Voice API
const Vonage = require('@vonage/server-sdk');
const vonage = new Vonage({
apiKey: process.env.VONAGE_API_KEY,
apiSecret: process.env.VONAGE_API_SECRET,
applicationId: process.env.VONAGE_APP_ID,
privateKey: './private.key'
});
// Answer webhook
app.post('/vonage/answer', (req, res) => {
const ncco = [
{
action: 'connect',
endpoint: [{
type: 'websocket',
uri: 'wss://voice-ai.company.com/stream',
'content-type': 'audio/l16;rate=16000',
headers: {
'call-id': req.body.uuid
}
}]
}
];
res.json(ncco);
});
// Make outbound call
vonage.voice.createCall({
to: [{ type: 'phone', number: '+40722123456' }],
from: { type: 'phone', number: '+40211234567' },
answer_url: ['https://api.company.com/vonage/answer']
});Direct SIP Integration
For custom carriers or on-premise deployments:
// FreeSWITCH SIP Profile for carrier
<gateway name="custom-carrier">
<param name="realm" value="sip.carrier.ro"/>
<param name="username" value="company_user"/>
<param name="password" value="secure_password"/>
<param name="register" value="true"/>
<param name="register-transport" value="tls"/>
<param name="caller-id-in-from" value="true"/>
<param name="codec-prefs" value="PCMU,PCMA,opus"/>
</gateway>
// Dialplan for outbound
<extension name="outbound-carrier">
<condition field="destination_number" expression="^(\d{10,})$">
<action application="set" data="effective_caller_id_number=+40211234567"/>
<action application="bridge" data="sofia/gateway/custom-carrier/$1"/>
</condition>
</extension>Carrier Comparison
| Feature | Twilio | Vonage | Bandwidth | Telnyx |
|---|---|---|---|---|
| Global Coverage | 180+ countries | 160+ countries | US/Canada | 140+ countries |
| Inbound Rate (US) | $0.0085/min | $0.0070/min | $0.0050/min | $0.0060/min |
| WebSocket Support | ✓ | ✓ | Limited | ✓ |
| SIP Trunking | ✓ | ✓ | ✓ | ✓ |
| STIR/SHAKEN | ✓ | ✓ | ✓ | ✓ |
Multi-Carrier Strategy
Benefits
- ✓ Redundancy - failover between carriers
- ✓ Cost optimization - route to cheapest
- ✓ Quality routing - best carrier per destination
- ✓ Capacity scaling - no single point limit
Implementation
- 1. Configure multiple carrier accounts
- 2. Set routing rules (LCR, quality-based)
- 3. Enable failover triggers
- 4. Monitor per-carrier metrics