<!-- Intent: takes the given VOICE_ALERT_CONTENT object
	and returns the text content
	-->


<?php
$url = 'http://api.v4.swiftreach.com/api/Messages/Voice/Helpers/VoiceContentObjectToText';
$authToken = '123456';


$jsonString = ' 
{ 
	"VoiceItemType":1, 
	"AudioSource":[{ 
                "$type":"SwiftReach.Swift911.Core.Messages.Voice.AUDIO_SOURCE_TTS_TEXT, SwiftReach.Swift911.Core", 
                "AudioType":"audio_source_tts_text", 
                "TTSText":"This is the message." 
		                }] 
}';

$headers = array(
    'Content-type: application/json',
    'SwiftAPI-Key: ' . $authToken,
    'Accept: application/json',
    'Expect:'
);
$ch = curl_init();
$args = array(
    CURLOPT_URL => $url,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_POST => TRUE,
    CURLOPT_POSTFIELDS => $jsonString,
    CURLOPT_HTTPHEADER => $headers,
);
curl_setopt_array($ch, $args);
$res = curl_exec($ch);
$res_data = json_decode($res, true);
print($res_data);
?>

<!-- example return value -->
"[tts]This is the message.[/tts]"