| VoiceXML 2.1 Development Guide | Home | Frameset Home |
|
<transfer> element will populate three shadow variables: name$.duration, name$.inputmode, and name$.utterance.
<transfer name="MyCall" dest="tel:+12223334444"
bridge="true" connecttimeout="20s" maxtime="60s">
...
<filled>
...
<prompt>
The length of the call was <value expr="MyCall$.duration"/> seconds.
</prompt>
</filled>
<transfer> shadow variables are only set if the called party hangs up, not if the caller hangs up. Getting the length of a call in that case requires
<var name="beginTimer" expr="new Date();"/>
<var name="endTimer"/>
<var name="callDuration"/>
<catch event="connection.disconnect.hangup">
<goto next="#timer"/>
</catch>
<form id="timer">
<block>
<assign name="beginTimer" expr="Number(beginTimer.getTime());"/>
<assign name="endTimer" expr="new Date();"/>
<assign name="endTimer" expr="Number(endTimer.getTime());"/>
<if cond="endTimer < beginTimer">
<assign name="callDuration" expr="0"/>
<else/>
<assign name="callDuration" expr="endTimer - beginTimer"/>
</if>
<log expr="'The length of the call was ' + callDuration / 1000 + ' seconds.'"/>
</block>
</form>
<transfer> hotwording, (see the next subsection for details), there are a few others that we can grab.
<transfer name="MyCall" dest="tel:+12223334444"
bridge="true" connecttimeout="20s" maxtime="60s">
<grammar type="application/x-gsl">(bye)</grammar>
<grammar type="application/x-gsl">(dtmf-1)</grammar>
...
<filled>
<prompt>
The length of the call was <value expr="MyCall$.duration"/>
The input mode of the call was <value expr="MyCall$.inputmode"/>
The utterance of the call was <value expr="MyCall$.utterance"/>
</prompt>
</filled>
| ANNOTATIONS: EXISTING POSTS |
| login |
|