// Add Dial tag $d = $r->addDial($params); $number = "1111111111"; $d->addNumber($number); Header('Content-type: text/xml'); echo $r->toXML(); ?> <!--custom_tone.php--> <?php require 'vendor/autoload.php'; use Plivo\Response; $r = new Response(); $body = "https://s3.amazonaws.com/plivocloud/music.mp3"; // Add Play tag $r->addPlay($body); Header('Content-type: text/xml'); echo $r->toXML(); /* Sample Output <Response> <Dial dialMusic="https://glacial-harbor-8656.herokuapp.com/testing.php/custom_tone"> <Number>1111111111</Number> </Dial> </Response> <Response> <Play>https://s3.amazonaws.com/plivocloud/music.mp3</Play> </Response> */
$getDigits->addSpeak($IVR_MESSAGE1); $r->addSpeak($NO_INPUT_MESSAGE); Header('Content-type: text/xml'); echo $r->toXML(); break; case "POST": $digit = $_REQUEST['Digits']; if ($digit == '1') { $getdigits_action_url = "https://example.com/phone_tree.php"; $params = array('action' => $getdigits_action_url, 'method' => 'GET', 'timeout' => '7', 'numDigits' => '1', 'retries' => '1'); $getDigits = $r->addGetDigits($params); $getDigits->addSpeak($IVR_MESSAGE2); $r->addSpeak($NO_INPUT_MESSAGE); } else { if ($digit == '2') { $r->addPlay($PLIVO_SONG); } else { $r->addSpeak($WRONG_INPUT_MESSAGE); } } Header('Content-type: text/xml'); echo $r->toXML(); break; } ?> <!--phone_tree.php--> <?php require 'vendor/autoload.php'; use Plivo\Response;