Exemplo n.º 1
0
echo $r->toXML();
/* 
Sample Wait XML
<Response>
    <Wait length="10" />
    <Speak>Hello</Speak>
</Response>
*/
?>

<!-- Beep detetion -->

<?php 
require 'vendor/autoload.php';
use Plivo\Response;
$r = new Response();
// Add Wait tag
$params = array('length' => '10', 'beep' => 'true');
$r->addWait($params);
// Add Speak tag
$body = "Hello";
$r->addSpeak($body);
Header('Content-type: text/xml');
echo $r->toXML();
/*
Sample Wait XML
<Response>
    <Wait length="10" beep="true" />
    <Speak>Hello</Speak>
</Response>
*/
Exemplo n.º 2
0
<?php

require 'vendor/autoload.php';
use Plivo\Response;
$r = new Response();
$getdigits_action_url = "https://example.com/transfer_action.php";
$params = array('action' => $getdigits_action_url, 'method' => 'GET', 'timeout' => '7', 'numDigits' => '1', 'retries' => '1', 'redirect' => 'false');
$getDigits = $r->addGetDigits($params);
$getDigits->addSpeak("Press 1 to transfer your call");
$waitparam = array('length' => '10');
$r->addWait($waitparam);
Header('Content-type: text/xml');
echo $r->toXML();
?>

<!-- transfer_action.php -->

<?php 
require 'vendor/autoload.php';
use Plivo\RestAPI;
$digit = $_REQUEST['Digits'];
$call_uuid = $_REQUEST['CallUUID'];
$auth_id = "Your AUTH_ID";
$auth_token = "Your AUTH_TOKEN";
error_log($digit);
error_log($call_uuid);
$p = new RestAPI($auth_id, $auth_token);
if ($digit == "1") {
    $params = array('call_uuid' => $call_uuid, 'aleg_url' => 'https://example.com/connect', 'aleg_method' => 'GET');
    $resp = $p->transfer_call($params);
    print_r($resp);