Here's an example of how to send a callback to an agent in using PHP and NuSoap. This is the first step to log an agent into a virtual call center campaign.
<?php
$API_KEY = "<your api key>";
$campaignID = "<campaign id>";
$phonenumber = "<10 digit number>";
$passcode = "<passcode for the campaign>";
$userID = "<some user id unique to you>";
require_once('/usr/src/nusoap/lib/nusoap.php');
$wsdl = "https://www.callfire.com/service/PredictiveService?wsdl";
$client = new soapclient($wsdl, true);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(),
ENT_QUOTES) . '</pre>';
exit();
}
$params = array('key' => $API_KEY, 'campaignId' => $campaignID, 'userId'
=> $userID, 'phoneNumber' => $phonenumber);
/* create the proxy object */
$proxy = $client->getProxy();
// Let NuSoap extract the correct target namespace
// and name param from the WSDL
$result = $proxy->sendAgentCallBack($params);
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
?>
