I'm trying to run the example here:
https://www.twilio.com/docs/quickstart/python/client/outgoing-calls
I run the flask script on port 5000 and try loading in my browser and I see the input box for my phone number but it just says Loading Pigeons below that. I click Dial and nothing happens.
My application sid, account sid and auth_token are all present. Nothing is showing up in my Twilio debug when I try this. If I view source I can click the link to all 3 javascript files so I know the path to them is good.
My Twilio account also works ok in other applications. I also tried this in Chrome, IE and Firefox, same result in all 3.
Twilio developer evangelist here.
There appears to be an escaping issue in the Twilio client quick start documentation here.
Where the JavaScript is currently set to:
Twilio.Device.setup("{{ token }}");
It should really say:
Twilio.Device.setup("{{ token }}");
I will raise this with the team responsible and hopefully this will be fixed swiftly. In the meantime, I hope you get your Twilio Client application up and running now. Let me know if I can do anything else to help.
Related
We're using Twilio. We have webhooks set up so that when Twilio receives a call, it forwards it to a URL on our site.
This appears to have been working fine. But now I made a change to the code, and suddenly Twilio is having problems calling the webhook. We don't receive the message, and if I look in the Twilio log, it says it got a 403 error. (I can't swear that this has never happened before. I've never noticed a message to be lost, but maybe I missed it while debugging other errors, attributed a lost message to something else.)
The truly strange part is, about 2/3 of the message that come in are received and processed fine, but about 1/3 get the 403 error. This is on a test server where we don't have any load balancing, so all requests are going to the same instance of our app. The tests I've been doing today are all from the same cell phone to the same Twilio number.
We do have authorization on the app, but the authorization is all on sub-directories, not the top level, and the sub-directory with our web hook has no authorization set up.
The first thing my our web hook now does when it gets called is send me an email with the content of the message from Twilio. (For debugging purposes.) I'm not getting that email, so I'm very confidant it's not getting called. And as I say, I can look at Twilio's log and it says that it received the text message and got a 403 error trying to forward it to my webhook.
The fact that it's only like 1/3 of the time is particularly puzzling. It's from the same number, to the same number, hitting exactly the same URL on the same site. Why would it work sometimes and not other times?
I tried to reproduce the problem on my desktop by calling the URL directly, not going through Twilio, and that does not give the same error. (It occurs to me as I type that the next logical test is to hit the page on the server without going through Twilio.)
Oh, the server is ASP.NET. The code is in VB but I doubt that matters as we're not getting as far as executing any of our code when it fails. When it doesn't get the 403, the code is working fine.
Check your firewall configuration as it might block the requests.
If it does then whitelist requests originating from Twilio.
We're using AWS WAF and ran into a similar situation: We saw the requests erroring out with a 403 in the Twilio Debugger but the requests never hit our endpoints. Once we adjusted the whitelist the problem was gone.
I have a not yet published app change in Slack which modifies the command service endpoint to another domain.
I tested that, it is possible to send back a 307 with a redirect URL and Slack API will follow that redirect.
I would like to be sure that redirect to another domain is also possible for live apps. So what works for an in-development app it will work for a live app.
Could any of you confirm that or send me a link to the documentation? I searched the documentation already, but did not find any entry about it.
Thanks!
We contacted Slack on their partner channel and they verified that:
"Our docs explicitly say we respect 301 and 302."
But we made a test and it accepts 307 as well.
(I can't share a link to their response as it was written inside Slack slack-platform workspace)
This problem was an internal networking issue on our side. It was not an issue with Twilio or their API
When my app contacts Twilio it passes a call back URL so Twilio can get additional info. I never see the request from Twilio but I get a call telling me that an application error has occurred.
When I check the Twilio debugging log it says it got a "502 Bad Gateway" error for the URL I passed it. However, when I try the same URL, I get a response just fine.
My app is running on a non-standard port but I'm pretty sure Twilio doesn't care about that.
What can cause Twilio to get a 502 when I don't
Here's the response I get when I hit the URL
<Response>
<Gather action="http://dev1.onshift.com/twilio/user_response_handler?sendID=38297795" method="POST" numDigits="1">
<Play>http://dev1.onshift.com/wavs/254_preamble.wav</Play>
<Play>http://dev1.onshift.com/wavs/8144924.wav</Play>
<Play>http://dev1.onshift.com/static/messages/handle_human_footer.wav</Play>
<Play>http://dev1.onshift.com/wavs/254_preamble.wav</Play>
<Play>http://dev1.onshift.com/wavs/8144924.wav</Play>
<Play>http://dev1.onshift.com/static/messages/handle_voicemail_footer_v2.wav</Play>
<Play>http://dev1.onshift.com/wavs/8144924.wav</Play>
<Play>http://dev1.onshift.com/static/messages/handle_voicemail_footer_v2.wav</Play>
<Play>http://dev1.onshift.com/static/messages/goodbye.wav</Play>
</Gather>
</Response>
From OP's comments above:
In my case there was a change on our network that blocked the server I
was working on from outside of our network. Your network people may be
wrong or confused. If you know the URL you're passing to Twilio you
can prove them right or wrong by seeing if you can hit that URL from
outside your network. You can try from home, or, what I did was turn
off wireless on my phone and tried to hit the URL from it. I couldn't
do it although it worked from my laptop on the company wifi. If you
can't hit the URL from outside your network neither can Twilio
Follow these suggested steps will help others begin to debug as they receive this error.
I'm about to build a console application that needs access to the authenticated YouTube Data API. Calling the API's themselves is not a problem, I know quite well how to make and process HTTPS requests.
I've already gotten the API key and the Client ID. No problems there, either.
The problem is the authentication.
I've checked here: https://developers.google.com/youtube/v3/guides/authentication#installed-apps
On the "Installed applications" tab, in step two, it instructs on how to set up a url to call to do the authentication step. All good so far. But before programming anything, I thought I'd try and see what that url does in the browser.
Turns out it just displays a login prompt. Well how about that. That won't work in this kind of console application. The idea is, presumably, that the user is somehow shown this webpage and be instructed to login and allow access. Then, somehow, by some kind of magic perhaps, the access token is sent back to my console application.
Two things I'm not quite sure about:
1) How do I prompt for the username and/or password in the console app and send that to the authentication URL?
2) How would I get the access token back from it?
The biggest problem is that the API seems to require a browser... Which isn't there. My console application will (eventually) run unattended, so starting up a browser and displaying a webpage and doing nothing until it returns a code, is out of the question. I need to somehow supply the authentication page a username/password and get back the code right away.
I am using twilio client to make & accept calls from a browser. But when I run the accept page, I get a javascript error on the browser -
Uncaught Twilio.Exception: 401: Unable to determine account.
# line - twilio.js:2683
Here's the code from my controlled thats gets executed when showing the accept call page/view -
def prepare_accept_call
# create the twilio capability object
capability = Twilio::Util::Capability.new TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN
# guessing this is not needed for accepting calls, but added to see if it fixes my issue and it doesnt :(
capability.allow_client_outgoing TWILIO_APP_SID
capability.allow_client_incoming "some-client-identifier"
# use this token for client JS - Twilio.Device.setup("#{#token}");
#token = capability.generate
end
NOTE -: I am successfully able to show the make call page, there are no javascript error - when i click the call button I get the flash microphone permission popup. There are no 401. So guessing my key, tokens etc are ok.
Any idea what could be happening here?
I also had this error with similar conditions where all my credentials were correct but the Twilio client debugger was spitting out "Application not found 31001" - which is a Twilio client error code by the way. I realized that I had not entered the Voice request url that is in the applications section. Apparently this is a necessary prerequisite to access the Twilio Client service.
I feel they should have been more clear with their message but regardless I solved it by entering a publicly reachable callback url using a SSH tunneler like Localtunnel or free server like Heroku.
looking at the code it should work, because it looks good. Can you verify where TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN are ultimately being defined? maybe that could have something to do with it?