how to set call duration time limit in vxml

622 views Asked by At

Is there a way to set a time limit for a call duration within vxml? For example, if a caller orders a block of time (say 10 minutes), after 10 minutes, can a timer be added to the vxml script to then drop the call, or announce the call is ending? The primary function I am looking for and hopefully example, is the ability to set the time limit within vxml.

2

There are 2 answers

0
Kevin Junghans On

You cannot do it directly in VoiceXML but you can use the complimentary standard CCXML to achieve this. CCXML is event driven and can be setup as a state machine that transitions on events.

You can setup an event to timeout after a certain period.

 <transition state="'init'" event="connection.CONNECTION_CONNECTED" name="evt">
   <log expr="'ave liftoff.'"/>

   <dialogstart src="'gimme.vxml'" dialogid="theDialog"
               type="'application/xml+vxml;platform=motorola'"/>

   <assign name="state0" expr="'dialogActive'" />

   <send event="'timeout'" target="session.id" delay="'20000'" /> 
 </transition>

The dialogstart element starts the VoiceXML application. The CCXML continues to run in the background processing events. The send element sends an event back to the CCXML and by using the delay attribute you can set the time period. CCXML is based on web standards so you can dynamically create the XML document with the appropriate time period in the delay. When the event fires you will catch it in the CCXML and terminate the VoiceXML application.

<transition state="'dialogActive'" event="user.timeout">
   <log expr="'A timeout occured'" />
   <dialogterminate sessionid="theDialog" />
 </transition>
1
Jim Rush On

If the time limit is strict, Kevin's answer with CCXML is the best choice as it can interrupt the dialog. Otherwise, you could programmatically check at each form transition or field completion.