Twilio如何通过人/机器找到答案,并使用PHP获得响应

时间:2016-11-11 12:56:43

标签: twilio

我已经从我的前端代码Angular发送参数,像这样,

var params = {"PhoneNumber": Ph};
Twilio.Device.connect(params, {"Record": true, "IfMachine": 'Continue'});

现在,我如何通过机器或人的状态得到呼叫的响应我需要得到呼叫的响应?

1 个答案:

答案 0 :(得分:0)

泰米尔语,我写了一篇文章,解释了我们建议您如何使用<Gather>以及PHP中的示例进行此操作:

https://www.twilio.com/blog/2016/02/tracking-call-status-how-can-you-tell-if-a-human-answers-the-phone-2.html

<?php
# Include Twilio PHP helper library.
require "/path/to/twilio-php/Services/Twilio.php";

# Create response object.
$response = new Services_Twilio_Twiml();
$response->say("Hello, press any key to hear a top secret message.");
$gather = $response->gather(array(
    'action' => "YOUR_TWIML_BIN"
));
$response->say("You did not reveal yourself to be human. Goodbye!");

print $response;

?>