Getting 401 Unauthorized error when connecting fro...
# support
p
Hello Team, We have been trying to call VAPI SIP number from our SIP telephony provider and we keep on getting 401 unauthorized error. There is no auth setup on VAPI side and we have tried sending both with and without auth header(dummy values) but we keep getting 401 unauthorized. Could you please provide step by step guidance to be able to make SIP call from our provider to VAPI Sip number?
a
Getting same
k
Vapi requires SIP trunk credentials username/password even if there’s no visible auth setup, ensure your SIP URI is correctly configured, use sip.vapi.ai as the domain, enable Digest auth retry in your PBX, and whitelist your provider’s IP in Vapi settings..
a
from where i can whitelist and enable digest?
also i think this is optional right i have not set any authenication since that was optional. Can you please clarify? Do we need to setup authentication password compulsory.
If yes then also it requires to whitelist our ip into vapis system and enable digest? Enable digest api requires username and password from where can we get this because we have not setup username and password while creating vapi sip
Can you please provide me the exact steps which i can follow if we need to use vapi sip?
@Kings_big💫
k
Hey Aawez Khan, Firstly, you are supposed to send SIP traffic on our [sip.vaapi.ai](http://sip.vaapi.ai) domain, not on our IP addresses. We don't accept traffic on our IP addresses. Secondly, for inbound calls, we do require authorization. So you have to send a username and password as an auth address; there is no toggle option available here. Inside the authorization header, you have to send: - username has to be your SIP username which is your phone number - password can be anything except being empty or empty white spaces Try two to three test calls and let me know how it goes for you.
a
Now trunk is connecting but i am hearing phone number not found
p
@Shubham Bajaj - We are now past the error of "unauthorized" but now we hear " Number not found" message from Vapi. In the configuration we have setup VAPI Sip with identifier as number@sip.vapi.ai , with no username and password. We also tried with username as "numbernumber" since it forces us to have 20 character username. In both the cases we hear a message "Number not found" from VAPI.
a
@Shubham Bajaj @Kings_big💫 any idea why we are getting this? We've been trying to set up a SIP connection for the past 2–3 weeks, but it's still not working. If you could guide us through the process, it would be a great help.
p
@Shubham Bajaj @Kings_big💫 - can you please look into this?
k
Hi Preet, To troubleshoot the 401 Unauthorized error when connecting your SIP provider to a Vapi SIP number, please follow these steps: 1. **Check IP Whitelisting**: Ensure that your SIP provider's IP addresses are allowlisted in your Vapi configuration. Vapi requires SIP signaling IP addresses to be authorized. You can add these during your SIP trunk setup. 2. **Configuration Review**: - Ensure that your SIP INVITE is being sent to the correct SIP URI:
sip:<your-unique-id>@sip.vapi.ai
. - Confirm that the IP address of your provider is in the recognized list by Vapi. Calls from unrecognized IPs will result in 401 errors. - If applicable, make sure there are no typos in your SIP gateway IP configuration in Vapi. 3. **SIP URI Termination**: When setting up your provider's termination, use the format
<credential_id>-sip.vapi.ai
if specific credential-based addressing is required by your setup. 4. **Dummy Credentials**: If IP-based authentication has an issue, it's acceptable to use non-functional dummy credentials (e.g., username/password set as
vapi/vapi
) just to pass authentication checks. Even though Vapi doesn’t require authentication, some systems need these headers to proceed correctly. 5. **Provider-Specific Configuration**: Double-check your provider’s settings to ensure they conform to the configuration recommended by their documentation, and match with the necessary details for Vapi integration. By following these steps, you should be able to resolve the authorization issue. Let me know if you need further assistance.
p
yes that worked Sahil. we had to add credentialid in the domain name when calling from our telephony provider
k
Awesome.