require_once(dirname(__FILE__).'/../../src/conferencecall/client/ConferenceCallClient.php'); // Includes the Conference Call client
require_once(dirname(__FILE__).'/../../src/conferencecall/data/ConferenceCallStatusConstants.php'); // Includes the Conference Call constants
$username = 'username'; // Telekom Developer Center user name
$password = 'password'; // Telekom Developer Center password
$client = new ConferenceCallClient('production', $username, $password); // Constructs the Telekom client using the user name and password.
// List of participants
$participants = Array(
0 => Array('FirstName' => 'First', 'LastName' => 'Participant', 'Number' => '+49 30 1234 5678', 'Email' => 'first.participant@example.com', 'Initiator' => 'true'),
1 => Array('FirstName' => 'Second', 'LastName' => 'Participant', 'Number' => '+49 30 8765 4321', 'Email' => 'second.participant@example.com', 'Initiator' => 'false'),
2 => Array('FirstName' => 'Third', 'LastName' => 'Participant', 'Number' => '+49 30 9876 1234', 'Email' => 'third.participant@example.com', 'Initiator' => 'false')
);
$maximum_duration = '60'; // The maximum duration of the conference in seconds
$join_confirm = 'false'; // Is pressing the #-key required for joining the conference?
$create_response = null; // Result of the creation of the Conference Call object
try {
// Creates the conference object within the Conference Call Server
$create_response = $client->createConference('ownerID', 'name', 'description', null, null, $maximum_duration, $join_confirm, null, null);
// Test, if the invocation of createConference() was successful.
if(!($create_response->getStatus()->getStatusConstant() == ConferenceCallStatusConstants::SUCCESS)) {
$errorMessage = 'The invocation of createConference() was not successful.\n';
$errorMessage .= $create_response->getStatus()->getStatusCode() . ' ' . $create_response->getStatus()->getStatusMessage();
throw new Exception($errorMessage);
}
} catch(Exception $e) {
exit($e->getMessage());
}
print 'The conference ID: ' . $create_response->getConferenceId() . '\n'; // The conference ID. It is used for adding participants and committing the conference
$new_participant_response = null; // Result of adding a participant
foreach ($participants as $participant) {
try {
// Adds the first participant (the initiator) to the conference
$new_participant_response = $client->newParticipant($create_response->getConferenceId(), $participant['FirstName'], $participant['LastName'], $participant['Number'], $participant['Email'], $participant['Initiator']);
// Test, if the invocation of newParticipant() was successful.
if(!($new_participant_response->getStatus()->getStatusConstant() == ConferenceCallStatusConstants::SUCCESS)) {
$errorMessage = 'The invocation of newParticipant() was not successful.\n';
$errorMessage .= $new_participant_response->getStatus()->getStatusCode() . ' ' . $new_participant_response->getStatus()->getStatusMessage();
throw new Exception($errorMessage);
}
} catch(Exception $e) {
exit($e->getMessage());
}
}
$commit_response = null; // The result of the initiation of the conference
try {
// Commits the conference to the Conference Call Server and therefore initiates the conference
$commit_response = $client->commitConference($create_response->getConferenceId());
// Test, if the invocation of commitConference() was successful.
if(!($commit_response->getStatus()->getStatusConstant() == ConferenceCallStatusConstants::SUCCESS)) {
$errorMessage = 'The invocation of commitConference() was not successful.\n';
$errorMessage .= $commit_response->getStatus()->getStatusCode() . ' ' . $commit_response->getStatus()->getStatusMessage();
throw new Exception($errorMessage);
}
} catch(Exception $e) {
exit($e->getMessage());
}
print 'Conference successfully commited.';