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

How do I time how long it takes to get a response -Stopwatch

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
Paul
Posts: 1
Joined: Wed Jan 21, 2004 8:33 am

How do I time how long it takes to get a response -Stopwatch

Post by Paul »


How do I time how long it takes to get a response to a request from the client browser perspective? In other words, I need to setup a stopwatch in the vxml page such that it starts a timer just before posting a request and stop the timer when the back-end sent it's response. An added complexity is that the request is made from one vxml page and the response is received on another.

Any advice would be appreciated.

Thanks,

Code: Select all


[request.vxml]
<vxml version="2.0" application="../dialogs/demo.vxml"> 
   <form id="service">
     <block> 
        <log label="STOPWATCH">Start timer before submit </log>   
         < ... >
          <submit next="../jsp/DoSomeWork.jsp"  namelist="parm1 parm2"  />       
     </block>  
  </form>
</vxml>

[response.vxml]
<vxml version="2.0" application="../dialogs/demo.vxml"> 
   <form id="service">
     <block> 
        <log label="STOPWATCH">Stop timer</log>   
     </block>  
  </form>
</vxml>

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

Creating a pseudo stopwatch in IVR VXML

Post by support »

Interesting question you've posed, Paul!

Here is how you might go about creating a stopwatch:
The premise behind the algorithm is that you store each timestamp in an HTTP variable (POST or GET).

Step 1: determine the current time stamp in your vxml script:

Step 2: submit this timestamp to a server side page

Step 3: when the server side page reads the time stamp from the POST variable, you have 2 options at this point (option A or B):

OPTION A
----------
render the vxml document from your server side doc get the current time, then find the difference between the current time. you now have the total amount of time it took to receive the request, process it, and create the return document.

Drawbacks to this method:
Assumes that you ignore the time it takes to send the vxml back to the IVR. for small documents this is not a problem, but if you are generating very long VXML documents or your connection between the web server and the IVR is slow, this will be wildly inaccurate.

Advantages to this method:
Its extremely easy to implement, with very little processing overhead.


OPTION B
------------

after rendering the vxml doc in the server side script, grab the current time stamp, and take the difference between the current time, and the timestamp you generated in the vxml document. This represents the time it took to to send the contenbt from the vxml to server, including prcessing and generating the return document. (This is pretty much the same as what we do in option A). Now we need to time sending the page back to the IVR. This will require an additional step, where we grab the current time from the vxml script when it executes, and substract the timestamp generated in the server side doc from the current time. This will yield the return trip time. when we add the return trip time to the send time, you now have the roundtrip time.

Advantages to this method:
*provides round trip time, which is more accurate for large voiceXML documents or slow connections between the IVR and the application server..


Disadvantages of this method:
*Conceptually more complicated than the algorithm described in Option A
*For very small vxml pages, you are measuring the overheard of processing/executing the documents rather than measuring the return time.


This post is meant to serve as a rough outline of how you would go about implementing this functionality and doesnt get into any low level implementation details such as grabbing the current time in javascript, or any of the page generation code that shows how to construct this framework. If you need clarification on any of the above listed points feel free to reply with questions :)

Hope this helps!

Plum Support.

Post Reply