I am using Twilio client to make phone calls with C++Builder (RAD Studio Tokyo) 10.2.3 and Intraweb 15.
To handle callbacks, this is the solution suggested by Twilio tech team:
https://www.twilio.com/docs/voice/make-calls#set-statuscallback-on-an-outbound-call
async function createCall() {
const call = await client.calls.create({
from: "+18668675310",
method: "GET",
statusCallback: "https://www.myapp.com/events",
statusCallbackMethod: "POST",
to: "+14155551212",
url: "http://demo.twilio.com/docs/voice.xml",
});
console.log(call.sid);
}
The statusCallback
is supposed to be a URL back to the web application built with Intraweb.
Using the Delphi Twilio Client, the phone call is made this way:
https://github.com/TwilioDevEd/twilio-delphi-demo/blob/master/TwilioClient.pas
allParams := TStringList.Create;
allParams.Add('From=' + fromPhoneNumber);
allParams.Add('To=' + toPhoneNumber);
allParams.Add('Url=http://demo.twilio.com/docs/voice.xml');
response := client.Post('Calls', allParams);
The Twilio client is just a TNetHTTPRequest
.
The problem is how to use the TNetHTTPRequest
to handle the statusCallback
so that I can get the result of the call back to my application?