This document was generated from CDN thread
Created by: Yuibi Fujimoto on 29-05-2013 04:04:34 PM
I created a custom CVP element which telnets into 4 different VXML gateways, executes a command (show call active media compact), filters the output, and stores the result in a database.
The problem is when 1 of the gateways is unreachable or down, the element waits for telnet to time out, which is about 20 seconds. When this happens, callers just hear silence for 20 seconds until the call goes to the next audio element.
I wrote this custom Java class in order to find active ASR sessions on all VXML gateways so that I can report on ASR license utilization later.
I'm wondering if anyone knows how to set up connection timeout for telnet or the custom element itself.
Subject: RE: Setting Connect Timetout for Custom Element
Replied by: Edward Umansky on 05-06-2013 04:20:11 PM
That depends entirely on how your customization is connecting. Whatever telnet or TCP library you are using to connect would need to support some kind of timeout.
Subject: RE: Setting Connect Timetout for Custom Element
Replied by: Yuibi Fujimoto on 05-06-2013 05:26:22 PM
I'm using "org.apache.commons.net.telnet.TelnetClient".
I've tried "telnet.setConnectTimeout(200)", but the VXML application doesn't seem to care. It still waits for 20 seconds without any sound when a VXML gateway is unreachable or down.
What's strange is I can run the exact same code on my local Eclipse, and it times out after 0.2 seconds with the following message:
java.net.SocketTimeoutException: connect timed out: connect timed out
I don't see any errors on CVP side.
Subject: RE: Setting Connect Timetout for Custom Element
Replied by: Edward Umansky on 05-06-2013 05:54:11 PM
You'll need to research and debug this from the perspective of whatever telnet library you are using. Timeout settings can be tricky sometimes, changing depending on what type of disconnect you are simulating and what environment or OS you are running in.
Subject: RE: Setting Connect Timetout for Custom Element
Replied by: Yuibi Fujimoto on 06-06-2013 11:12:46 AM
I actually spent quite some time trying to get the timeout to work for telnet on CVP, but couldn't figure it out.
Is there a way to set timeout on the custom element itself instead or have the custom code run in the background? That way, the call won't be affected when a gateway is unreachable.
If I can set the timeout on the custom element, I can create 4 separate custom elements, each of which tries to telnet to a different VXML gateway, and times out if it doesn't respond within 1 second.
Subject: RE: Setting Connect Timetout for Custom Element
Replied by: Edward Umansky on 06-06-2013 04:08:25 PM
By default, if you use an action element the CVP gateway will continue processing subsequent audio files while a server-side custom action element is running, unless you need some data from that element to continue. Other than that the custom elements essentially run single-threaded from the developers perspective, so you would need to manually create multi-threaded behavior if you wanted to run it in the background and optionally timeout the thread.
Subject: RE: Setting Connect Timetout for Custom Element
Replied by: Yuibi Fujimoto on 18-06-2013 10:00:24 AM
Since I couldn't get the timeout to work using custom Java class, I ended up creating a SOAP web service.
On Call Studio, I set "Connect Timeout" to 1 on each Web Service element, so in case one of the VXML gateways is unreachable, it times out in 1 second.
Everything is working as expected now.