I have modified the Twilio call screening script so that it simultaneously tries several phones, and if someone preses a key to accept the call then it connects.
If this doesn't happen, or it times out, then it is sent back to a switch statement that decides what to do.
The issue I am having is being able to redirect to a Twimlet if the office is closed or there is no answer.
This si what i have so far:
switch ($DialCallStatus) {
case 'busy':
case 'no-answer':
case 'failed':
echo '<Response><Redirect>http://twimlets.com/voicemail?Email=al@domain.co.uk&Message=http://domain.co.uk/answerphone_open.mp3</Redirect></Response>';
break;
case 'closed':
echo '<Response><Redirect>http://twimlets.com/voicemail?Email=al@domain.co.uk&Message=http://domain.co.uk/answerphone_closed.mp3</Redirect></Response>';
break;
case 'completed':
echo '<Response><Hangup/></Response>';
break;
default:
echo '<Response>
//tries other phones
The switch seems to be working right as I can <say>
different messages depending on the case, but the redirect doesn't work
I looked at the docs and as far as I va work out, it needs to be between tags. Wat am i doing wrong?
Thanks for your help!
PS. the URL works as its my fallback url. PPS> Didn't post the full code here, but can do if its helpful.
edit: Errors
In my dashboard I get the following error:
<Response>
<Redirect>http://twimlets.com/voicemail?Email=al@dallasmatthews.co.uk&Message=http://dallasmatthews.co.uk/twilio/answerphone_closed.mp3</Redirect>
</Response>
Parse error found on line 1 of the Raw Response
My raw XML looks like this:
<Response><Redirect>http://twimlets.com/voicemail?Email=al@DOMAIN.co.uk&Message=http://DOMAIN.co.uk/twilio/answerphone_closed.mp3</Redirect></Response>