VoiceXML Forum Community Message Board


Post New Topic  Post A Reply
my profile | register | search | faq | forum home
  next oldest topic   next newest topic
» VoiceXML Forum Community Message Board   » Newbies   » Failed to access transfer result

 - UBBFriend: Email this page to someone!    
Author Topic: Failed to access transfer result
Chris
Junior Member
Member # 3674

Rate Member
Icon 1 posted July 17, 2006 01:15 PM      Profile for Chris   Email Chris   Send New Private Message       Edit/Delete Post   Reply With Quote 
Hi,

Here is the code I used to transfer a caller(A) to a callee(C):
<var name="transferDuration" expr="'0'"/>
<transfer name="transfer_result" ....>
<catch event="connection.disconnect.hangup">
<!-- the caller hangs up: I have a trouble to get information from transfer_result because it is "undefine" which I don't why -->
<assign name="transferDuration" expr="transfer_result$.duration"/>
....
<submit .../>
</catch>
<filled>
<!-- the callee hangs up: transfer_result returns "far_end_disconnect" and I can the transfer duration from transfer_result. -->
<assign name="transferDuration" expr="transfer_result$.duration"/>
...
<submit .../><!-- submit to web server -->
</filled>
</transfer>

After the caller is successfully connected to the callee, there are two situations I need to deal with. One is that if the callee hangs up, I can get the transfer duration value from the "transfer_result" object. Another situation is that if the caller hangs up, NVP will throw "connection.disconnect.hangup" event. In this event handler I was trying to access the "transfer_result" object, but unfortunately it was "undefined".

So how can I get the transfer duration if the caller hangs up?

Any idea is greatly appreciated!

Chris

Posts: 5 | From: Canada | Registered: Jul 2006  |  IP: Logged
mheadd
Member
Member # 3181

Member Rated:
4
Icon 1 posted July 17, 2006 06:04 PM      Profile for mheadd   Author's Homepage   Email mheadd   Send New Private Message       Edit/Delete Post   Reply With Quote 
I think the reason that you are not able to determine the call length from the name$.duration shadow variable of the <transfer> element can be found in the VoiceXML 2.0 specification:

quote:

If the caller disconnects by hanging up (either during a call transfer or call transfer attempt), the connection to the callee (if one exists) is dropped, a connection.disconnect.hangup event will be thrown, and dialog execution will transition to a handler for the hangup event (if one exists). The form item variable, and thus shadow variables, will not be set.

Although you can't use this shadow variable when the caller hangs up, you might be able to use some JavaScript to do the same thing.

code:
... 
<var name="callLength" expr="0"/>
...

<script>
function get_difference(x,y) {
return x - y;
}
</script>
...

<form id="transfer">
<!-- Instantiate new date object to indicate start of call transfer -->
<block>
<var name="callStart" expr="new Date();"/>
</block>

<transfer name="transfer_result" ....>

<!-- Catch hangup event, if caller hangs up, and create another new date object for end of call -->
<catch event="connection.disconnect.hangup">
<var name="callEnd" expr="new Date();"/>
<!-- Call length is difference between call start and call end-->
<assign name="callLength" expr="get_difference(callEnd, callStart)"/>
<goto next="#submit"/>
</catch>

<filled>
<!-- If callee hangs up, get call length from shadow variable -->
<assign name="callLength" expr="transfer_result$.duration"/>
<goto next="#submit"/>
</filled>
</transfer>

</form>

<form id="submit">
<!-- Submit call length to server -->
<block>
<submit next="http://www.someurl.com" namelist="callLength"/>
</block>
</form>

Hope this helps.

--------------------
Mark
VoiceinGov.org
http://www.voiceingov.org

Posts: 55 | Registered: Jun 2005  |  IP: Logged
Chris
Junior Member
Member # 3674

Rate Member
Icon 1 posted July 18, 2006 11:36 AM      Profile for Chris   Email Chris   Send New Private Message       Edit/Delete Post   Reply With Quote 
Mark,

Thanks a lot.

For the caller's hangup scenario, the callStart value is the time when the transfer attempt gets started, so the callLength will include the ringing time. In this case the transfer duration is supposed to be from when the callee answers the call to when the caller hangs up. So, my further question is how I can detect when the callee answers the transferring call.

Regards,
Chris

Posts: 5 | From: Canada | Registered: Jul 2006  |  IP: Logged
mheadd
Member
Member # 3181

Member Rated:
4
Icon 1 posted July 18, 2006 02:00 PM      Profile for mheadd   Author's Homepage   Email mheadd   Send New Private Message       Edit/Delete Post   Reply With Quote 
Hmmm, since the form item variable is not set if the caller hangs up, I'm not sure you can use the <filled> element to set your initial date object.

I'm not aware of any specific event that gets tossed in VoiceXML when the call is answered, but there is an event in CCXML that might work nicely.

When making an outbound call in CCXML, the "connection.CONNECTION_CONNECTED" event is thrown when the call is answered. There is some great documentation on using CCXML avilable on the Voxeo website.
They also have a very low cost VoiceXML/CCXML platform available. Worth checking out.

Hope this helps.

[ July 18, 2006, 02:58 PM: Message edited by: mheadd ]

--------------------
Mark
VoiceinGov.org
http://www.voiceingov.org

Posts: 55 | Registered: Jun 2005  |  IP: Logged
Chris
Junior Member
Member # 3674

Rate Member
Icon 1 posted July 18, 2006 04:07 PM      Profile for Chris   Email Chris   Send New Private Message       Edit/Delete Post   Reply With Quote 
Mark,

It seems there is no such an event "connected" or "answered" when the callee picked up the call. It might be a good idea to use CCXML which is much powerful regarding call controls. Thanks for the referencing.

Regrads,
Chris

[ July 18, 2006, 04:08 PM: Message edited by: Chris ]

Posts: 5 | From: Canada | Registered: Jul 2006  |  IP: Logged


All times are Eastern  
Post New Topic  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | VoiceXML Forum



Powered by Infopop Corporation
UBB.classicTM 6.3.1.2