We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Scheduler to update sever after specific time interval.

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
aliasg
Posts: 24
Joined: Sat Mar 14, 2009 1:23 am

Scheduler to update sever after specific time interval.

Post by aliasg »

Hi,

I need to schedule and repeat database update call while listening to long recording. ie If user starts listening a long recording, I want that time to be continuously deducted during the call and my Backend database updated after every 1 min asynchronously. So possibly there will be a timer running along with recording playback, and after every one minute passed, that timer will generate a server call back asynchronously.

I am not sure if it is possible. If it is, please help me with some code example. May be a timer in javascript and ajax could help doing this.

Thanks in advance.
Ali

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR platform limitations

Post by support »

Hello,

Unfortunately there is no way to do what you are describing with the IVR. VoiceXML does not provide an asynchronous event loop that you are used to in HTML. The features you are describing (setTimeout(), setInterval(), XMLHttpRequest()) are all features of the Javascript<->DOM bridge that is provided in modern web browsers. These features are extensions to the Javascript runtime that are created by the web browser. VoiceXML does not provide any of these features and is unlikely to do so due to the synchronous nature of the language. With HTML once the page is being display there is a main event loop that is running continuously that supports the functions mentioned above. With VoiceXML the IVR system is already busy dealing with telephony events such as Speech, DTMF or waiting for playback to complete.

Perhaps we can suggest an alternate solution to what you are trying to accomplish. What, in the end, is the problem you are trying to solve by making these asynchronous requests?

Regards,
Plum Support
Last edited by support on Wed Feb 24, 2010 11:40 am, edited 2 times in total.

aliasg
Posts: 24
Joined: Sat Mar 14, 2009 1:23 am

Post by aliasg »

Thanks for reply.

I already feared that it is not possible.

Anyway, Following is the scenario I am trying to develop solution for.

My users log in using card and pin number. Each card has a specific time value that is continuously deducted during IVR call(not at the end of call). IVR also plays long recordings so there is chance that user doesn't generate input for maximum of an hour.


So the solution I initially thought, was to run a java script timer that after each minute will generate a AJAX call to update db, while user listens to the recording.

I don't know what else way this can be achieved. Any ideas are welcome.
Ali

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR example for posting variables

Post by support »

Hi,

We're still a bit unclear about what you're looking for, but here's an IVR example that uses the IVR tag, <submit> for POSTing a variable that could help you implement what you're looking for:

loginpage.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">

<form>
  <field name="customerid" type="digits">
      <prompt>
        Please enter your customer identification number using your keypad.
      </prompt>
  </field>

  <field name="age" type="digits?minlength=1;maxlength=2">
      <prompt>
        Please enter your age using your keypad.
      </prompt>
  </field>

  <block>
    <prompt>
      Please wait while we process your information.
    </prompt>
    <submit namelist="customerid age" next="timerecordings.php" method="post"/>
  </block>
</form>

</vxml>
timerecordings.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");

$customerid = $_POST[customerid]; //the login information used to determine time to allot to the user
$age = $_POST[age]; //the login information used to determine time to allot to the user

//from here, you will determine the time you want to allot your user (through your database) before performing an action such as playing a recording 

$maxtime = 5; //the number of seconds determined from your database such as 10 or 20
?>

<vxml version="2.0">
  <form>
    <block>
      <prompt> Here is the recording you will listen to </prompt>
      <audio src="storytime.wav" maxtime="<?php echo($maxtime)?>s">
        If you hear TTS, then the audio file could not be retrieved.
      </audio>
    </block>

    <record name="userrecording" maxtime="<?php echo($maxtime)?>s">
      <prompt> Please say your recording. </prompt>
      <filled>
        You recorded <value expr="userrecording"/>.
      </filled>
    </record>
  </form>
</vxml>
From this IVR example, loginpage.php takes in all the login information from the user such as their "customerid" and "age". This information is passed on to timerecordings.php, which takes in that login information (and would go into your database to figure out the time that you want to allot to the user). For simplicity of this IVR example, we have assigned "5" as the number of seconds for $maxtime. In timerecordings.php, we are then able to set a maxtime for the user to listen to a recording (maxtime="<?php echo($maxtime)?>s") or set a maxtime for the user to record a message.

Hope this helps.

Regards,
Plum Support
Last edited by support on Wed Feb 24, 2010 11:41 am, edited 6 times in total.

aliasg
Posts: 24
Joined: Sat Mar 14, 2009 1:23 am

Post by aliasg »

I just noticed, a call from ivr to our server after error.badfetch timesout everytime.
i.e

Get disconnected after an error.badfetch error,
Redial immediately, the first call from ivr to our server times out everytime. If i redial after a mins or so, it works.
Ali

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR call log?

Post by support »

Hi,

Could you provide us with the IVR code you are using and the IVR call log of where you see this IVR issue happening?

Regards,
Plum Support

Post Reply