3

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
}
gazubi
  • 561
  • 8
  • 32

2 Answers2

3

Use timeLimit

check this twilio docs

chamlingd
  • 87
  • 1
  • 11
1

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.

Chris Jenkins
  • 719
  • 7
  • 20
  • thanks for that. does twilio have an inbuilt command to check when the call started, or do i have to use the PHP command – gazubi Jun 18 '15 at 03:00