Previous post
# support
v
ease give workable links to guide or other documentation how to process below Here's how to resolve this: Understanding the authentication flow: When you send an initial INVITE without credentials, Vapi responds with a 401 Unauthorized This response includes a WWW-Authenticate header with a nonce value You need to resend your INVITE with a proper Authorization header that includes this nonce source Add the Authorization header to your second INVITE request: Authorization: Digest username="YourUsername", realm="sip.vapi.ai", nonce="received_nonce_value", uri="sip:+98765432111@sip.vapi.ai", response="calculated_md5_hash" Ensure your SIP trunk credentials are correctly configured in Vapi. Check that the username and password in your configuration match what you're using in the Authorization header source. Verify network configuration: Make sure your firewall allows SIP traffic and there are no NAT issues disrupting SIP messages source. Let me know if you need more specific guidance on calculating the MD5 hash for the response value or if you continue to experience issues after implementing these changes!
where in the call nonce is locarted
how to calculate the response
v
Hi there! I've found some information about SIP authentication flow in Vapi, though I don't have direct links to official guides. Here's what I can share based on available documentation: ### SIP Authentication Flow When Vapi sends an initial SIP INVITE, it doesn't include credentials. The server responds with a
401 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:
Copy code
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",
"domain": "your.sip.provider.domain", "publicIpInContactEnabled": false } } }' ``` I hope this helps! Let me know if you need any clarification on these steps. 🙂 Sources: - [SIP Authentication Configuration in Vapi](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334238882660618250) - [Calculating MD5 Hash for SIP Authorization Headers](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1308742638035406850) - [SIP Trunk Setup with Vapi](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341469652366266408)
v
I did it all. Now calls hit with sip 480
k
Hello Vladimir, is this resolved for you?
2 Views