I am using the twiml below to create and send a call to my users. However I want to set a time limit to this call. I know it is possible when you use the verb, as shown here. But I don' know how to do it in my situation
try {
$to = '+' . $phone;
$client->account->calls->create(
"+17********",
$to,
$url,
array(
'Method' => "GET",
'FallbackMethod' => "GET",
'StatusCallbackMethod' => "GET",
'Record' => "false",
)
);
} catch (Exception $e) {
// log error
}
Have a look here on how to modify an active call: https://www.twilio.com/docs/api/rest/change-call-state
You are going to need to store the call resource and the time it started. At the appropriate time you will have to make a post to the resource and set it to completed. This will end the call.