Page 1 of 1

Record maxtime calculation and assignment

Posted: Tue Nov 24, 2009 9:17 am
by aliasg
Hi,

I need to calculate and assign maxtime of the record before user could actually record a message. I am using following code to achieve this but its not working.

Code: Select all


<?xml version="1.0"?>
<vxml version="2.0">
<var name="prevAuthorizedMins" expr="5" /> 
 <var name="mrt" expr="prevAuthorizedMins  * 60 + 's'" /> 
<form>  
    <record name="userrecording" maxtime="mrt" finalsilence="30s" dtmfterm="true" beep="true" type="audio/x-wav">       
      <prompt bargein="false"> 
        Please start recording up to <value expr="mrt" />
      </prompt> 
</record>
</form>
</vxml>     
variable "mrt" is correctly calculated equal to 300s But there is error in call logs saying that

PropertyList::ConvertTimeToMilliseconds - Invalid format "mrt".

I have just assigned prevAuthorizedMins=5 for demo purpose otherwise this 5 is printed from server code snippet of asp.net.

Can anybody please suggest what wrong I m doing.

Regards,

IVR example for "maxtime" attribute

Posted: Tue Nov 24, 2009 3:11 pm
by support
Hi,

The maxtime="mrt" does not work. It is expecting a string of time like "300s". Although you may be tempted to use a <value name="mrt"/> there, that itself would not work. Instead, you would want to echo a variable into the IVR <record> attribute, maxtime, from your IVR application server.

Code: Select all

<?php
echo "<?xml version=\"1.0\"?>\n";

$prevAuthorizedMins = 5;
$mrt = $prevAuthorizedMins * 60;
?>

<vxml version="2.0">
  <form> 
    <record name="userrecording" maxtime="<?php echo $mrt ?>s" finalsilence="30s" dtmfterm="true" beep="true" type="audio/x-wav">       
      <prompt bargein="false">
        Please start recording up to <?php echo $mrt ?> seconds.
      </prompt>
    </record>
  </form>
</vxml>
Regards,
Plum Support

Posted: Thu Nov 26, 2009 12:26 am
by aliasg
I can't print it from server every time. This variable is retrieved from server using sub dialog several time on this page.

IVR example for "maxtime" for ASP code

Posted: Mon Nov 30, 2009 10:10 am
by support
Hi,

The problem with your initial IVR code is that maxtime cannot be set to a variable within the IVR <record> attribute. It has to be set as a time like "300s" or "180s". Instead, you would have to set up your variable, mrt, first on the IVR server script side and then "write" it into the VoiceXML with your IVR server script language (php, asp, etc.). The following is an IVR example that could be used for ASP.

maxtime.aspx:

Code: Select all

<%Response.ContentType = "text/xml"%>
<?xml version="1.0"?>

<%

//determine prevAuthorizedMins from your database 

prevAuthorizedMins = 5; //for demo purposes
mrt = prevAuthorizedMins * 60; //calculates number of seconds for maxtime
%>

<vxml version="2.0">
  <form>
    <record name="userrecording" maxtime="<%Response.Write(mrt)%>s" finalsilence="30s" dtmfterm="true" beep="true" type="audio/x-wav">       
      <prompt bargein="false">
        Please start recording up to <%Response.Write(mrt)%> seconds.
      </prompt>
    </record>
  </form>
</vxml>  
Hope this helps.

Regards,
Plum Support

Posted: Tue Dec 01, 2009 4:44 am
by aliasg
Thanks for the reply but that didn't solved my problem.

Infact both of your reply meant the same that maxtime can't be set to a variable thats what I complaint for. :) I needed it that way. Now I have to change my app design to cover this deficiency. But now I am facing another problem.

I am using

Code: Select all

<record name="userrecording" maxtime="3600s" finalsilence="30s" dtmfterm="true" beep="true" type="audio/x-wav">
for one hour recording. Maxtime doesn't seems to be applying and recording is terminated after one min only. When I tried this tag in scratch pad, it continue to record as expected. Now I am wondering if there is any limit of max record time when documented fetched from remote URL or for developer account or is there any other problem?


To reproduce make a load the document from remote URL. With scratch pad it just works fine.

IVR example for testing recording maxtime

Posted: Tue Dec 01, 2009 12:06 pm
by support
Hi,

We haven't been able to reproduce this IVR issue that you have described.

Here is the IVR code for using the IVR tag, record for our remote URL:

recordtest.php

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
  <form>
    <record name="userrecording" maxtime="3600s" finalsilence="30s" dtmfterm="true" beep="true" type="audio/x-wav"> 
      <prompt>
        Please record a message after the beep.
      </prompt>
      <filled>
        You just recorded the following message:
        <value expr="userrecording"/>.
      </filled>
    </record>
  </form>
</vxml>
Have you been able to reliably reproduce this IVR issue on your IVR developer account?

Regards,
Plum Support

Yes.

Posted: Thu Dec 03, 2009 5:07 am
by aliasg
Yes, infact this is the only glitch left in my issue log.

Here is code in a .aspx page.

Code: Select all

<record name="userrecording" maxtime="<%=Maxtime * 60 %>s" finalsilence="30s" dtmfterm="true" beep="true" type="audio/x-wav">
Following is its output from call log. see maxtime=3600s


Code: Select all

<record name="userrecording" maxtime="3600s" finalsilence="30s" dtmfterm="true" beep="true" type="audio/x-wav">
Here is the call log. Check the time difference.


  • Thu 03 Dec 2009 10:02:36 AM UTC:
    starting playback: bargein=false, inputmodes="dtmf speech"
    Newly queued prompts are now being played
    bargein set to true
    Cache Miss: file:///usr/local/plumvp/resources/beep.ulaw
    Attempting to fetch file:///usr/local/plumvp/resources/beep.ulaw
    Audio segment from the URL resources/beep.ulaw added to prompt queue
    VXI::record_element - activating grammars for form = 'frmRecordVoice' formitem = 'userrecording'
    PromptManager::Play()

    Thu 03 Dec 2009 10:02:41 AM UTC:
    starting playback: bargein=true, inputmodes="dtmf speech"
    Newly queued prompts are now being played

    Thu 03 Dec 2009 10:04:04 AM UTC:
    VXI::assign_element(name="InvalidTry" expr = "0")
    VXI::assign_element(name="document.varRecordedVoice" expr = "userrecording")
    VXI::assign_element(name="document.AudioDuration" expr = "userrecording$.duration")
Reproducibility:EveryTime, recorded voice is continuous till end so no final silence as well.

Error seen in IVR call logs

Posted: Thu Dec 03, 2009 11:36 am
by support
Hi,

When checking through your IVR call logs, we noticed the following:

Code: Select all

<record name="userrecording" maxtime="-60s" finalsilence="30s" dtmfterm="true" beep="true" type="audio/x-wav">
Your maxtime still appears to be written incorrectly into your IVR code. This may the reason why your IVR recordings are ended after only a minute.

Regards,
Plum Support