【发布时间】:2017-07-06 15:29:00
【问题描述】:
我在我的项目中使用Twilio Outgoing Browser Calls。拨打电话的 twiml 是这样的:
<Response>
<Dial action="hold_twiml.php" callerId="xxxxxxxxxx">
xxxxxxxxxx
</Dial>
</Response>
hold_twiml.php
if ( $_REQUEST['DialCallStatus'] == 'completed' ) { ?>
<Response>
<Hangup/>
</Response>
<?php
}
else {
?>
<Response>
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
<Redirect>hold_twiml.php</Redirect>
</Response>
<?php
}
?>
当呼叫从客户端/浏览器结束时,我想断开呼叫。为此,我添加了if ( $_REQUEST['DialCallStatus'] == 'completed' ) 条件,现在通话双方都结束了。但是现在保持功能无法正常工作。当我单击保持按钮时,将执行以下代码。
if ( $action == 'hold' ) {
$url = "holding_twiml.php";
$call = $client->calls->read(
array("ParentCallSid" => $_POST['callSid'])
)[0];
} else { // unhold
$call = $client->calls($_POST['callSid'])->fetch();
$url = "redirecting_twiml.php";
}
$call->update(
array(
"url" => $url,
"method" => "POST"
)
);
holding_twiml.php
<Response>
<Enqueue waitUrl="hold_music_twiml.xml">xx</Enqueue>
</Response>
hold_music_twiml.xml
<Response>
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
</Response>
redirecting_twiml.php
<Response>
<Dial action="hold_twiml.php">
<Queue>xx</Queue>
</Dial>
</Response>
现在点击保持,浏览器上的通话将结束,客户端(电话)上的通话被保持。
谁能帮我解决这个问题?提前致谢。
【问题讨论】:
-
你解决了吗?我有同样的问题。
标签: php twilio twilio-api disconnect