<?php require 'vendor/autoload.php'; use Plivo\Response; $r = new Response(); // Add Speak tag $body = "Connecting your call.."; $r->addSpeak($body); $params = array('action' => 'https://example.com/dial_status.php', 'method' => 'GET'); // Add Dial tag $d = $r->addDial($params); $number = "1111111111"; $d->addNumber($number); Header('Content-type: text/xml'); echo $r->toXML(); ?> <!--dial_status.php--> <?php // Print the Dial Details $status = $_REQUEST['DialStatus']; $aleg = $_REQUEST['DialALegUUID']; $bleg = $_REQUEST['DialBLegUUID']; echo "Status = {$status} , Aleg UUID = {$aleg} , Bleg UUID = {$bleg}"; /* Sample Output <Response> <Speak>Connecting your call..</Speak> <Dial action="https://glacial-harbor-8656.herokuapp.com/testing.php/dial_status" method="GET"> <Number>1111111111</Number>
<?php require 'vendor/autoload.php'; use Plivo\Response; // Simultaneous dialing is useful when there are SIP users and numbers that you want to dial. // The first call that connects will cancel all other tries. $r = new Response(); // Add Dial tag $d = $r->addDial(); // Add Number tag $number1 = "1111111111"; $d->addNumber($number1); $number2 = "2222222222"; $d->addNumber($number1); $user1 = "sip:abcd1234@phone.plivo.com"; $d->addUser($user1); Header('Content-type: text/xml'); echo $r->toXML(); /* Sample Output <Response> <Dial> <Number>1111111111</Number> <Number>2222222222</Number> <User>sip:abcd1234@phone.plivo.com</User> </Dial> </Response> */
Header('Content-type: text/xml'); echo $r->toXML(); ?> <!--connect.php--> <?php require 'vendor/autoload.php'; use Plivo\Response; $r = new Response(); // Add Speak tag $body = "Connecting your call.."; $attributes = array('action' => "https://example.com/dial_status.php", 'method' => "GET", 'redirect' => "true"); $r->addSpeak($body); // Add Dial tag $d = $r->addDial($attributes); $number = "11111111111"; $d->addNumber($number); Header('Content-type: text/xml'); echo $r->toXML(); /* Sample Output <Response> <Speak>Please wait while your call is being transferred</Speak> <Redirect> https://glacial-harbor-8656.herokuapp.com/testing.php/connect </Redirect> </Response> <Response> <Speak>Connecting your call..</Speak>
<?php require 'vendor/autoload.php'; use Plivo\Response; $dst = $_REQUEST['TO']; $src = $_REQUEST['CLID']; if (!$src) { $src = $_REQUEST['From']; } $cname = $_REQUEST['CallerName']; $response = new Response(); if ($dst) { $dial_params = array(); if ($src) { $dial_params['callerId'] = $src; } if ($cname) { $dial_params['callerName'] = $cname; } $dial = $response->addDial($dial_params); if (substr($dst, 0, 4) == "sip:") { $dial->addUser($dst); } else { $dial->addNumber($dst); } } else { $response->addHangup(); } header("Content-Type: text/xml"); echo $response->toXML();