I'm currently trying to use the twilio python library to start an outgoing call, wait for user input through the keypad or speech while saying a message and then return it through a callback to a php script I have running elsewhere, however even with seemingly good XML used in my twiml, I seem to get an application error when the user hits a key on their keypad, I've included all the details I can below.
Code:
call = client.calls.create(
status_callback='https://endpoint.example/myphpscript.php',
status_callback_method='POST',
twiml='<?xml version="1.0" encoding="UTF-8"?><Response><Gather action="https://endpoint.example/myphpscript.php" method="POST"><Say>This is a test message, please work</Say></Gather></Response>',
to=destnumber,
from_=twilionumber
)
When this executes it makes the call as expected, and starts to read off the message as defined by <say>, however when the user hits a key on their keypad it says "We're sorry there was an application error."
Looking in my Twilio call logs I can see the twiml recieved and used by twilio which is below
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Gather action=\"https://ws.chainsaw.rip/testwilio.php\" method=\"POST\"><Say>This is a test message, please work</Say></Gather></Response>"
The error information as seen in the twilio console is shown below
Msg ""
parserMessage "Error on line 2 of document : Premature end of file. "
ErrorCode "12100"
url "https://endpoint.example/myphpscript.php"
LogLevel "ERROR"
I am pretty new to twilio so any and all help or suggestions would be greatly appreciated, thanks.