<?php
use CallFire\Api\Rest\Request;
use CallFire\Api\Rest\Response;
require 'vendor/autoload.php';
list($callClient, $broadcastClient) = CallFire\Api\Client::Rest("<api-login>", "<api-password>", array(
"Call",
"Broadcast"
));
$request = new Request\CreateSound;
$request->setName('Hello World');
$request->setData(base64_encode(file_get_contents('hello_world.mp3')));
$response = $callClient->CreateSound($request);
$result = $callClient::response($response);
if(!($result instanceof Response\Resource) || !($soundMeta = $resource->getResource())) {
throw new Exception('Could not create the call sound');
}
$soundId = $soundMeta->getId();
$request = new Request\CreateBroadcast;
$request->setName('My CallFire Broadcast');
$request->setType('VOICE');
$request->setFrom('15551231234'); // A valid Caller ID number
$request->setAnsweringMachineConfig('LIVE_IMMEDIATE');
$request->setLiveSoundId($soundId);
$response = $broadcastClient->CreateBroadcast($request);
$result = $broadcastClient::response($response);
if($result instanceof Response\ResourceReference) {
// Success
}