twilioPhoneNumber deprecated in docs. What should ...
# support
t
I want to create calls without having ran Create Phone Number and storing the VAPI phone number ID (https://docs.vapi.ai/api-reference/phone-numbers/create). I currently store the phone number, twilio SID and auth token. The documentation states that twilioPhoneNumber is deprecated. What should we use instead to provide which phone number is to be used? My use case is that I have custom routing set up, so the Twilio inbound and status webhooks go to my own server to determine what to do with the call. I would like to cut out the extra step in creating the phone number in VAPI because it replaces our server's inbound and status webhooks in Twilio. https://docs.vapi.ai/api-reference/calls/create https://cdn.discordapp.com/attachments/1356730624253231236/1356730624463077548/image.png?ex=67eda15b&is=67ec4fdb&hm=37d3cd22dfae29bdc68255c07d8cb71da3a587939270823ed3c13b44293a3423&
v
Hi there! 👋 I wasn't able to find the exact replacement parameter for the deprecated
twilioPhoneNumber
in the VAPI create calls API. However, I can suggest several alternatives that might work for your use case without requiring you to create a VAPI phone number ID. Based on the information I found, you have a few options to integrate your existing Twilio setup with VAPI while maintaining your custom routing: 1. **Forward calls from Twilio to VAPI API**: According to [information in Discord](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334941334368419850), you can keep your Twilio setup and forward calls to the VAPI API without importing the phone number to VAPI. This way, Twilio will send requests to your server URL first, and then you can forward the calls to VAPI. There's even a reference implementation at [GitHub](https://github.com/VapiAI/advanced-concepts-phone-call-provider-bypass). 2. **Use SIP calls**: You might be able to use SIP to initiate calls directly through VAPI without needing a registered phone number. According to [Discord discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333753729404370986), if VAPI supports SIP calls without a phone number, you can use the API to create an outbound call specifying the SIP address as the destination. 3. **Use Twilio API keys with restricted permissions**: If you're concerned about security when integrating with VAPI, you can create a new API key in Twilio with restricted permissions specifically for use with VAPI, as mentioned in [Discord discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334941334368419850). For your specific use case of maintaining custom routing with Twilio webhooks going to your server, the first option (forwarding calls) seems most aligned with your needs. Would you like me to provide more details on any of these approaches? Sources:
t
The example at https://github.com/VapiAI/example-phone-call-provider-bypass/blob/master/app/main.py uses phoneNumberId. Twilio gives me the CallSid. Would that be used? Or should twilioPhoneNumber be left unset?
s
You can either pass a transient phone number or a permanent phone number created through VAPI. If you are using a phone number ID, then you have to create a phone number on VAPI first and then on Twilio dashboard change its webhook URL to your server URL. As already mentioned, you can use transient phone numbers as well.
t
The documentation says that the twilioPhoneNumber field is deprecated though. Do I still use that field to specify it for a transient phone number?
s
@taco
Copy code
curl -X POST "https://api.vapi.ai/call/phone" \
  -H "Authorization: Bearer YOUR_VAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phoneNumber": {
      "twilioPhoneNumber": "+1234567890",
      "twilioAccountSid": "YOUR_TWILIO_ACCOUNT_SID",
      "twilioAuthToken": "YOUR_TWILIO_AUTH_TOKEN"
    },
    "customer": {
...
    },
    "assistant": {
      "name": "Transient Phone Number Test",
....
    }
  }'
t
Thank you!
s
Marking this ticket as Solved ✅
3 Views