0

I've been trying to redirect incoming phone calls from Twilio via webhook to execute TwiML hosted on a website.

For testing, I've been using 'raw' GitHub to host my XML as a 'GET' request webhook.

My code is in the format below:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial>
        <Number>
            +447xxxxxxxxx
        </Number>
    </Dial>
</Response>

When I run this code from a TwiML bin, it redirects as I want, however when I send it through a webhook, it just says the phone number out loud.

Any help on why this is would be greatly appreciated,

Thank you.

1 Answers1

1

This has to do with the MIME type the web server is returning.

You can find more details here.

Twilio understands MIME types

The webserver is returning text/plain instead of text/xml.

You can host your static TwiML in a TwiMl Bin.

Alan
  • 10,465
  • 2
  • 8
  • 9
  • Thank you for your quick response! That makes a lot of sense! Out of interest, would you know how to designate mime types on static html pages? – Karan Obhrai Jul 26 '20 at 13:26
  • It is a setting handled by the server, and each server handles it differently so really difficult to say. Specific to github, I found this but haven't tried it - https://docs.github.com/en/github/working-with-github-pages/about-github-pages#mime-types-on-github-pages. – Alan Jul 26 '20 at 16:01