Bulvak Bulvak - 7 months ago 20
PHP Question

twilio and php Dial verb Question

I am using the dial verb and after a while of calling it sends me to the voice message of that person but instead I want it to call a separate number if the first did not work. I am aware of the fact that I can set time out but I dont know how to format the line of code with a set of parameters. By the I mean where or how am I suppose to put the parameters?
My Goal or aim is to make a sequential dialling program.
Meaning in the following code where would you put the parameters ? Generally in programming you have function (parameter1, parameter2, parameter3) But this seems different.

<Response>
<Dial> 416-794-8543</Dial>
<Say>Hello Monkey <?php echo $tryME ?></Say>
</Response>


My current code if you would like to see is below:

<?php
require "twilio.php";

// initiate response library
$response = new Response();

header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";


$PhoneNumbers= array('4167841543','6478704858');



$variableToCall=$PhoneNumbers[0];

if(($_REQUEST['DialStatus'] == "busy" || $_REQUEST['DialCallStatus'] == "no-answer" || $_REQUEST['DialCallStatus'] == "failed" || $_REQUEST['DialCallStatus'] == "canceled")) {

$variableToCall=$PhoneNumbers[1];

}




?>


<Response>
<Dial> <?php echo $variableToCall ?> </Dial>

</Response>

Answer

The response should look like this TwiML:

<Response>
    <Dial timeout="45"><?php echo $variableToCall ?></Dial>
</Response>