I have been searching for a work around, but I cannot find anything that guarantees action after recording a voicemail. I have to use my server to check call status to end the call and prevent if from going to voicemail after a completed call when using multi-dial. After we record the voicemail I need to SMS a link to the recording for each employee who missed the call. The only way it works is if the caller presses a button before hanging up. I have been trying to use the RecordingStatusCallback as a work around, but I can't figure out how to ensure that the SMS sends if a recording is received.
<?php
header('content-type: text/xml');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$dial_call_status = $_REQUEST['DialCallStatus'];
if($dial_call_status == "completed" || $dial_call_status == "answered"){
?>
<Response>
<Hangup/>
</Response>
<?php
}else{
?>
<Response>
<Record
action="https://handler.twilio.com/twiml/responsefromserver"
transcribe="true"
maxLenth="20"
RecordingStatusCallbackEvent="Completed"
RecordingStatusCallback="https://handler.twilio.com/twiml/XXXX"
transcribeCallback="http://twimlets.com/voicemail?Email=jk@XXXX.com"/>
</Response>
<?php
}
?>
Response from Server:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say> Thankyou for leaving a message </Say>
<Sms to="1XXXXXXX"> John
You missed a call from {{From}} voice Recording: {{RecordingUrl}}.
</Sms>
<Sms to="1XXXXXX"> Joe
You missed a call from {{From}} voice Recording: {{TranscriptionText}}.
</Sms>
</Response>