【发布时间】:2015-04-13 10:01:17
【问题描述】:
我想创建以下内容:
- 一个行号,比如 741-SUPPORT(只是一个示例),人们可以在其中拨打电话。
- 当有人来电时,我希望他们听一些短信(我使用
<Say>),然后将他们的来电转接到我的号码。 - 当我接到电话时,我想收听一条短信,通知我此电话来自该线路,并允许我按 0 接听电话,或按任何其他数字拒绝接听电话。
- 如果我接受,两个呼叫都会连接。否则,来电者应该可以留言。
到目前为止我做了什么:
调用者调用 741-SUPPORT 时使用的第一个 TWIML
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice" language="en-US">
This call is being recorded.
Please hold on, your are being connected.
</Say>
<Dial action="CallEnded.php" timeout="15" timeLimit="600" callerId="+1741SUPPORT" record="record-from-answer">
<Number action="JoinCall.php">+PRIVATE NUMBER HERE</Number>
</Dial>
</Response>
JoinCall.php
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather timeout="10" numDigits="1" action="CallAccepted.php">
<Say voice="alice" language="en-US">
You have an incomming call from 741SUPPORT.
Press 0 to accept the call, press any other number to reject the call.
</Say>
</Gather>
</Response>
CallAccepted.php
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<?php if ($_POST['Digits'] == '0') { ?>
<Say voice="alice" language="en-US">
Call accepted.
This call is being recorded.
</Say>
<?php } else { ?>
<Say voice="alice" language="en-US">
Call will be rejected.
</Say>
<Hangup/>
<?php } ?>
</Response>
CallEnded.php
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice" language="en-US">
<?php if ($_POST['DialCallStatus'] != 'completed') { ?>
We had issues connecting the call, please try again later.
<?php } else { ?>
Thanks for your call. Goodbye!
<?php } ?>
</Say>
</Response>
所以我想知道:
- 如何在执行所有逻辑的同时在呼叫方播放等待音乐?
- 如何断开通话并让来电者留言?
【问题讨论】:
-
您找到解决方案了吗?我想做同样的事情,但我不确定如何使用队列来实现它。
标签: twilio twilio-twiml