I am trying to create an answering machine. I am using Nexmo.
I have two numbers : One French Number, and one US Number (California)
When I call my french number, my audio message is saved on my server and i can listen it. But when i call my US Number, I can listen my prompt (here it's ) but the audio message saved is not saved correctly. I don't know why, any idea ?
phone.php
<?php
// accept both query string and post
$request = array_merge($_GET, $_POST);
error_log('got a call from: ' . $request['nexmo_caller_id']);
// make the XML short tag friendly
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<vxml version = "2.1">
<form>
<record name="message" beep="true" maxtime="60s" dtmfterm="true">
<audio src="./welcome.wav"/>
</record>
<catch event="connection.disconnect.hangup">
<submit next="./recphone.php" enctype="multipart/form-data" method="post"/>
</catch>
</form>
</vxml>
recphone.php
<?php
if(!isset($_FILES['message'])){
return; //not a post from our script
}
switch($_FILES['message']['error']){
case UPLOAD_ERR_OK:
move_uploaded_file($_FILES['message']['tmp_name'], './recordings/' . $_FILES['message']['name']);
$prompt = 'Thanks, your message has been saved.';
break;
default:
$prompt = 'Sorry, we could not save your message.';
}
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<vxml version="2.1">
<form>
<block>
<prompt><?php echo $prompt ?></prompt>
</block>
</form>
</vxml>
There is a problem with Nexmo when redirects calls to a VoiceXML document.
I finally decide to use Asterisk to create my IVR.
If someone landed here with the idea of creating its IVR, I wrote a tutorial on my GitHub : https://github.com/guillaumeteillet/ivr-guillaume-teillet