adverse-sapphire
adverse-sapphire8mo ago

How do i set the server URL for a phone number?

How do i set the server URL for a phone number?
21 Replies
Vapi
Vapi8mo ago
@slickVik To set the server URL for a phone number, you'll need to provide the URL that will handle the incoming calls for that number. This URL should be a server endpoint that is prepared to receive and process the call object and other relevant information. If you have the server URL ready, you can update the settings for your phone number with that URL. If you're using an API or a specific platform to manage your phone numbers, there would typically be an option or a method to set or update the server URL. Could you please provide me with the server URL you wish to set for your phone number? Once I have that information, I can assist you further. You can continue this conversation by mentioning me in the message.
other-emerald
other-emerald8mo ago
@slickVik You have to make a UPDATE /phone-number/:id request and assign server url to it using the following url Example Curl Request
curl -X PATCH https://api.vapi.ai/phone-number/insert-phone-number-id-here \
-H "Authorization: Bearer insert-token-here" \
-H "Content-Type: application/json" \
-d '{
"provider": "twilio",
"server": {
"url": "insert-your-server-url-here",
"timeoutSeconds": 0,
"secret": "",
"headers": {}
}
}'
curl -X PATCH https://api.vapi.ai/phone-number/insert-phone-number-id-here \
-H "Authorization: Bearer insert-token-here" \
-H "Content-Type: application/json" \
-d '{
"provider": "twilio",
"server": {
"url": "insert-your-server-url-here",
"timeoutSeconds": 0,
"secret": "",
"headers": {}
}
}'
Reference: https://docs.vapi.ai/api-reference/phone-numbers/list?playground=%2Fapi-reference%2Fphone-numbers%2Fupdate
adverse-sapphire
adverse-sapphireOP8mo ago
@Shubham Bajaj It looks like it uses the organization server url even if it set this. Is that expected?
other-emerald
other-emerald8mo ago
@slickVik Org level server url is only used if you don't set the phone-number server url, could you share the call id?
adverse-sapphire
adverse-sapphireOP8mo ago
462910e9-90b8-450f-aada-5d5f5eaa5a6b @Shubham Bajaj I am getting a 502 error for some reason I am seeing the error is "Couldn't Start Call. Need Assistant ID Or Server URL Set." @malik
other-emerald
other-emerald8mo ago
@slickVik You need to pass either a phone number, server URL, or assistant ID to start the calls, otherwise they will fail. You can view debugging artifacts in the ngrok tracing dashboard on port 4040 or 4000.
adverse-sapphire
adverse-sapphireOP8mo ago
So i set the server URL in the assistant with the curl request above, I am seeing that its hitting the endpoint. @Shubham Bajaj The endpoint is returning 200, but still the same message as above Do I need to set it anywhere else?
other-emerald
other-emerald8mo ago
@slickVik First, you need to set the server URL for your phone number. After that, Vapi will send a request asking which assistant should be used. At that point, you need to return the assistant ID you want to use. You are currently doing this in the opposite order. Correct me if wrong.
adverse-sapphire
adverse-sapphireOP8mo ago
const response: ServerMessageResponseAssistantRequest = { assistant: VOX_AGENT(agentContext, transferNumber), }; return { status: 200, body: JSON.stringify(response), }; I am returning the assistant itself I've already set the server url for the phone number via the curl request @Shubham Bajaj
inland-turquoise
inland-turquoise8mo ago
Hey are there any updates on this? I am getting the same issue.
other-emerald
other-emerald8mo ago
@slickVik @santi_racca I understand that you might be sending the wrong assistant, which is causing this error. To identify the exact issue, please check your server URL where we send the debugging artifacts. These artifacts contain self-explanatory information about what's missing in your assistant or why your response was incorrect. I cannot check this for you because I don't have access, so please review the debugging artifacts yourself. At most, I can look at your assistant JSON to verify if it's valid. Please let me know your thoughts on this.
inland-turquoise
inland-turquoise8mo ago
Hey @Shubham Bajaj the debugging artifact shows that I have set the server url to the right endpoint. I am returning a correct assitant because when I use the org level server url it works fine. It seems there is an issue with setting the server url with the new schema
other-emerald
other-emerald8mo ago
@santi_racca Could you send me a copy of debugging artifacts and your orgId so I can share this with the team and get it resolved? Also, could you rephrase or help me understand the meaning of "issue with setting the server URL with the new schema"? I couldn't understand it completely.
adverse-sapphire
adverse-sapphireOP8mo ago
Yes the thing is it works if I add the url at the org level, but once I remove it, it stops working. @shubham.bajaj Looks like @santi_racca is facing the same issue
other-emerald
other-emerald5mo ago
@slickVik @santi_racca can you both guys can share the debugging artifacts let me investiage. @slickVik @santi_racca Refrain from publicly sharing your credentials and tokens, as this could compromise your security. I have removed your message for the time being. Please exercise caution in the future. cc: @John George
eastern-cyan
eastern-cyan5mo ago
you should also revoke your old Twilio Auth Token and use a new one in case it was compromised
adverse-sapphire
adverse-sapphireOP5mo ago
Hey Shubham, which credentials were leaked? @Shubham Bajaj
eastern-cyan
eastern-cyan5mo ago
your Twilio auth token
adverse-sapphire
adverse-sapphireOP5mo ago
Was this recent or when was it sent? @John George we rotate every 14 days, but was the initial message sent a few months ago ago?
eastern-cyan
eastern-cyan5mo ago
good practice, yes it would have been in Jan
Shubham Bajaj
Shubham Bajaj5mo ago
checking if this is resolved/solved for you?

Did you find this page helpful?