我想创建一个拨号会话循环(一个拨号会话结束后,将创建另一个),以便一次呼叫多个客户端。
我在拨号动词中使用此方法:
public function afterCall(Call $call, DialSession $ds, TwilioClient $client): VoiceResponse
{
$voiceResponse = new VoiceResponse();
$voiceResponse->pause(['length' => 1]);
if ($_REQUEST['DialCallStatus'] === 'completed') {
$call->status = Call::COMPLETED;
$call->connected = true;
$call->recording_link = $_REQUEST['RecordingUrl'];
}
if ($_REQUEST['DialCallStatus'] === 'busy' || $_REQUEST['DialCallStatus'] === 'no-answer') {
$call->status = Call::BUSY;
$client->leaveVoiceMail($_REQUEST['DialCallSid']);
}
if ($_REQUEST['DialCallStatus'] !== 'completed' &&
$_REQUEST['DialCallStatus'] !== 'busy' &&
$_REQUEST['DialCallStatus'] !== 'no-answer'
) {
$call->status = Call::ERROR;
}
return $voiceResponse;
}
[我的DialCallStatus
是busy
或no-answer
时,我想留下一个保存的mp3消息(语音邮件)
但是当我更新呼叫/ w DialCallSid(在$client->leaveVoiceMail($_REQUEST['DialCallSid']);
中时,出现此错误:
Twilio\Exceptions\RestException: [HTTP 400] Unable to update record: Call is not in-progress. Cannot redirect.
是否有办法从当前呼叫异步在Dial端留下消息?
谢谢!
如果DialCallStatus返回忙音或无人接听,则表示被叫方未接听电话。如果被叫方语音邮件或人工接听了电话,您只能留下语音邮件或播放自动通知。
https://www.twilio.com/docs/voice/twiml/dial#dialcallstatus
也许您可以使用Calls REST API资源来模拟出站呼叫并使用电话答录机检测(AMD)来简化流程,从而为您提供更好的服务。