<?php require 'vendor/autoload.php'; use Plivo\Response; $r = new Response(); $body = "You will now be placed into a demo conference. This is brought to you by Plivo. To know more visit us at plivo.com"; $r->addSpeak($body); $params = array('enterSound' => "beep:2", 'record' => "true", 'action' => "https://example.com/conf_action.php", 'method' => "GET", 'record' => "true", 'callbackUrl' => "https://example.com/conf_callback.php", 'callbackMethod' => "GET", 'startConferenceOnEnter' => "true", 'endConferenceOnExit' => "true"); $conference_name = "demo"; $r->addConference($conference_name, $params); Header('Content-type: text/xml'); echo $r->toXML(); ?> <!--conf_action.php--> <?php $conf_name = $_REQUEST['ConferenceName']; $conf_uuid = $_REQUEST['ConferenceUUID']; $conf_mem_id = $_REQUEST['ConferenceMemberID']; $record_url = $_REQUEST['RecordUrl']; $record_id = $_REQUEST['RecordingID']; error_log("Conference Name : {$conf_name}, Conference UUID : conf_uuid, Conference Member ID : conf_mem_id, Record URL : {$record_url}, Record ID : {$record_id}"); echo "Conference Name : {$conf_name}, Conference UUID : conf_uuid, Conference Member ID : conf_mem_id, Record URL : {$record_url}, Record ID : {$record_id}"; ?> <!--conf_callback.php--> <?php $conf_action = $_REQUEST['ConferenceAction']; $conf_name = $_REQUEST['ConferenceName'];
<?php require 'vendor/autoload.php'; use Plivo\Response; # Generates a Conference XML $r = new Response(); $params = array('enterSound' => "beep:1", 'callbackUrl' => "https://example.com/conf_callback.php", 'callbackMethod' => "GET"); $name = "demo"; $r->addSpeak("You will now be placed into a demo conference. This is brought to you by Plivo. To know more visit us at plivo.com"); $r->addConference($name, $params); Header('Content-type: text/xml'); echo $r->toXML(); ?> <!--conf_callback.php--> <?php require 'vendor/autoload.php'; use Plivo\RestAPI; # Record API is called in the callback URL to record the conference $conf_name = $_REQUEST['ConferenceName']; $event = $_REQUEST['Event']; print "Conference Name : {$conf_name}"; print "Event : {$event}"; # The recording starts when the user enters the conference room if ($event == "ConferenceEnter") { $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $params = array('conference_name' => $conf_name); $resp = $p->record_conference($params);