failed to create sip trunk credential
# support
k
My attempt to connect the VoIP AU sip trunk to the VAPI BYO-SIP-Trunk and add the current sip trunk details is still failing to build a creditial. Additionally, I tried creating using the API, and it worked, but the outgoing call failed.
y
A couple of things to check with the BYO-SIP setup in Vapi: 1. Credential build failure – this usually happens if the SIP username/password or domain from the VoIP AU trunk isn’t matching exactly what Vapi expects. Double-check the SIP URI format (sometimes sip:user@domain vs just user@domain makes a difference). 2. API creation works but outgoing call fails – in that case, it’s often a registration/authentication issue. Check your SIP trunk logs on VoIP AU to see if the REGISTER request from Vapi is even reaching them. 3. Also make sure the trunk supports the codecs Vapi uses by default (like PCMU/PCMA or Opus). If you want, I can help troubleshoot step-by-step and get the trunk properly registered just let me know. For quick contact, you can also reach me on WhatsApp: +2348101488169
p
Hi @Ketan I can help you to solve all difficulty you're facing here, this truly my area of specialization. Let's have a chat now. Thanks
k
Hi
lets connect
y
Have you gotten that resolved
k
VAPI Team we are looking for support and look into this issue.
c
Hi Ketan, To create a SIP trunk credential in Vapi with your SIP provider, follow these steps: 1. **Obtain Provider Details**: Collect the SIP server address, authentication credentials (username/password or IP-based), and at least one phone number (DID) from your provider. 2. **Create a SIP Trunk Credential in Vapi**: Use the following API call to create a credential:
Copy code
bash
   curl -X POST "https://api.vapi.ai/credential" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
     -d '{
       "provider": "byo-sip-trunk",
       "name": "Your SIP Provider Name",
       "gateways": [{
         "ip": "YOUR_SIP_PROVIDER_DOMAIN",
         "inboundEnabled": false
       }],
       "outboundAuthenticationPlan": {
         "authUsername": "YOUR_SIP_USERNAME",
         "authPassword": "YOUR_SIP_PASSWORD"
       }
     }'
Replace placeholders with your actual details. 3. **Associate a Phone Number**: Link your external phone number to the SIP trunk credential:
Copy code
bash
   curl -X POST "https://api.vapi.ai/phone-number" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
     -d '{
       "provider": "byo-phone-number",
       "name": "Your Phone Number Name",
       "number": "YOUR_PHONE_NUMBER",
       "numberE164CheckEnabled": false,
       "credentialId": "YOUR_CREDENTIAL_ID"
     }'
Note the
credentialId
from the response of the previous step. 4. **Test Your SIP Trunk**: - Ensure outbound calls are routed correctly using the Vapi dashboard or API. - For inbound routing, ensure your provider forwards calls to the correct SIP URI format. More details on these processes are available in the [SIP Trunking documentation](https://docs.vapi.ai/advanced/sip/sip-trunk). If you encounter any specific errors, please provide error messages so we can assist further.
a
@team, please stop these AI messages and help us in real... we are not able to add credentials for SIP trunk from so many days, not via api nor from UI.. always getting same error, failed to save If doing via API { "message": "Couldn't validate SIP trunk credential. SIP gateway creation failed.", "error": "Bad Request", "statusCode": 400 } i used the same API request earlier for one of my org, it was working, now it is not Please help https://cdn.discordapp.com/attachments/1420360686449725550/1422506206202822706/image.png?ex=68dceba4&is=68db9a24&hm=c925b7a86b4612019efb97caa38914f23377eef5f30cb5101da50ee6f1a7fb10&
c
Hi Akash, can you provide me your org_id so that our team can look into it.
a
my org id is : c1d1588c-e781-402b-ac93-09387fca39cf
@Praveen
c
You have to separate the gateways for inbound and outbound otherwise the trunk wont be accepted. 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.
d
Hi Kyle, is there a reason inboudn doesn't support hostname resolution and requires a static IP? i'm concerned this ties us down to a specific IP for the gateway and reduces any possible redundancy and flexibility of using a hostname
c
Our team has been working on improving our SIP infrastructure to handle hostnames, but this is the current workaround at this time.
2 Views