I'm looking to find out how to post a VM wav file after a person calls and leaves a message. I need the file to post a specific url. Anyone have ideas on how to do this?
Thanks
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Post VM wav file to url
IVR example for posting a voicemail
Hi,
Perhaps this IVR example might help:
leaverecording.php:
save.php:
From this IVR example, if the caller isn't able to reach Daniel's cell phone during the transfer, he is prompted to leave a voicemail recording. Once the recording is finished, the IVR submits the file to save.php, where it gets processed by SOX into a 8KHz .wav file and stored on the web server.
Regards,
Plum Support
Perhaps this IVR example might help:
leaverecording.php:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<property name="sensitivity" value="0.3"/>
<form id="xfer">
<var name="mydur" expr="0"/>
<block>
<prompt>
Hi. You've reached Daniel's 800 number. Trying his cell phone number. Please wait.
</prompt>
</block>
<transfer name="mycall" dest="tel:+1XXXXXXXXXX"
transferaudio="music.wav" connecttimeout="20s" bridge="true">
<prompt>
Say cancel to disconnect this call at any time.
</prompt>
<grammar src="cancel.grxml" type="application/srgs+xml"/>
<filled>
<assign name="mydur" expr="mycall$.duration"/>
<if cond="mycall == 'busy'">
<prompt>
Daniel's line is busy.
</prompt>
<elseif cond="mycall == 'noanswer'"/>
<prompt>
Daniel can't answer the phone now.
</prompt>
</if>
</filled>
</transfer>
<record name="msg" beep="true" maxtime="10s"
finalsilence="4000ms" dtmfterm="true" type="audio/x-wav">
<prompt timeout="5s">
Record a voicemail message after the beep.
</prompt>
<noinput>
I didn't hear anything, please try again.
</noinput>
</record>
<field name="confirm">
<grammar>
Yes|No
</grammar>
<prompt>
Your message is <audio expr="msg"/>.
</prompt>
<prompt>
To keep it, say yes. To discard it, say no.
</prompt>
<filled>
<if cond="confirm=='Yes'">
<submit next="http://example.com/~daniel/save.php" namelist="msg" method="post"/>
</if>
<clear/>
</filled>
</field>
</form>
</vxml>
Code: Select all
<?php
echo "<?xml version=\"1.0\" encoding=\"latin-1\"?>";
?>
<vxml version="2.0">
<form id="greeting">
<block>
<?php
if (isset($_FILES['msg'])) {
echo "<exit/>\n";
}
if (isset($_FILES['msg']) && is_uploaded_file($_FILES['msg']['tmp_name'])) {
move_uploaded_file($_FILES['msg']['tmp_name'],"temp.ul");
$timestamp = time();
$cmdline = `/usr/local/bin/sox -t ul -r 8000 temp.ul $timestamp.wav`;
unlink("temp.ul");
echo "<exit/>\n";
} else {
echo "<exit/>\n";
}
?>
</block>
</form>
</vxml>
Regards,
Plum Support
Last edited by support on Thu Jan 07, 2010 7:18 pm, edited 5 times in total.
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com
Still having issues
Hello, I'm still having issues, but maybe it's a larger picture issue. Here's the complete picture:
All I am trying to create a script to handle the follwoing use cases:
- i have a list of grammar items where each item is tagged with 2 attrbutes:
item: mary had a little lamb
tag: type = animal
tag: name = mary
- I want to match a caller's utterance against the grammar items and in my submission, post
- tag type
- tag name
- callerid
- sessionid
- recorded utterance
So far so simple. I can accomplish this by using a field tag etc.
Here come the problematic requirements:
- if a user hangs up right after the first utterance
- if there is a grammar match, post as described above
- if there is no grammar match, post only the recording, sessionid and callerid (i'll do some backend work on the audio)
if there is no input or match 2 times, reprompt, then
- if there is no match for the 3rd time, post the recording, session id and callerid
- if there is no input for the third time, post the sessionid and callerid
Below are my two attempts to get this dialed in, but I seem unable to satisfy all requirements.
Can you help me capture the recording in the case of a nonmatch -- then the first attempt would work.
Otherwise, I need help using <record> with a <grammar>.
Thanks
I first tried this by using a form/field which worked great except in a nomatch there is no recording queued and thus can not be posted.
<form>
<field>
<catch>
<!-- to catch a hangup without a match -->
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="sessionid callerid" next="http://my.server.com/plumvoice/hangup.php"/>
</catch>
<grammar>
// grammer items here
</grammar>
<prompt>
<noinput>
Sorry, I did not hear you.
<reprompt/>
</noinput>
<nomatch>
Sorry, I did not understand you.
<reprompt/>
</nomatch>
<noinput count="3">
OK thanks - good bye.
<!-- This disconnect fires the catch above -->
<disconnect/>
</noinput>
<nomatch count="3">
OK thanks - good bye.
<!-- This disconnect fires the catch above - however, there is no recording! -->
<disconnect/>
</nomatch>
<filled> <!-- filled means there was a grammar match, fall through to next field and submit -->
</filled>
</field>
<field name="confirm">
<!-- this traps a hangup after a match -->
<catch event="connection.disconnect.hangup">
<assign name="recording" expr="word$.recording"/>
<assign name="type" expr="word.type"/>
<assign name="name" expr="word.name"/>
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="callerid sessionid recording name type" next="http://my.server.com/plumvoice/response.php" method="post" enctype="multipart/form-data"/>
</catch>
<block> <!-- the user hears the thank you, -->
Thank you
<assign name="recording" expr="word$.recording"/>
<assign name="type" expr="word.type"/>
<assign name="name" expr="word.name"/>
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="callerid sessionid recording name type" next="http://my.server.com/plumvoice/response.php" method="post" enctype="multipart/form-data"/>
</block>
</field>
So then I thought to get smart and use the <record> tag - especially since the documentation seems to indicate that the recorded utterance would be matched against grammar.
However - this completely does not work there appears to be zero grammar matching and the script falls through to filled, thanks me and posts the unmatched audio.
<vxml version="2.0">
<property name="sensitivity" value="0.7"/>
<property name="recordutterance" value="true"/>
<form id="one">
<record name="word" maxtime="5s" modal="false" type="audio/x-wav">
<grammar type="application/srgs+xml" root="ROOT" mode="voice">
// grammer items here
</grammar>
<!-- if the user hangs up after the first utterance, catch and post the recording -->
<!-- this does NOT appear to do a grammar match - the post does
not contain word.campaginid or word.name -->
<catch event="connection.disconnect.hangup">
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<assign name="type" expr="word.type"/>
<assign name="name" expr="word.name"/>
<submit namelist="callerid sessionid word name type" next="http://my.server.com/plumvoice/response.php" method="post" enctype="multipart/form-data"/>
</catch>
<prompt bargein="true" timeout="5s">
<audio src="http://my.server.com/plumvoice/sonar3.wav">ping</audio>
</prompt>
<noinput>
<clear namelist="word"/>
Please try again.
<reprompt/>
</noinput>
<nomatch>
<clear namelist="word"/>
Please try again.
<reprompt/>
</nomatch>
<nomatch count="2">
<clear namelist="word"/>
Please try again.
<reprompt/>
</nomatch>
<noinput count="3">
<clear namelist="word"/>
Thank you.
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="callerid sessionid" next="http://my.server.com/plumvoice/hangup.php" method="post" enctype="multipart/form-data"/>
</noinput>
<filled>
Thank you.
<assign name="type" expr="word.type"/>
<assign name="name" expr="word.name"/>
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="callerid sessionid word name type" next="http://my.server.com/plumvoice/response.php" method="post" enctype="multipart/form-data"/>
</filled>
</record>
</form>
</vxml>
All I am trying to create a script to handle the follwoing use cases:
- i have a list of grammar items where each item is tagged with 2 attrbutes:
item: mary had a little lamb
tag: type = animal
tag: name = mary
- I want to match a caller's utterance against the grammar items and in my submission, post
- tag type
- tag name
- callerid
- sessionid
- recorded utterance
So far so simple. I can accomplish this by using a field tag etc.
Here come the problematic requirements:
- if a user hangs up right after the first utterance
- if there is a grammar match, post as described above
- if there is no grammar match, post only the recording, sessionid and callerid (i'll do some backend work on the audio)
if there is no input or match 2 times, reprompt, then
- if there is no match for the 3rd time, post the recording, session id and callerid
- if there is no input for the third time, post the sessionid and callerid
Below are my two attempts to get this dialed in, but I seem unable to satisfy all requirements.
Can you help me capture the recording in the case of a nonmatch -- then the first attempt would work.
Otherwise, I need help using <record> with a <grammar>.
Thanks
I first tried this by using a form/field which worked great except in a nomatch there is no recording queued and thus can not be posted.
<form>
<field>
<catch>
<!-- to catch a hangup without a match -->
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="sessionid callerid" next="http://my.server.com/plumvoice/hangup.php"/>
</catch>
<grammar>
// grammer items here
</grammar>
<prompt>
<noinput>
Sorry, I did not hear you.
<reprompt/>
</noinput>
<nomatch>
Sorry, I did not understand you.
<reprompt/>
</nomatch>
<noinput count="3">
OK thanks - good bye.
<!-- This disconnect fires the catch above -->
<disconnect/>
</noinput>
<nomatch count="3">
OK thanks - good bye.
<!-- This disconnect fires the catch above - however, there is no recording! -->
<disconnect/>
</nomatch>
<filled> <!-- filled means there was a grammar match, fall through to next field and submit -->
</filled>
</field>
<field name="confirm">
<!-- this traps a hangup after a match -->
<catch event="connection.disconnect.hangup">
<assign name="recording" expr="word$.recording"/>
<assign name="type" expr="word.type"/>
<assign name="name" expr="word.name"/>
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="callerid sessionid recording name type" next="http://my.server.com/plumvoice/response.php" method="post" enctype="multipart/form-data"/>
</catch>
<block> <!-- the user hears the thank you, -->
Thank you
<assign name="recording" expr="word$.recording"/>
<assign name="type" expr="word.type"/>
<assign name="name" expr="word.name"/>
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="callerid sessionid recording name type" next="http://my.server.com/plumvoice/response.php" method="post" enctype="multipart/form-data"/>
</block>
</field>
So then I thought to get smart and use the <record> tag - especially since the documentation seems to indicate that the recorded utterance would be matched against grammar.
However - this completely does not work there appears to be zero grammar matching and the script falls through to filled, thanks me and posts the unmatched audio.
<vxml version="2.0">
<property name="sensitivity" value="0.7"/>
<property name="recordutterance" value="true"/>
<form id="one">
<record name="word" maxtime="5s" modal="false" type="audio/x-wav">
<grammar type="application/srgs+xml" root="ROOT" mode="voice">
// grammer items here
</grammar>
<!-- if the user hangs up after the first utterance, catch and post the recording -->
<!-- this does NOT appear to do a grammar match - the post does
not contain word.campaginid or word.name -->
<catch event="connection.disconnect.hangup">
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<assign name="type" expr="word.type"/>
<assign name="name" expr="word.name"/>
<submit namelist="callerid sessionid word name type" next="http://my.server.com/plumvoice/response.php" method="post" enctype="multipart/form-data"/>
</catch>
<prompt bargein="true" timeout="5s">
<audio src="http://my.server.com/plumvoice/sonar3.wav">ping</audio>
</prompt>
<noinput>
<clear namelist="word"/>
Please try again.
<reprompt/>
</noinput>
<nomatch>
<clear namelist="word"/>
Please try again.
<reprompt/>
</nomatch>
<nomatch count="2">
<clear namelist="word"/>
Please try again.
<reprompt/>
</nomatch>
<noinput count="3">
<clear namelist="word"/>
Thank you.
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="callerid sessionid" next="http://my.server.com/plumvoice/hangup.php" method="post" enctype="multipart/form-data"/>
</noinput>
<filled>
Thank you.
<assign name="type" expr="word.type"/>
<assign name="name" expr="word.name"/>
<assign name="callerid" expr="session.telephone.ani"/>
<assign name="sessionid" expr="session.id"/>
<submit namelist="callerid sessionid word name type" next="http://my.server.com/plumvoice/response.php" method="post" enctype="multipart/form-data"/>
</filled>
</record>
</form>
</vxml>
IVR link on how to implement a recording
Hi,
About your IVR code, when you have that nomatch, you wouldn't be able to capture an utterance because there was no match for your IVR grammar.
However, you can do a record to record what the user is saying after your 3rd nomatch. This would allow you to record what the user is saying to attempt to match the IVR grammar and then post this recording (in "audio/basic" format: headerless u-law data).
An IVR example of how you would implement this recording can be found here: http://support.plumvoice.com/viewtopic.php?t=1333
Lastly, for your own knowledge, the IVR property, "recordutterance", and its shadow variable, "recording", can only be used when there is an IVR grammar recognition. You would not be able to use this for when there is a nomatch.
Regards,
Plum Support
About your IVR code, when you have that nomatch, you wouldn't be able to capture an utterance because there was no match for your IVR grammar.
However, you can do a record to record what the user is saying after your 3rd nomatch. This would allow you to record what the user is saying to attempt to match the IVR grammar and then post this recording (in "audio/basic" format: headerless u-law data).
An IVR example of how you would implement this recording can be found here: http://support.plumvoice.com/viewtopic.php?t=1333
Lastly, for your own knowledge, the IVR property, "recordutterance", and its shadow variable, "recording", can only be used when there is an IVR grammar recognition. You would not be able to use this for when there is a nomatch.
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com