Sidebar Menu

UploadSoundFile

Use this method to upload a sound file. Our system accepts WAV files (PCM, u-Law, A-law, or MS ADPCM). To use the sound file in a message, put tildes (~) around it and start it with a caret (^). Example: Hello ~^soundfile~, you are great. (The message would say "Hello," then play the sound file, and then say "you are great.")

Syntax

UploadSoundFile(FileBinary, SoundFileID, LicenseKey)

Request Parameters

Parameter Name Description Data Type Required Sample Value
FileBinary

The u-Law wav file. The maximum file size allowed is 2 MB. The minimum recommended sound quality is 16-bit mono PCM. Files can be split if they are larger than 2 MB.

Base64Binary True Base64 encoded file data
SoundFileID

Name file for future retrieval.

String True Introduction1
LicenseKey

Your license key, which is required to invoke this web service.

String True F01d89fd-5155-5455-5585-e84ab8de8591

Response

Returns: UploadSoundFileResponse object

Code Samples

/* https://ws.cdyne.com/notifyws/phonenotify.asmx?wsdl was added as a Web Reference and given the name WSDL */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UploadSoundFile.Properties;
using UploadSoundFile.WSDL;

namespace UploadSoundFile
{
    class Program
    {
        static void Main()
        {
            string fileName = (@"C:\Users\Desktop\Hello.wav");

            PhoneNotify PN = new PhoneNotify();

            byte[] ba = System.IO.File.ReadAllBytes(fileName);

            UploadFileResponse Response = PN.UploadSoundFile(ba, fileName.Substring(fileName.LastIndexOf("\\")), "YOUR LICENSE KEY");

            Console.WriteLine(
                "Sound File Uploaded: " + Response.UploadSuccessful + "\n" +
                "Sound File Length: " + Response.UploadedLengthInSeconds + " seconds"
            );

            Console.ReadLine();
        }
    }
}
' https://ws.cdyne.com/notifyws/phonenotify.asmx?wsdl was added as a Web Reference and given the name WSDL

Imports UploadSoundFile.WSDL
Module Module1

    Sub Main()

        Dim PN As New WSDL.PhoneNotify
        Dim Response As New WSDL.UploadFileResponse
        Dim FileName As String
        Dim BA As Byte()

        FileName = "C:\Users\Desktop\Hello.wav"

        BA = System.IO.File.ReadAllBytes(FileName)

        Response = PN.UploadSoundFile(BA, FileName.Substring(FileName.LastIndexOf("\")), "YOUR LICENSE KEY")

        Console.WriteLine("Sound File Uploaded: " & Response.UploadSuccessful & vbLf &
                          "Sound File Length: " & Response.UploadedLengthInSeconds & " seconds")

        Console.ReadLine()

    End Sub

End Module
define("ALERTD_CDYNE_LICENSE_KEY", 'secretKeyHere');
define("ALERTD_CALLER_ID_NUMBER", '6175551212'); // caller id "from" number
define("ALERTD_CALLER_ID_NAME", 'Example.com');

$client = new SoapClient('https://ws.cdyne.com/NotifyWS/PhoneNotify.asmx?wsdl');
print_r($client);

// Get contents of the file
$handle = fopen("mywavfile.wav", "r");
$contents = fread($handle, filesize("mywavfile.wav"));
fclose($handle);

// Set parameters
$params = array();
$params['LicenseKey'] = ALERTD_CDYNE_LICENSE_KEY;
$params['SoundFileID'] = 'test1';
$params['FileBinary'] = $contents;

// Make call
$result = $client->UploadSoundFile( $params );

// Print result
print_r($result);
GET /NotifyWS/PhoneNotify.asmx/UploadSoundFile?FileBinary=string&FileBinary=string&SoundFileID=string&LicenseKey=string HTTP/1.1
Host: ws.cdyne.com
POST /NotifyWS/PhoneNotify.asmx/UploadSoundFile HTTP/1.1
Host: ws.cdyne.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

FileBinary=string&FileBinary=string&SoundFileID=string&LicenseKey=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<UploadFileResponse xmlns="http://ws.cdyne.com/NotifyWS/">
  <UploadSuccessful>boolean</UploadSuccessful>
  <ErrorResponse>string</ErrorResponse>
  <UploadedLengthInSeconds>int</UploadedLengthInSeconds>
</UploadFileResponse>
POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.cdyne.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://ws.cdyne.com/NotifyWS/UploadSoundFile"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <UploadSoundFile xmlns="http://ws.cdyne.com/NotifyWS/">
      <FileBinary>base64Binary</FileBinary>
      <SoundFileID>string</SoundFileID>
      <LicenseKey>string</LicenseKey>
    </UploadSoundFile>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <UploadSoundFileResponse xmlns="http://ws.cdyne.com/NotifyWS/">
      <UploadSoundFileResult>
        <UploadSuccessful>boolean</UploadSuccessful>
        <ErrorResponse>string</ErrorResponse>
        <UploadedLengthInSeconds>int</UploadedLengthInSeconds>
      </UploadSoundFileResult>
    </UploadSoundFileResponse>
  </soap:Body>
</soap:Envelope>
POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.cdyne.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <UploadSoundFile xmlns="http://ws.cdyne.com/NotifyWS/">
      <FileBinary>base64Binary</FileBinary>
      <SoundFileID>string</SoundFileID>
      <LicenseKey>string</LicenseKey>
    </UploadSoundFile>
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <UploadSoundFileResponse xmlns="http://ws.cdyne.com/NotifyWS/">
      <UploadSoundFileResult>
        <UploadSuccessful>boolean</UploadSuccessful>
        <ErrorResponse>string</ErrorResponse>
        <UploadedLengthInSeconds>int</UploadedLengthInSeconds>
      </UploadSoundFileResult>
    </UploadSoundFileResponse>
  </soap12:Body>
</soap12:Envelope>