I have a problem with Twilio. After every 50 or 75 calls, we get a call that fails, and when I check the logs, it states that it is error 11200 and it gives the message Bad Gateway 502 "The upstream server received an invalid response."
I took a look at Twilio's suggestions regarding this error (found at https://www.twilio.com/docs/errors/11200 ). They list a bunch of likely causes of a bad gateway error:
1) The web server returned a 4xx or 5xx HTTP response for Twilio - as far as I can see in the logs, the web server returns 200 Twilio HTTP responses. 2) Invalid web server. We checked the configuration of our web server and consider it correct. 3) Network failures between Twilio and your web server - we tested the response time for ping and packet loss between www.twilio.com and our server. The ping time is <100 ms, and there is apparently no packet loss when testing with ping -n 100 www.twilio.com 4) There is no Content-Type header associated with the response - we set our Content-Type to application / xml. 5) Content-Type does not match the actual content. We set our Content-Type to application / xml and use TwiML to send responses.
We also checked all the elements in the Twilio section Possible solutions for this error.
A little bit about what we do:
API Version: 2008-08-01
We only make outgoing calls.
We use TwiML to send the Say command, and then Gather. During Gather, we get our intermittent error. The user will press the key that will be sent to us back. Depending on which key is pressed, we send another "Say in Twilio", for example, "You pressed 1. This offer was accepted. Thank you." or "You clicked 2. This offer was rejected. Thank you."
I do not exclude that this is something at our end that causes this problem, but we do not know what to check next. The web server seems to be sending a 200 response, but Twilio seems to be getting 502.
Does anyone have any suggestions that can help us? Could it be a problem with the API we are using? Should we upgrade to 2010-04-01?
Thank you in advance!