Twilio语音Api-是否可以录制消息并在a流中播放录制消息
当接到来电时,我需要让来电者记录信息。然后拨一个号码,在接收者接听电话时播放录制的信息 这可能吗?注意:用您的值替换帐户SID、身份验证令牌、电话号码、网站地址 第1步。 接听来电并记录信息(Twilio语音Api-是否可以录制消息并在a流中播放录制消息,twilio,twilio-api,Twilio,Twilio Api,当接到来电时,我需要让来电者记录信息。然后拨一个号码,在接收者接听电话时播放录制的信息 这可能吗?注意:用您的值替换帐户SID、身份验证令牌、电话号码、网站地址 第1步。 接听来电并记录信息(http://somewebsite.xyz/recordMessage.php) 第3步。 播放录制的信息(http://somewebsite.xyz/playRecordedMessage.php) 花点时间听你的留言。 再见。 感谢您的示例回复。在步骤2中,呼叫者应该在通话中。接收者应该听
http://somewebsite.xyz/recordMessage.php
)
第3步。
播放录制的信息(http://somewebsite.xyz/playRecordedMessage.php
)
花点时间听你的留言。
再见。
感谢您的示例回复。在步骤2中,呼叫者应该在通话中。接收者应该听到录音信息并与呼叫者交谈。删除响应中的挂断将起作用?您是否正在尝试屏蔽呼叫?“接受者”总是和打电话的人说话吗?如果没有,你会如何处理来电者?请使用完整的用户故事更新您的问题。从来电者那里获取筛选问题的答案,并将答案播放给接收者。您可以将来电者置于队列中,而不是挂断电话,当呼叫者等待时,接收者将听到录音,然后您可以连接接收者加入队列并与呼叫者交谈。使用拨号和队列标签修改步骤2和3。
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Say>
Please leave a message at the beep.
Press the star key when finished.
</Say>
<Record
action="http://somewebsite.xyz/makeOutgoingCall.php"
maxLength="60"
timeout="10"
finishOnKey="*"
/>
<Say>I did not receive a recording</Say>
</Response>
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Say>Thank you for your message. Goodbye.</Say>
<Hangup/>
</Response>
<?php
// Include the Twilio PHP library
require 'Services/Twilio.php';
// Twilio REST API version
$version = "2010-04-01";
// Set our Account SID and AuthToken
$sid = 'AC123';
$token = 'abcd';
// A phone number you have previously validated with Twilio
$phonenumber = '4151234567';
$recordingUrl = urlencode($_REQUEST['RecordingUrl']);
// The URL Twilio will request when the call is answered
$twilioRequestUrl = "http://somewebsite.xyz/playRecordedMessage.php?RecordingUrl=".$recordingUrl;
// Instantiate a new Twilio Rest Client
$client = new Services_Twilio($sid, $token, $version);
try {
// Initiate a new outbound call
$call = $client->account->calls->create(
$phonenumber, // The number of the phone initiating the call
'5101234567', // The number of the phone receiving call
$twilioRequestUrl
);
//echo 'Started call: ' . $call->sid;
} catch (Exception $e) {
//echo 'Error: ' . $e->getMessage();
}
<?php
// and play the recording back, using the URL that Twilio posted
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Say>Take a listen to your message.</Say>
<Play><?php echo $_REQUEST['RecordingUrl']; ?></Play>
<Say>Goodbye.</Say>
</Response>