duanmu3049 2013-06-26 16:17
浏览 43
已采纳

在twilio上使用url属性后,我需要回到调用者的角度

I am using twilio to make a call screening app, I use the url attribute to give the callee options but I cannot get back to the callers point of view.

<?php
    header("content-type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
?>
<Response>
    <Say>please hold while we locate mike</Say>
        <Dial>
            <Number url="hello-monkey-name.php">+12154678556</Number>
            <Number url="hello-monkey-name.php">+12123645995</Number>
       </Dial>
</Response>

The url attribute sends the callee to "hello-monkey-name.php" where it gives him/her three options.

<?php
    session_start();
$var_value = $_SESSION['RecordingUrl'];
    // now greet the caller
    header("content-type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";

?>
<Response>
   // <Play><?php echo $_REQUEST['RecordingUrl']; ?></Play>
    <Say> is calling <Say/>
    <Gather numDigits="1" action="hello-monkey-called.php" method="POST">
        <Say>To accept the call, press 1.  To send call to voicemail, press 2. to hangup,            press 3</Say>
    </Gather>
</Response>

Once the callee presses a button its sent to "hello-monkey-called.php" where it gathers the digits and decides what it need to do, I can get it to complete the call and to hangup the call but when I cannot get it to forward the call to a voicemail sip address. Any ideas how I can get it to be back in the callers perspective heres to code for that part if it helps at all.

<?php

    // if the caller pressed anything but 1 or 2 send them back
    if($_REQUEST['Digits'] != '1' and $_REQUEST['Digits'] != '2' and $_REQUEST['Digits']     != '3') {
    header("Location: hello-monkey-name.php");
    die;
}

header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
>
<Response>
<?php if ($_REQUEST['Digits'] == '1') { ?>
<?php } elseif ($_REQUEST['Digits'] == '2') { ?>
    <Dial>
        <Sip> vm.johnsmith@junctionnetworks.com <Sip/>
    <Dial/>
<?php } elseif ($_REQUEST['Digits'] == '3') { ?>
        <Hangup/>
<?php } ?>
</Response>
  • 写回答

1条回答 默认 最新

  • dongpu1331 2013-06-26 19:25
    关注

    Twilio evangelist here.

    A few ideas to start with. First, as always, you can check to the Debugger in your Twilio dashboard just to make sure there are nothing related to this there.

    Second, does your SIP server require you to authenticate with it in order to connect? If it does you can specify your credentials using the username and password attributes on the <Sip> noun.

    Lastly, you might be able to tell whats going on by hooking up the action parameter of the <Dial> verb. When Twilio tried to Dial a Sip address, we send a few extra SIP specific parameters to the URL specified on the Dial verb. One of those is call DialSipResponseCode, which is the response code we get back after sending the SIP INVITE.

    Hope that helps.

    Devin

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度