Search code examples
twiliotwilio-twimltwilio-click-to-call

Twilio call says an application error has occured


I using this command to make a call. I hosted the xml in amazon s3 and made it public. The call says, "Sorry, an application error has occurred. Please help

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/kjfwbkjfejbfgeirbgiregribg/Calls.json -d "Url=http://read-voice.xyz.s3-website-us-east-1.amazonaws.com/voice.xml" -d "To=%2B1234567812" -d "From=%2B1234567812" -u 'ssllsdnf wfwefklwefwefwef:wjfdbewfergergerg'

This is the XML

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice">Thanks for trying our documentation. Enjoy!</Say>
</Response>

This is the error in debugger

<Html>
<Head>
    <Title>405 Method Not Allowed</Title>
</Head>
<Body>
    <H1>405 Method Not Allowed</H1>
    <Ul>
        <Li>Code: MethodNotAllowed</Li>
        <Li>Message: The specified method is not allowed against this resource.</Li>
        <Li>Method: POST</Li>
        <Li>ResourceType: OBJECT</Li>
        <Li>RequestId: xyxafsgjsk</Li>
        <Li>HostId: xyzt8=</Li>
    </Ul>
    <Hr/>
</Body>


Solution

  • You can check your S3 served content with a browser.

    You need to make sure S3 serves your xml as "content-type" of "text/xml" and that the <?xml version="1.0" encoding="UTF-8"?> is really on the first line of the response.

    Also check the Twilio call logs for step by step debugging, you should see more info about the faulty http request that gives you the error, including the S3's response headers and content type.

    For testing purposes you can also use the TwiML Bins, you can find them on the left menu under "Tools" > "Developer Center". Create a bin there with your xml and you will get a url you can use instead of your S3 url.

    TwiML Bins don't need <?xml version="1.0" encoding="UTF-8"?> on the first line, just put the xml in there.