how to specify to use my sip trunk
# support
s
how to specify to use my sip trunk
v
To specify that Vapi should use your SIP trunk, create a SIP trunk credential and associate your phone number with it. Here’s a quick example using the API:
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": "My SIP Trunk",
    "gateways": [{ "ip": "YOUR_SIP_SERVER_ADDRESS" }]
  }'
Then, link your phone number to this 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": "My Number",
    "number": "YOUR_PHONE_NUMBER",
    "credentialId": "YOUR_CREDENTIAL_ID"
  }'
Replace the placeholders with your actual details. This will ensure Vapi uses your SIP trunk for calls. [See full docs here](https://docs.vapi.ai/advanced/sip/sip-trunk) Sources: - [SIP Trunking Vapi Documentation](https://docs.vapi.ai/advanced/sip/sip-trunk) - [API Reference: Create Phone Number](https://docs.vapi.ai/api-reference/phone-numbers/create)
k
Create a SIP credential via the Vapi API with your trunk details, associate your phone number to that credential, then assign your assistant to handle calls on that number in the Vapi dashboard..