如何在出局通话中与Twilio在x秒后停止记录?

时间:2019-04-16 20:44:03

标签: twilio call recording

我想在twilio上记录去电并在x秒后停止 一切正常,除了超时或最大长度 我有两个文件: makecall.php

to_number = "+33123456789";
$client = new Client($account_sid, $auth_token);
$client->account->calls->create(
    $to_number,
    $twilio_number,
    array(
"record" => True, 
"maxLength" => 30,
"RecordingStatusCallback" => "callback.php",
"Url" => "answercall.php"
    )
);

answercall.php

require '../vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;
$response = new VoiceResponse();
$response->record(['maxLength' => 30]);
header('Content-Type: text/xml');
echo $response;;

我也在接听电话中尝试过

$response->pause(['length' => 30]);
$response->hangup();

但它不会停止记录!

1 个答案:

答案 0 :(得分:0)

maxLength是TwiML Record Verb的属性,而不是Calls Resource的属性。

您将需要为此使用Recording API。

参考Stop a call Recording