CREATE SOUND

Creates a new CallFire-hosted sound for use in calls

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 is 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 calling the ToNumber to record live voice as sound. If a sound is created using RecordingCall, then it needs to wait for the sound to be active by calling GetSoundMeta until Status = 'ACTIVE'.

Use the returned soundId in a subsequent SendCall request.

REQUEST PARAMETERS

Parameter Data Type Demo Value Description
CreateSound object Create Sound using attached info
Name string My API Test Sound The name of your sound. This name is included in SoundMeta and shown in the web interface.
Data * base64Binary 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
RecordingCall * object List[PhoneNumber] Initiates a call to record a new sound over the phone.
ToNumber List[PhoneNumber] 13105551212 E.164 11 digit number to call to record a new sound.
SoundText * string
SoundTextVoice Voice

RESPONSE PARAMETERS

Parameter Data Type Description
CreatedId long Unique ID of resource

EXAMPLE

using System;
using RestSharp;
using System.IO;

namespace [your-namespace]
{
    public class [your-class]
    {
        public string CreateSound()
        {
            byte[] audioBytes = File.ReadAllBytes("test.mp3");
            string base64EncodedFile = Convert.ToBase64String(audioBytes);

            var client = new RestClient("https://www.callfire.com/api/1.1/rest/");
            client.Authenticator = new HttpBasicAuthenticator("YourLoginId", "password");

            var request = new RestRequest("call/sound", Method.POST);
            request.AddParameter("Name", "My API Test Sound");
            request.AddParameter("Data", base64EncodedFile);

            var response = client.Execute(request);
            string content = response.Content;
            return content;
        }
    }
}

The XML returned is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<r:ResourceReference xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">

    <r:Id>658741003</r:Id>

<r:Location>https://www.callfire.com/api/1.1/rest/call/sound/658741003</r:Location>

</r:ResourceReference>