@quki To set up SIP authentication for connecting a third-party provider number. Here's how to do it:
## 1. Create BYO SIP Trunk Credential
### API Endpoint
POST
https://api.vapi.ai/credential
### Curl Example
curl -X POST
https://api.vapi.ai/credential \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "byo-sip-trunk",
"name": "My SIP Trunk",
"gateways": [
{
"ip": "your.sip.provider.ip",
"port": 5060,
"inboundEnabled": true,
"outboundEnabled": true
}
],
"outboundAuthenticationPlan": {
"authUsername": "your_outbound_username",
"authPassword": "your_outbound_password",
"sipRegisterPlan": {
"realm": "your.sip.provider.domain",
"username": "your_register_username",
"domain": "your.sip.provider.domain",
"publicIpInContactEnabled": false
}
}
}'
### Response
{
"id": "credential_id",
"provider": "byo-sip-trunk",
"name": "My SIP Trunk",
...
}
## 2. Create Phone Number with Credential
### API Endpoint
POST
https://api.vapi.ai/phone-number
### Curl Example
curl -X POST
https://api.vapi.ai/phone-number \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "byo-phone-number",
"number": "your_phone_number",
"credentialId": "credential_id_from_step_1"
}'
## Authentication Components Explanation
The outbound authentication has two main components:
a. Basic Authentication:
- authUsername: Username for outbound call authentication
- authPassword: Password for outbound call authentication
b. SIP Registration (Optional):
- sipRegisterPlan: Configuration for SIP REGISTER if your provider requires registration
- realm: SIP realm for registration
- username: Username for registration (can be different from auth username)
- domain: Domain for registration
- publicIpInContactEnabled: Whether to use public IP in Contact header
The outbound authentication is processed during call setup and registration, ensuring secure communication with your SIP provider while maintaining compatibility with standard SIP authentication mechanisms.