Incoming calls not working for SIP trunking
# support
b
I am SIP trunking and outgoing calls are working perfectly fine, but for incoming it is not going through. I asked my telephony provider and they the call is getting terminated by VAPI's IP address
v
Hi there! 👋 I understand you're having issues with incoming SIP trunking calls while outgoing calls are working fine. I don't have specific information about which exact IP address from VAPI is terminating your calls. However, I can definitely help with why this might be happening and how to fix it! Based on the information I found, there's an important detail about VAPI's IP addressing that's likely causing your issue: VAPI uses dynamic IPs, and direct requests to VAPI's IP addresses are actually blocked. Instead, you need to use VAPI's domain names. Here's how to fix your incoming call issues: 1. **Use FQDN instead of IP addresses**: For inbound calls, use the Fully Qualified Domain Name (FQDN):
sip.vapi.ai
on port
5060
instead of trying to whitelist specific IP addresses. [According to VAPI documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1344680024665493524), this is the recommended approach. 2. **Whitelist domains instead of IPs**: Ask your telephony provider to whitelist
vapi.ai
and *`.vapi.ai`** instead of specific IP addresses. [VAPI documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333797946440941639) specifically recommends this approach since they use dynamic IPs. 3. **Check SIP REFER handling**: VAPI uses SIP REFER for call transfers, which some systems don't handle correctly. Make sure your system is configured to handle SIP REFER messages properly. [VAPI documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336713212233515089) indicates this is a common issue.
4. **Verify authentication**: If your SIP provider doesn't send the correct username/password for authentication in the Authorization header, VAPI will send a 401 challenge, and if the provider can't respond with valid credentials, the call fails. [VAPI documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334238882660618250) highlights this as a potential issue. 5. **Check network configuration**: Ensure your firewall and NAT configurations allow SIP traffic to pass through. [VAPI documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336713212233515089) mentions this as a common cause of incoming call failures. Is there anything specific about your SIP trunking setup that I can help troubleshoot further? Sources: - [VAPI SIP trunking documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1344680024665493524) - [VAPI IP addressing information](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333797946440941639) - [SIP REFER handling documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336713212233515089) - [Authentication troubleshooting guide](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334238882660618250)
b
still having issue
1. Do inbound call need to be redirected by the telephony provider to URI ? 2. If the answer is yes, than would the URI be of format "sip:+3539810751631@sip.vapi.ai" if my number is +3539810751631 3. Is doing the redirection to the above URI enough, does the telephony provider also need to send some sort of authorization header? If yes, please clarify what should be in the header
k
Could you share the PCAP file, and ask your telephony to share the PCAP file related to this? I can see what issue you're running into.
Here it is
@Shubham Bajaj
Please provide an example of format if you find anything incorrect
k
I just looked into the pcap file, and it's getting the inbound calls are getting rejected because of 401 Unauthorized. You or your telephony needs to send a username and password here. The username has to be your SIP username registered with VAPI, whereas the password can be anything except being empty whitespace.
Let me know how it goes for you.
b
1. So once I create the inbound URI sip:+916374375763@sip.vapi.ai using the curl command, would +916374375763 be my VAPI username that telephony provider needs to pass in their authorization header? 2. How do I create the password for this +916374375763 VAPI username ? Lets say if telephony provider passes "test123" as password in the authorization header than would that start being the password from that time onwards? Or is there any other way to set the password 3. Can you please show an example of the content of authorisation header. It will help us in formatting it in a similar way
@Shubham Bajaj
k
Hey Baadshah2, So you are correct on point 1. The number has to be your Twilio phone number, and the password can be anything (except whitespace or empty). Even "test123" will work. Password is just in place order, so it won't be stored; it will be checked on each call if it exists or not and if it's non-empty or not. Lastly, coming to a third question. I don't have any example or say PCAP file handy with me with authorization header credentials, but if I get it, I'd like to know.
b
I just made my telephony provder try this, they included the VAPI username and password for inbound and it is showing 403 Forbidden error
This is for inbound connection request and they did send the authorization header containing VAPI username and password
@Shubham Bajaj
Kindly help in closing this issue out, it has been over 1 month and we are not able to move forward on this because of this single issue
I have also attached the PCAP file for your reference
s
Check your whatsapp DM.
j
Hello, we are having the same issue. Sending authorization with the VAPI "username"/phone_number and VAPI SIP server are responding with 403 Forbidden, invalid credentials. Was there a resolution to this issue? As suggested, we are sending any non blank password, but it is not working. Thank you!
k
This ticket has been marked as solved, and as a result, you will no longer receive any further responses. Kindly create a new support ticket to escalate your inquiry.Â