URGENT: BYO SIP Trunk Connection Error
# support
b
Hi Vapi support team, I'm trying to connect Vapi to Biztel, a Japanese number service provider, via SIP trunking, but the connection failed. Please help me. The configuration is as follows: 1. Create a SIP trunk credential in Vapi curl --location 'https://api.vapi.ai/credential' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer MY_VAPI_PRIVATE_KEY' \ --data '{ "provider": "byo-sip-trunk", "name": "Biztel Trunk", "gateways": [ { "ip": "s202218044035.u.biztel.jp", "inboundEnabled": false } ], "outboundLeadingPlusEnabled": false }' The SIP server address "s202218044035.u.biztel.jp" is provided by Biztel, and they have no authentication during SIP connection. The DID is like “617801”, so I set outboundLeadingPlusEnabled = false 2. Associate a phone number curl --location 'https://api.vapi.ai/phone-number' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer MY_VAPI_PRIVATE_KEY' \ --data '{ "provider": "byo-phone-number", "name": "Biztel SIP Number", "number": "617801", "numberE164CheckEnabled": false, "credentialId": "928a3834-172f-4efd-a412-8989a9f226f9" }' 3. Inbound call test The SIP connection is also configured on the Biztel side. When calling the Biztel phone number, it routes to the SIP address: "sip:617801@sip.vapi.ai" But the SIP connection failed. The SIP response received from the SIP INVITE is "486 Busy Here". I tried several times, still the same. Please check the configuration to see if it's correct or if there's something I'm missing. Thank you for your help.
v
Thank you for providing your configuration details. To help diagnose the "486 Busy Here" SIP error, could you confirm if Biztel has allowlisted the following Vapi SIP signaling IP addresses on their side? -
44.229.228.186/32
-
44.238.177.138/32
Allowlisting these IPs is required for proper SIP signaling and media flow between Vapi and your SIP provider, and missing this step can cause connection failures ([Vapi SIP Trunk documentation](https://docs.vapi.ai/advanced/sip/sip-trunk)). Once confirmed, I can suggest the next troubleshooting step. Source: - [Vapi SIP Trunk documentation](https://docs.vapi.ai/advanced/sip/sip-trunk)
b
Yes, the Biztel has allowlisted the specified Vapi SIP signaling IP addresses on their side
g
@Ben would you consider a paid consultation call to get right into this?
b
Are you official? What's the price?
g
@Ben Of course am official working as a freelancer. I charge $30 upward for consultation calls, let me know what time would be good for this, My DM is open..
@Ben Am official also, here is the link to my portfolio website: https://gamma.app/docs/g2grnmnzo9m2ptk
My Fiverr Link below also: https://www.fiverr.com/s/Aygm4r5
c
Hi, to configure the SIP Trunk, please follow the documentation for whitelisting the IP addresses: Then use this template as a guide to configuring both inbound and outbound gateways. The inbound gateway will need a static IP address and the outbound gateway will use the resolved domain name using UDP protocol:
Copy code
{
  "provider": "byo-sip-trunk",
  "name": "My SIP Trunk",
  "gateways": [
    {
      "ip": "sip.provider.com",
      "port": 5060,
      "outboundEnabled": true,
      "inboundEnabled": false,
      "outboundProtocol": "udp"
    },
    {
      "ip": "203.0.113.10",
      "port": 5060,
      "outboundEnabled": false,
      "inboundEnabled": true
    }
  ]
}
Once you have configured the SIP trunk, you will receive a value for credentialId. Save that and use it for the next step of assigning the SIP trunk to a phone number, as that is a required value for setting up the phone number. If you encounter any issues with the setup, please feel free to reach out.
b
Thank you for your reply. I configured it according to the template in the document. Just to confirm, whether the ip field for inbound is the specified IP ('203.0.113.10') or the SIP provider gateway's IP ?
c
Hi Ben, The IP field for the inbound gateway should be your SIP provider’s IP address, not the example one I used. The
203.0.113.10
value in my example was just a placeholder to show that this field requires an IP address (and not a domain name). Once you’ve set it to your provider’s IP, the configuration should work as expected. Best, Kyle
b
I have a try. Thanks a lot.
c
No worries.
b
Hi Kyle, I tried, but still couldn't connect successfully via SIP. Is there any other configuration I need to pay attention to? I have another question: can the number before the '@' in the SIP address be any arbitrary number (not a phone number with a plus sign), e.g. "sip:617801@sip.vapi.ai" ?
c
Could you provide a call id so we can review the error in the PCAP file? This will help us determine whether you can use your DID number for the sipUri
b
When a request via this SIP address fails, there is no corresponding record in the call log. Is it possible that this SIP address configured in my account was not recognized?
c
It is possible that it isnt being recognized. Could you configure the DID number to have the full area code to follow E.164 format?
b
Thank you for your reply. Due to the limitations of the number provider, configuring DID numbers that conform to the E.164 format is somewhat difficult. Is there any way to configure arbitrary DID numbers?
Hi Kyle, just to confirm, what is the SIP response if the SIP URI "sip:617801@sip.vapi.ai" is not recognized? And I'm not sure whether the SIP INVITE packet reached "sip.vapi.ai" gateway server, Is there any way to confirm this? @User
@User I'm stuck on the SIP connection issue. Could you help me to troubleshoot this issue? Thanks
@User Hi Vapi team, with the configuration following the BYO SIP trunk documentation, the SIP address forwarded by the number service provider (Biztel) to the Vapi is unable to communicate. Is there a way to check the SIP logs? Are there any methods to further determine the problem? Please help, thanks.
c
If call ids are not logging in VAPI, it is definitely not connecting and we would only be able to see that if there was PCAP logs from your SIP trunk provider Biztel.
b
Hi Kyle, thank you for your reply. We are troubleshooting the issue. It would be even better if you could provide the following information. Thank you. 1. Biztel sends an INVITE request to the SIP address, but no connection is established and no Call-ID is generated. In this situation, is the request being dropped at the network layer (dropped at the network entry and never reaching the SIP system), or is it being discarded by the system layer (due to format issues or authentication failures)? 2. In cases where the SIP URI cannot be recognized, what response code would an INVITE request return—for example, “401 Unauthorized”? Or is there any way to check the logs (even when there is no Call-ID)? 3. Could you provide the main SIP header information within the INVITE request? Are there any fields we should pay attention to? If you have an example, that would be even better. 4. In the BYO SIP Trunk documentation, under Inbound call test, it mentions: “Ensure your provider forwards calls to the correct SIP URI (e.g., {phoneNumber}@.sip.vapi.ai for Zadarma).” For other custom SIP trunk providers, should “” also be included? There is quite a bit of questions here, but I would really appreciate your guidance and answers. Thank you.
c
We will get the answer to these questions once we review the details from our SIP infrastrature logs.
b
Hi Kyle, During inbound call through SIP, even if the DID number in the SIP address follows the E.164 format, the connection was not established and the call ID was not generated. However, outbound calls seems succeed and generate call IDs, one of which is "019adef3-7189-7225-9345-971c05f1821b". Please help troubleshoot the problem. Thank you.
Is there firewall or ACL to config when using 'BYO SIP Trunk' ? @User
c
Hi Ben, Thanks for the additional details. To clarify, Vapi automatically applies an IP-based ACL for BYO SIP trunks — only gateway entries with inboundEnabled: true are allowed to send INVITE requests. Based on your symptoms, the most likely cause is that Biztel is sending INVITEs from an IP different from the one you configured (202.218.44.35). Since we don’t have the PCAP from Biztel’s side, we can’t confirm which IP the INVITE is actually coming from, but this mismatch would cause inbound calls to fail before a Call-ID is created.
b
Hi Kyle, Thank you for your patience in helping us troubleshoot the issue. We have contacted Biztel, and the SIP INVITE request sent to Vapi received a "401 Unauthorized" response. The specific PCAP logs are provided as the file. Could you provide any more information or clues? We are also confirming with Biztel whether there are any other IP addresses involved. Thanks. https://cdn.discordapp.com/attachments/1430157240119066737/1448504344738664612/PCAP_log.txt?ex=693c290b&is=693ad78b&hm=61227ed692b522dc35f8b8c73b4a373d6f397fa4192ba1f71c39caa91ad24de9&
c
Hi Ben, Thanks for sharing the PCAP logs — this helped clarify the issue. Summary of what’s happening: - Biztel is sending the SIP INVITE to:
Copy code
sip:+81367470237@sip.vapi.ai
- Vapi correctly responds with 401 Unauthorized (this is expected as part of SIP digest authentication). - However, Biztel does not retry the INVITE with authentication, because it cannot match the SIP realm. Root cause: For BYO SIP Trunks, Vapi requires the credential ID to be included in the SIP hostname. This is how Vapi identifies the correct trunk, organization, and authentication realm. Currently, the credential ID is missing from the SIP URI, so authentication fails. Correct SIP URI format (required):
Copy code
sip:+81367470237@e52af04e-3899-4bc8-9330-46b2be953deb.sip.vapi.ai
What Biztel needs to change: Update their Asterisk/SIP configuration to use the credential ID in the hostname. Example Asterisk dialplan change: Current (incorrect):
Copy code
Dial(SIP/+81367470237@sip.vapi.ai,,)
Correct:
Copy code
Dial(SIP/+81367470237@e52af04e-3899-4bc8-9330-46b2be953deb.sip.vapi.ai,,)
Or, if using a SIP peer:
Copy code
host=e52af04e-3899-4bc8-9330-46b2be953deb.sip.vapi.ai
Why this fixes it: - Each BYO SIP Trunk has a unique SIP realm:
<credential_id>.sip.vapi.ai
- Once Biztel sends the INVITE to that hostname, Asterisk will correctly respond to the 401 challenge with authentication - The call should then proceed normally (401 → authenticated INVITE → 200 OK) This behavior is expected and required for BYO SIP Trunk routing and authentication. Let us know once Biztel updates the configuration, or if you’d like us to review another SIP trace after the change. Best, Kyle
b
Hi Kyle, Thank you for the detailed explanation. I would like to confirm whether the credential ID "e52af04e-3899-4bc8-9330-46b2be953deb" you added to the SIP URI in your reply is just an example. The information for this phone number is as follows: { "id": "e1c34348-50da-4b24-9836-72caed5aab4a", "orgId": "93e395a3-b614-45fc-b824-10434c62e909", "assistantId": "c9ab48a5-332e-4d7a-9075-c5e80b668363", "number": "+81367470237", "createdAt": "2025-12-05T08:22:03.829Z", "updatedAt": "2025-12-05T08:22:37.404Z", "name": "Biztel SIP Number", "credentialId": "e6a9473b-16c6-4326-b849-3b9997f91c8c", "provider": "byo-phone-number", "numberE164CheckEnabled": false, "status": "active", "providerResourceId": "b15490e5-5643-4f09-8489-7007b68c33c7" } so the SIP URI would be: "sip:+81367470237@e6a9473b-16c6-4326-b849-3b9997f91c8c.sip.vapi.ai" Just to confirm, is the SIP URI correct? Thanks. @User
Hi Kyle, Thank you for your help. The problem has been resolved, and we can now successfully connect via SIP.
2 Views