gazubi
gazubi

Reputation: 561

Setting a time limit to a twilio call

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
}

Upvotes: 3

Views: 3599

Answers (2)

chamlingd
chamlingd

Reputation: 85

Use timeLimit

check this twilio docs

Upvotes: 3

Chris Jenkins
Chris Jenkins

Reputation: 719

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.

Upvotes: 1

Related Questions