<!--conf_callback.php-->

<?php 
require_once "./plivo.php";
# 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);
    print "URL : {$resp['response']['url']}";
    print "Recording ID : {$resp['response']['recording_id']}";
    print "API ID : {$resp['response']['api_id']}";
    print "Message : {$resp['response']['message']}";
} else {
    print "invalid";
}
/*
Sample Output
<Response>
    <Speak>
        You will now be placed into a demo conference. This is brought to you by Plivo. To know more visit us at plivo.com
    </Speak>
    <Conference enterSound="beep:1" callbackUrl="https://glacial-harbor-8656.herokuapp.com/testing.php/conf_callback" callbackMethod="GET">demo</Conference>
</Response>