CallFire has a new API!
We are proud to announce the launch of our API 2.0! Learn more about our streamlined, transactional and broadcast APIs. This version of the API documentation will remain available for reference only. There will be no new development, only bug fixes. We highly recommend upgrading to our newer and more sophisticated documentation.
There are two ways to create a sound: (1) uploading a pre-recorded WAV or MP3, or (2) initiating a call to record a sound over the phone.
Duplicate uploads are not allowed. If a duplicate sound data are provided, a new sound is not created. Instead, the ID of the previous sound is returned.
Recording a sound over the phone works by first creating a sound asset using the RecordingCall option,
then call the ToNumber to record live voice as sound. If sound is created using RecordingCall then need
to wait for sound to be active by calling GetSoundMeta
until Status = 'ACTIVE'.
Use the returned soundId in a subsequent SendCall
request.
Request Parameters
Parameter | Demo Value | Description | Data Type |
---|---|---|---|
CreateSound | Create Sound using attached info | object | |
Name | The name of your sound. This name is included in SoundMeta and shown in the web interface. | string | |
Data * | MP3 or WAV bytes. Base64 encoded bytes can be provided inline. Capable clients can avoid the 33% encoding overhead by sending the data as an MTOM attachement | base64Binary | |
RecordingCall * | Initiates a call to record a new sound over the phone. | object | |
ToNumber | E.164 11 digit number to call to record a new sound. | List[PhoneNumber] | |
SoundText * | string | ||
SoundTextVoice | Voice |
* indicates choice value, bolded parameters are required
Response Parameters
Parameter | Description | Data Type |
---|---|---|
CreatedId | Unique ID of resource | long |
<?php
/**
* You'll need your login/password pair when you create the SOAP client.
* Don't use the fake login/password provided here; it's just for show and
* won't work.
*/
$wsdl = "http://callfire.com/api/1.1/wsdl/callfire-service-http-soap12.wsdl";
$client = new SoapClient($wsdl, array(
'soap_version' => SOAP_1_2,
'login' => 'YourLoginId',
'password' => 'YourPassword'));
/**
* CreateSound. Two ways to create sound; 1.) Upload a mp3 soundfile for later use
* in ivr campaign or call, 2.) Call number specified in RecordingCall option
* to record live voice.
*/
//
// Create sound using mp3 file.
//
$request = new stdclass();
$request->Name = 'My API Test Sound'; // string
$request->Data = file_get_contents('test-sound.mp3'); // base64Binary required
$soundId = $client->CreateSound($request);
echo "Sound ID: $soundId\n";
// Sample response: 9
//
// Create sound by calling phone number specified in RecordingCall option.
//
$request = new stdClass();
$request->Name = 'My API Test Sound by Recording Call'; // string
$request->RecordingCall = new stdClass(); // object
$request->RecordingCall->ToNumber = '13105551212'; // object
$soundId = $client->CreateSound($request);
echo "Sound ID: $soundId\n";
// Sample response: 10
?>