Re-directing a call on twilio to vapi
# support
c
I have a twilio flow... user calls a 800 number ivr twilio says press 1 for sales press 2 for support... I know that i can do a connect_call to the local vapi number but then vapi doesn't know the original number dialed.. i need the 800 number and when i do the re-direct im suspecting vapi does know the 800 number thats coming inbound to map it to a server url but i kinda thought it would go to the server org url level and i can make the assistant and it would pass the 800 number that was dialed... i know the disconnected box connect_call_1 will work with the vapi number... but then i dont know the original number which is what i thought redirect_to_vapi would do we have tons and tons of numbers very important i know what number they called so i can get a specialized assistant https://cdn.discordapp.com/attachments/1257421580443844670/1257421581056217129/Screenshot_2024-07-01_at_3.41.32_PM.png?ex=6684589a&is=6683071a&hm=5e316869c92ec85be2a005eee64e665e686052389e0bfec98dd552ee53ea45b6&
v
@chia5966 It sounds like you're trying to ensure that when a call is redirected from your Twilio IVR to VAPI, the original number that the caller dialed (the 800 number) is preserved and known to VAPI. This is important for routing the call to the correct specialized assistant based on the number dialed. To achieve this, you can pass the original dialed number as a parameter when you redirect the call to VAPI. This can typically be done by including the dialed number in the URL query parameters or in the SIP headers if you're using SIP to connect the call. Here's a general approach you can take: 1. In your Twilio IVR flow, when the user presses 1 for sales or 2 for support, capture the dialed number (the 800 number) using Twilio's functionality. 2. When you redirect the call to VAPI, include the captured number as a parameter. For example, if you're using a URL to redirect, it might look like this:
https://your-vapi-server-url.com/connect?dialedNumber=18005551234
3. On the VAPI side, make sure your server is configured to receive the
dialedNumber
parameter and use it to determine which specialized assistant to connect the call to. If you're using the
/phone-numbers/import
endpoint to use your own phone number with VAPI, make sure that the number is properly configured in your VAPI dashboard to handle incoming calls as expected. If you need further assistance with the specific implementation or if you encounter any issues, please let me know, and I'll be happy to help you troubleshoot.
You can continue this conversation by mentioning me in the message.
c
well this doesn't really make sense because the mapping to vapi is: https://api.vapi.ai/twilio/inbound_call
i really need something like https://api.vapi.ai/twilio/inbound_call?dialedNumber=18005551234&vapinumber=16175551212 so when the endpoint on vapi hits it knows what server url to call for vapiNumber but it would pass in the parameter of dialendNumber in the intial create assistant server url call
is there some other way to do what i want? we dont want to see all the traffic on that number to vapi... we just want to make new quote requests with vapi and if customer needs support they continue to the customer support queues.. the connect caller to works but I absolutely need to know what number they dialed in on so i can track the source of the call...
s
This is quite a good usecase, let's schedule a call and we can discuss it over there!
Check your DM
c
@sahil i made a mistake an made an appointment with you for july 9th thinking it was tomorrow... shall i rebook for friday? I kinda need to get a solution to this... its stopping our rollout to additional partners
j
Hi. Once you figure it out, could you please post the solution here?
s
Unfortunately, I am kinda booked till Thursday, can you please schedule it for Friday?
c
and what i was really hoping for that when i called the assistant from my server i would have the same callSid but vapi send me a new one...
i was kinda hoping that PhoneCallProviderID would be the match
I know what the problem is... because if i just do a post to your endpoint on vapi you are going to get the 800 number and you won't know which assistant to call since that 800 number isn't associated.. so i basically need an option to post something like ForwardTo:+17815551212 so the end point knows on your side.. the call started at +1800 and got connected to the forwardedTo so call the serverURL for the forwardTo for the assistant.. and that would solve my problem.. perhaps overly simplistic from my view .. ll
m
hey @chia5966 sorry random interruption but how did you get the assistant to trigger "assistant-request" to your endpoint at the beginning of an inbound call? is it only possible if the phone number doesn't have an assistantId assigned?
c
that is correct.. but you can assign a url to phone number so anything connected to that number will call that specific server url..
so in my studio flow
im trying to do somethign like that.. as the work around
they dial 800 press 1 for sales... at it ends with connect the call to the vapi number... and that vapi number calls the server url
i just need to get the 800 number they called someway from vapi or be able to save it a table...
m
do a lookup on this: phoneNumberId":"273a882d-12d6-4c3d-a806-99547d4e4848"
or a lookup on the callid should give you the number dialed and dialed from
hit the /call/{id} endpoint
c
yeah thats the hack im doing now..
i just prefered something way cleaner
like a callsid mapping
that http post before the redirect those are the variables i have available before the vapi hand off.. so i got the original To number and From number
its a hack work around... something a little cleaner and nice would be better
s
@chia5966 please remove these data from discord.
c
@Sahil ok i deleted all the json stuff.. wasn't anything sensitive in there and was all test stuff
s
Okay.
g
Hey @chia5966 maybe you can help me, how did you manage in twilio that if he presess 1/2/3 etc... that the call will be forwarded to a specific vapi agent. I hope its not necessary to have a phone nr for each one. Would appreciate your help.
j
Same here. @Sahil / @chia5966 Please share how did you manage to do that. Thank you in advance
2 Views