1

我想创建以下内容:

  1. 一个行号,比如说 741-SUPPORT(只是一个示例),人们可以在其中拨打电话。
  2. 当有人打电话时,我希望他们听一些文字(我使用<Say>),然后将他们的电话转接到我的号码。
  3. 当我接到电话时,我想收听一条短信,通知我此电话来自该线路,并允许我按 0 接听电话,或按任何其他号码拒绝它。
  4. 如果我接受,两个电话都会接通。否则,呼叫者应该能够留言。

到目前为止我所做的:

调用者调用 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>

所以我想知道:

  • 在执行所有逻辑时,如何在呼叫方播放等待音乐?
  • 如何断开通话并要求来电者留言?
4

1 回答 1

1

考虑使用入队。因此,该人拨入然后将它们发送到指定 waitUrl 的队列。(用它来播放音乐)。

当您接听电话时,拨打队列并接听电话。

在我的脑海中,如果您拒绝来电,那么您将不得不使用 rest api 将呼叫重定向到另一个 url,然后说谢谢但不谢谢。

于 2015-08-28T17:23:59.713 回答