我想创建以下内容:
- 一个行号,比如说 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>
加入呼叫.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>
所以我想知道:
- 在执行所有逻辑时,如何在呼叫方播放等待音乐?
- 如何断开通话并要求来电者留言?