betty icon indicating copy to clipboard operation
betty copied to clipboard

twilio error when called person hangs up

Open gingerlime opened this issue 10 years ago • 8 comments

I'm placing a call to a number via Betty's web interface. Call works great.

Then when the called person hangs up, twilio reports an error on https://www.twilio.com/user/account/developer-tools/app-monitor when posting back to status:

http://{IP}:3000/twiml/{IP}/twiml/dial/status (note that the IP and twiml appear twice)

My TwiML is configured with the following URLS:

request URL: http://{IP}:3000/twiml/call fallback URL: http://{IP}:3000/twiml/call/fallback It happens when status callback URL is either empty, or when I use http://{IP}:3000/twiml/call/status or http://{IP}:3000/twiml/dial/status

exported HOST is the IP address.

gingerlime avatar Apr 26 '15 15:04 gingerlime

HOST should be http://{IP}, not just {IP}.

SamyPesse avatar Apr 26 '15 23:04 SamyPesse

Thanks @SamyPesse

After updating HOST to http://{IP} then twilio app monitor reports a 502 error on http://{IP}/twiml/dial/status though.

gingerlime avatar Apr 27 '15 05:04 gingerlime

What is the body of the 502 error ?

SamyPesse avatar Apr 27 '15 18:04 SamyPesse

body:

<html>
    <head>
        <title>502 Bad Gateway</title>
    </head>
    <body>
        <h1>Bad Gateway</h1>An upstream server returned an invalid response.
    </body>
</html>

I just noticed that the POST from twilio was to the same host, but not on port 3000, like other requests though. Even when I set the full url including the port in the status callback URL. i.e. it went to http://{IP}/twiml/dial/status, instead of http://{IP}:3000/twiml/dial/status

gingerlime avatar Apr 27 '15 19:04 gingerlime

You need to set HOST={IP}:3000

SamyPesse avatar Apr 27 '15 19:04 SamyPesse

ok, thanks. Will try this later.

Feels like this should be taken care of automatically though, setting a HOST parameter to include http:// and port isn't that standard or particularly intuitive I would say - especially if there's a separate env var for PORT, or at least the documentation gets updated to make this clear.

I might take a look at the code later to see if I can contribute. A good chance to get more familiar with the project, but unfortunately not that much time on my hands.

gingerlime avatar Apr 27 '15 19:04 gingerlime

with the HOST set to http://{IP}:3000 - it responds with 403 with this body:

Limited to team member

gingerlime avatar Apr 28 '15 15:04 gingerlime

Ok that's a bug I already fixed in https://github.com/SamyPesse/betty/pull/17 (not yet tested)

SamyPesse avatar Apr 28 '15 16:04 SamyPesse