Aghi
Aghi

Reputation: 119

Making Twilio calls with TwiML in Delphi

I'm using Twilio to call people from a Delphi XE2 application. The calls arrive but I can't seem to use my personal XML as an URL to inform the person I'm calling.

Here is the code:

pUrl := 'https://api.twilio.com/2010-04-01/Accounts/' + AccountSid+'/Calls';
AllParams.Add('From=' + PhoneNumberFrom);
AllParams.Add('To=' + pToNumber);
AllParams.Add('Url=' + pXMLUrl);

IdHttp1.Post(pUrl, AllParams)

If I use https://demo.twilio.com/welcome/voice/ as URL it works well. I get the full message and everything. If I use my url from the server it doesn't.
My XML looks like:

<?xml version="1.0" encoding="UTF-8" ?>
<Response>
 <Say>An urgent ticket has been posted in support portal. Please see to it.</Say>
</Response>

Also I've created a TwiML with HTTPGET in Twilio Console and if I use ApplicationSid instead of URL in my application I just get the second sentence when I answer the call.

Would anyone have an idea what is going on?

Upvotes: 1

Views: 168

Answers (1)

Aghi
Aghi

Reputation: 119

I've found the answer.

I had to add:

AllParams.add('Method=GET')

as default method POST that is called isn't allowed on static files on IIS.

Upvotes: 1

Related Questions