Question

I need help to setup Twilio voicemail box. I think I've setup everything correctly and I am getting voice message on my email when someone submit their voice message but when people trying to submit a voice message then Twilio automatically saying "I am sorry, The personal you're trying to calling has a voice mail box but it doesn't setup yet" and then the voice mail can be submit. Can anyone please let me know why I am getting this message from Twilio?

I've setup voice mail box like the below:

<Dial>++1xxxxxxxxx</Dial>
    <Say voice="woman">Please, leave a message after the tone and press the # when you are finished.</Say>
    <Record action="mail.php" method="POST" maxLength="120" playBeep="true" />

And the mail.php is:

<?php
/**
 * This section ensures that Twilio gets a response.
 */
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response></Response>'; //Place the desired response (if any) here.

/**
 * This section actually sends the email.
 */
$to      = "example@gmail.com"; // Your email address.
$subject = "Message from {$_REQUEST['From']}";
$message = "You have received a message from {$_REQUEST['From']}.";
$message .= "To listen to this message, please visit this URL: {$_REQUEST['RecordingUrl']}";
$headers = "From: voicemail@twimlets.com"; // Who should it come from?

mail($to, $subject, $message, $headers);
Was it helpful?

Solution

Twilio evangelist here.

Twilio executes TwiML in a serial fashion and waits for each TwiML verb to finish before moving to the next. In your case that means Twilio is going to execute the <Dial> verb first and not move on to the <Say> verb until the call you've dialed completes.

What I suspect is happening is when Twilio dials the phone number your specified in the <Dial> (which I beleive is your own home or cell phone?), its going to your telcos default voicemail system which it looks like you've not set up. When the telco realizes you don't have voicemail set up in their system, they inform the user then terminate the call.

Once your telco terminates their leg of the call, Twilio then sees that the <Dial> has completed and moves on to execute the <Say> and <Record> verbs.

I'm not sure there is a way via Twilio to change this behavior. You would likely need to contact your telco and see if they can prevent your number from trying to go to their voicemail system.

Hope that helps.

OTHER TIPS

If all you want to do is read/play a message and then email the voicemail to someone in response to each message, you can do it all right here:

https://www.twilio.com/labs/twimlets/voicemail

without writing any code. Twilio makes it very easy for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top