在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>

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