Vladimir
03/12/2025, 7:00 PMVladimir
03/12/2025, 7:01 PMVladimir
03/12/2025, 7:01 PMVapi Support Bot
03/12/2025, 7:02 PM401 Unauthorized
message and a WWW-Authenticate
header containing a nonce value. To authenticate, you need to resend the INVITE with an Authorization
header, including username, realm, and nonce [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1334238882660618250).
### Authorization Header Construction
For the Authorization header, you'll need these parameters:
- **username**: Your SIP account username
- **realm**: The domain provided by the server (e.g., sip.vapi.ai
)
- **nonce**: The unique value provided in the 401 response
- **uri**: The request URI (e.g., sip:1111212@sip.vapi.ai
)
- **response**: The computed MD5 hash
Example Authorization header:
Authorization: Digest username="user", realm="sip.vapi.ai", nonce="173316795263500", uri="sip:76dbc97c-9a43-4fec-a833-3f1acc7f10ae@sip.vapi.ai", response="1ef8e58097b1f16c2023031506a442b6", qop=auth, nc=00000001, cnonce="BHN6giuHEj6Dl+ogwlUdYQ", algorithm=MD5
### SIP Trunk Credential Setup
To set up SIP trunk credentials in Vapi, make a POST request to the /credential
endpoint:
```json
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",Vapi Support Bot
03/12/2025, 7:02 PMVladimir
03/13/2025, 5:08 PMKings Big
03/14/2025, 2:42 AM