<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>RE: Setting Connect Timetout for Custom Element</title>
  <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_recent_posts?p_l_id=" />
  <subtitle>RE: Setting Connect Timetout for Custom Element</subtitle>
  <id>http://developer.cisco.com/c/message_boards/find_recent_posts?p_l_id=</id>
  <updated>2013-06-19T22:39:22Z</updated>
  <dc:date>2013-06-19T22:39:22Z</dc:date>
  <entry>
    <title>RE: APPLICATION HANGUP - The error was: Another thread is currently working</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16363858" />
    <author>
      <name>Pedro Rego</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16363858</id>
    <updated>2013-06-19T20:13:15Z</updated>
    <published>2013-06-19T20:13:15Z</published>
    <summary type="html">Janine,
I will follow your command an post the result.
Thank You.</summary>
    <dc:creator>Pedro Rego</dc:creator>
    <dc:date>2013-06-19T20:13:15Z</dc:date>
  </entry>
  <entry>
    <title>Re: New Message from Pedro Rego in Customer Voice Portal (CVP) - General Di</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16320444" />
    <author>
      <name>Janine Graves</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16320444</id>
    <updated>2013-06-18T21:06:41Z</updated>
    <published>2013-06-18T21:06:41Z</published>
    <summary type="html">Pedro,
Can you turn on logging on the VXML gateway and see if you can determine 
the problem?
"term mon" followed by "debug http client error"</summary>
    <dc:creator>Janine Graves</dc:creator>
    <dc:date>2013-06-18T21:06:41Z</dc:date>
  </entry>
  <entry>
    <title>RE: Setting Connect Timetout for Custom Element</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16305315" />
    <author>
      <name>Yuibi Fujimoto</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16305315</id>
    <updated>2013-06-18T15:00:24Z</updated>
    <published>2013-06-18T15:00:24Z</published>
    <summary type="html">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.</summary>
    <dc:creator>Yuibi Fujimoto</dc:creator>
    <dc:date>2013-06-18T15:00:24Z</dc:date>
  </entry>
  <entry>
    <title>RE: CVP Database Action Element</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16305220" />
    <author>
      <name>Gerard O&amp;#039;Rourke</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16305220</id>
    <updated>2013-06-18T14:51:13Z</updated>
    <published>2013-06-18T14:51:13Z</published>
    <summary type="html">Thanks Janine,

I knew it was something simple! 
Thanks very much, I and I am sure others very much appreciate all the effort you put into into helping us out in this forum.
Gerry</summary>
    <dc:creator>Gerard O&amp;#039;Rourke</dc:creator>
    <dc:date>2013-06-18T14:51:13Z</dc:date>
  </entry>
  <entry>
    <title>RE: CVP Database Action Element</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16306067" />
    <author>
      <name>Janine Graves</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16306067</id>
    <updated>2013-06-18T14:12:00Z</updated>
    <published>2013-06-18T14:12:00Z</published>
    <summary type="html">[quote=Gerard O&amp;#039;Rourke]Janine,

Using your code above, I get a error on "import com.audium.server.action.database.DatabaseAction;"
See attached.
Any ideas why? The framework.jar is included in my java build path.

CVP 9.0.1 is the CVP Studio version.
Any help much appreciated.

Gerry

[img]http://orourke.tv/uploads/error.png[/img]
Gerry[/quote]
Hi Gerry,

My guess is that you don't have elements.jar in your classpath. It's only needed for a few things (like extending the Studio Database element).
You'll add it to the Java Project under Project/Properties/Java Build Path / Libraries / Add External Jar - 
elements.jar is located in the Studio Debugger directory C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.debug.runtime_9.0.1-SNAPSHOT\AUDIUM_HOME\common\lib\elements.jar
[img][/img]
[img][/img]</summary>
    <dc:creator>Janine Graves</dc:creator>
    <dc:date>2013-06-18T14:12:00Z</dc:date>
  </entry>
  <entry>
    <title>RE: CVP Database Action Element</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16304022" />
    <author>
      <name>Gerard O&amp;#039;Rourke</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16304022</id>
    <updated>2013-06-18T13:56:03Z</updated>
    <published>2013-06-18T13:56:03Z</published>
    <summary type="html">Janine,

Using your code above, I get a error on "import com.audium.server.action.database.DatabaseAction;"
See attached.
Any ideas why? The framework.jar is included in my java build path.

CVP 9.0.1 is the CVP Studio version.
Any help much appreciated.

Gerry

[img]http://orourke.tv/uploads/error.png[/img]
Gerry</summary>
    <dc:creator>Gerard O&amp;#039;Rourke</dc:creator>
    <dc:date>2013-06-18T13:56:03Z</dc:date>
  </entry>
  <entry>
    <title>APPLICATION HANGUP - The error was: Another thread is currently working on</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16302753" />
    <author>
      <name>Pedro Rego</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16302753</id>
    <updated>2013-06-18T13:21:41Z</updated>
    <published>2013-06-18T13:21:41Z</published>
    <summary type="html">No matter where on the part of application, the issue after look like the time after the consultation.I use the best pratices and use fetchtimeout globally and other ways like a sleep element. But i have first error 404. Sometimes after 404 its noticed a error.badfetch if i catch the event and go back to original point perhaps.The big issue is happens on all application and is humanly impossible execute a i try catch all possibilities of ways.

CALL1
10.42.19.18.1371503754671.343.Sac_N1_v2,06/17/2013 18:16:05.968,AUDIO_Transferencia,enter,
10.42.19.18.1371503754671.343.Sac_N1_v2,06/17/2013 18:16:05.970,AUDIO_Transferencia,interaction,audio_group,initial_audio_group
10.42.19.18.1371503754671.343.Sac_N1_v2,06/17/2013 18:16:05.968,AUDIO_Transferencia,element,hotevent,erro 404
10.42.19.18.1371503754671.343.Sac_N1_v2,06/17/2013 18:16:05.968,AUDIO_Transferencia,exit,

CALL2
10.42.19.18.1371503909890.344.Sac_N1_v2,06/17/2013 18:18:47.640,Copy_of_Sleep_01,enter,
10.42.19.18.1371503909890.344.Sac_N1_v2,06/17/2013 18:18:47.640,Copy_of_Sleep_01,interaction,audio_group,initial_audio_group
10.42.19.18.1371503909890.344.Sac_N1_v2,06/17/2013 18:18:48.765,Copy_of_Sleep_01,element,hotevent,erro 404


On Erro Log is noticed

10.42.19.18.1371503909890.344.Sac_N1_v2,06/17/2013 18:18:57.640, The error was: Another thread is currently working on this session.  This means the original thread took too long to complete what it was doing.  To prevent abnormal behaviour the original thread will exit immediately.  The call should not be affected.
com.audium.server.MultipleThreadException: Another thread is currently working on this session.  This means the original thread took too long to complete what it was doing.  To prevent abnormal behaviour the original thread will exit immediately.  The call should not be affected.
 at com.audium.server.session.ControllerData.isCurrentThreadOwner(ControllerData.java:4163)
 at com.audium.server.voiceElement.ActionElementBase.service(ActionElementBase.java:392)
 at com.audium.server.controller.Controller.goToAction(Controller.java:2959)
 at com.audium.server.controller.Controller.goToElement(Controller.java:2691)
 at com.audium.server.controller.Controller.continueCall(Controller.java:2511)
 at com.audium.server.controller.Controller.goToElement(Controller.java:2742)
 at com.audium.server.controller.Controller.continueCall(Controller.java:2511)
 at com.audium.server.controller.Controller.goToElement(Controller.java:2742)
 at com.audium.server.controller.Controller.continueCall(Controller.java:2511)
 at com.audium.server.controller.Controller.goToElement(Controller.java:2742)
 at com.audium.server.controller.Controller.continueCall(Controller.java:2511)

The error was: Another thread is currently working on this session.  

I use or not logAbandoned="true"
RemoveAbandonedTimeout="5"

Thanks

&lt;Resource name="jdbc/LionDB" auth="Container"
       type="javax.sql.DataSource" username="sa" password="########"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
            url="jdbc:sqlserver://10.42.19.25;DatabaseName=event_events;SelectMethod=cursor;"
            maxActive="8" 
            /&gt;
    &lt;Resource
                auth="Container"
                scope="Shareable"
                description="Test connection to the Sybase ASE server"
                name="jdbc/LionBase"
                type="javax.sql.DataSource"
                driverClassName="com.sybase.jdbc3.jdbc.SybDriver"
                url="jdbc:sybase:Tds:172.22.0.26:5000/Banco GN05"
                username="consulta_ura"
                password="########"
                maxIdle="20"
                maxWait="5000"
                maxActive="20"
                validationQuery="" /&gt;

&lt;Resource auth="Container" name="jdbc/LionOra"
 url="jdbc:oracle:thin:@10.24.11.13:1521/TRANSAC"
 driverClassName="oracle.jdbc.OracleDriver"
 type="javax.sql.DataSource" username="ura_persona" password="########"
 maxActive="4" maxIdle="2" maxWait="5000" removeAbandoned="true"
 removeAbandonedTimeout="5" logAbandoned="true"
 validationQuery="select 1 from dual"/&gt; 

&lt;Resource auth="Container" name="jdbc/LionOradois"
 url="jdbc:oracle:thin:@10.24.2.19:1521/BI"
 driverClassName="oracle.jdbc.OracleDriver"
 type="javax.sql.DataSource" username="ura_persona" password="########"
 maxActive="4" maxIdle="2" maxWait="5000" removeAbandoned="true"
 removeAbandonedTimeout="5" logAbandoned="true"
 validationQuery="select 1 from dual"/&gt;

 &lt;Resource auth="Container" name="jdbc/LionOratres"
 url="jdbc:oracle:thin:@10.24.9.12:1521/DBLAC"
 driverClassName="oracle.jdbc.OracleDriver"
 type="javax.sql.DataSource" username="consulta_ura" password="########"
 maxActive="4" maxIdle="2" maxWait="5000" removeAbandoned="true"
 removeAbandonedTimeout="5" logAbandoned="true"
 validationQuery="select 1 from dual"/&gt;
 </summary>
    <dc:creator>Pedro Rego</dc:creator>
    <dc:date>2013-06-18T13:21:41Z</dc:date>
  </entry>
  <entry>
    <title>RE: Call Studio Dynamic Menu Option</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16176882" />
    <author>
      <name>Mark Applebee</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16176882</id>
    <updated>2013-06-13T18:26:20Z</updated>
    <published>2013-06-13T18:26:20Z</published>
    <summary type="html">I think Bill's logic looks easier for me. I need more time to understand Paul's code.I will let you know once I implemented it.
Thanks guys!</summary>
    <dc:creator>Mark Applebee</dc:creator>
    <dc:date>2013-06-13T18:26:20Z</dc:date>
  </entry>
  <entry>
    <title>RE: Call Studio Dynamic Menu Option</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16175124" />
    <author>
      <name>Bill Webb</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16175124</id>
    <updated>2013-06-13T18:15:09Z</updated>
    <published>2013-06-13T18:15:09Z</published>
    <summary type="html">Hi Mark -

I'm a fan of using this method of "generic", reusable Studio apps. I suppose that's like replicating microapps in Studio, but that's not altogether bad! ;-)

Anyway, there's more than a couple ways to do this, I'm sure, but I've had good luck doing the following:

1. In your ICM Script, set the valid menu options in a continuous string somewhere in the ToExtVXML array with a tag of some sort, like "opts=13457".

2. In Studio, use a Digits element instead of a Menu element, and just set it to accept only 1 character (max/min length = 1), and no retries.

3. On "done" output of Digits, go to a Decision element where you check to see if the Session Data "opts" (using my example above) and the argument "contains", and the match being Digits_01.value, as an example (whatever your Digits element is named).

4. From there, you can handle your invalid entries and create a Count for looping, or send valid entries back to ICM with your CVP_Subdialog_Return.

 - Bill</summary>
    <dc:creator>Bill Webb</dc:creator>
    <dc:date>2013-06-13T18:15:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: Call Studio Dynamic Menu Option</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16176737" />
    <author>
      <name>Paul Tindall</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16176737</id>
    <updated>2013-06-13T18:08:53Z</updated>
    <published>2013-06-13T18:08:53Z</published>
    <summary type="html">Sample dynamic menu code attached.</summary>
    <dc:creator>Paul Tindall</dc:creator>
    <dc:date>2013-06-13T18:08:53Z</dc:date>
  </entry>
  <entry>
    <title>Call Studio Dynamic Menu Option</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16176505" />
    <author>
      <name>Mark Applebee</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16176505</id>
    <updated>2013-06-13T17:56:09Z</updated>
    <published>2013-06-13T17:56:09Z</published>
    <summary type="html">I am trying to convert my macro application to call studio apps. I am trying to use a single Menu app with dynamic menu option instead of using different apps for menu option 1, 2 etc.  Anyone have a sample code doing similar work?

thanks
Mark</summary>
    <dc:creator>Mark Applebee</dc:creator>
    <dc:date>2013-06-13T17:56:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: Re: New Message from Hemal Mehta in Customer Voice Portal (CVP) - CVP -</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15960459" />
    <author>
      <name>Gerard O&amp;#039;Rourke</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15960459</id>
    <updated>2013-06-07T08:51:37Z</updated>
    <published>2013-06-07T08:51:37Z</published>
    <summary type="html">[quote=Janine Graves]Hemal,
I teach the CVP Studio programming class. So I need to teach students 
how to use the Studio DB element. Not everyone knows Java or has a Java 
programmer on the payroll. I'm hoping that Cisco improves the existing 
Studio DB element (and adds more Studio elements) so that it becomes 
more useful out of the box - like many other IVR vendors have done for 
years.
Janine[/quote]
Janine,

I agree, every one that uses a database element would or should have at least an option to set connection timeout and a proper way to handle an error event, such as a failed connection / authentication issue, so that they could then handle this situation within the cvp studio application.

The current DB element is basic to the point that it does not have the capablity in my view for a production quality app, where error handling is critical.
Hopefully Cisco will improve this element, and it would seem straight forward to do so.

Gerry</summary>
    <dc:creator>Gerard O&amp;#039;Rourke</dc:creator>
    <dc:date>2013-06-07T08:51:37Z</dc:date>
  </entry>
  <entry>
    <title>RE: Setting Connect Timetout for Custom Element</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15950272" />
    <author>
      <name>Edward Umansky</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15950272</id>
    <updated>2013-06-06T21:08:25Z</updated>
    <published>2013-06-06T21:08:25Z</published>
    <summary type="html">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. </summary>
    <dc:creator>Edward Umansky</dc:creator>
    <dc:date>2013-06-06T21:08:25Z</dc:date>
  </entry>
  <entry>
    <title>RE: New Message from Janine Graves in Customer Voice Portal (CVP) - CVP - A</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15946099" />
    <author>
      <name>Hemal Mehta</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15946099</id>
    <updated>2013-06-06T19:06:44Z</updated>
    <published>2013-06-06T19:06:44Z</published>
    <summary type="html">That makes sense.  I am sure Cisco will enhance,  however there will be always exceptions and  out of box scenarios where you will have to write something on your own.   For example, I have a scenario where web service is written in .NET and I need to call from studio.  However due to the way it is generated, I cannot just use even the code I generate through Axis directly I need to manually tweak to make it work.  The question of using in built element is out of question.
Then I have another case where I switch between different SQL versions on the fly, if I use inbuilt element it is not possible.
If you are good in java, I would say write your own code.  If not, you got to use what you have.
Hemal

From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Thursday, June 06, 2013 1:54 PM
To: cdicuser@developer.cisco.com
Subject: New Message from Janine Graves in Customer Voice Portal (CVP) - CVP - All Versions: Re: New Message from Hemal Mehta in Customer Voice Portal (CVP) - CVP - All

Janine Graves has created a new message in the forum "CVP - All Versions": -------------------------------------------------------------- Hemal,
I teach the CVP Studio programming class. So I need to teach students
how to use the Studio DB element. Not everyone knows Java or has a Java
programmer on the payroll. I'm hoping that Cisco improves the existing
Studio DB element (and adds more Studio elements) so that it becomes
more useful out of the box - like many other IVR vendors have done for
years.
Janine
--
To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/15944378 or simply reply to this email.</summary>
    <dc:creator>Hemal Mehta</dc:creator>
    <dc:date>2013-06-06T19:06:44Z</dc:date>
  </entry>
  <entry>
    <title>RE: New Message from Edward Umansky in Customer Voice Portal (CVP) - CVP -</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15941916" />
    <author>
      <name>Hemal Mehta</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15941916</id>
    <updated>2013-06-06T18:54:44Z</updated>
    <published>2013-06-06T18:54:44Z</published>
    <summary type="html">Sure, that is true ☺
Hemal

From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Thursday, June 06, 2013 1:52 PM
To: cdicuser@developer.cisco.com
Subject: New Message from Edward Umansky in Customer Voice Portal (CVP) - CVP - All Versions: RE: New Message from Edward Umansky in Customer Voice Portal (CVP) - CVP -

Edward Umansky has created a new message in the forum "CVP - All Versions": -------------------------------------------------------------- Agreed but Janine is teaching the Cisco CVP class so she needs to be able to give her students guidance on the built-in elements of Call Studio.
--
To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/15944300 or simply reply to this email.</summary>
    <dc:creator>Hemal Mehta</dc:creator>
    <dc:date>2013-06-06T18:54:44Z</dc:date>
  </entry>
  <entry>
    <title>Re: New Message from Hemal Mehta in Customer Voice Portal (CVP) - CVP - All</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15944378" />
    <author>
      <name>Janine Graves</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15944378</id>
    <updated>2013-06-06T18:54:15Z</updated>
    <published>2013-06-06T18:54:15Z</published>
    <summary type="html">Hemal,
I teach the CVP Studio programming class. So I need to teach students 
how to use the Studio DB element. Not everyone knows Java or has a Java 
programmer on the payroll. I'm hoping that Cisco improves the existing 
Studio DB element (and adds more Studio elements) so that it becomes 
more useful out of the box - like many other IVR vendors have done for 
years.
Janine</summary>
    <dc:creator>Janine Graves</dc:creator>
    <dc:date>2013-06-06T18:54:15Z</dc:date>
  </entry>
  <entry>
    <title>RE: New Message from Edward Umansky in Customer Voice Portal (CVP) - CVP -</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15944300" />
    <author>
      <name>Edward Umansky</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15944300</id>
    <updated>2013-06-06T18:51:48Z</updated>
    <published>2013-06-06T18:51:48Z</published>
    <summary type="html">Agreed but Janine is teaching the Cisco CVP class so she needs to be able to give her students guidance on the built-in elements of Call Studio.</summary>
    <dc:creator>Edward Umansky</dc:creator>
    <dc:date>2013-06-06T18:51:48Z</dc:date>
  </entry>
  <entry>
    <title>RE: New Message from Edward Umansky in Customer Voice Portal (CVP) - CVP -</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15941650" />
    <author>
      <name>Hemal Mehta</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15941650</id>
    <updated>2013-06-06T18:46:44Z</updated>
    <published>2013-06-06T18:46:44Z</published>
    <summary type="html">Why limit yourself with inbuilt studio element for complex DB operations. I would just create my own class and execute it directly or write a custom element to do it.   With inbuilt elements you always get somewhat restricted. Same thing with web services element.
Hemal

From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Thursday, June 06, 2013 1:40 PM
To: cdicuser@developer.cisco.com
Subject: New Message from Edward Umansky in Customer Voice Portal (CVP) - CVP - All Versions: RE: Call Studio Database Element and Stored Procedures

Edward Umansky has created a new message in the forum "CVP - All Versions": --------------------------------------------------------------
Janine Graves:

--This is how I created the Stored Proc on MySql
delimiter //
create procedure accountbal(in oacctnum int, out obalance int)
begin
  select balance1 into obalance from account where acctnum=oacctnum;
end //

And then in Studio, execute the stored procedure from a Studio DB element:
Type: Update
SQL Query: call accountbal(1111, @dbvarBalance)

And then execute another Studio DB element to get the value from the database variable @dbvarBalance into Studio element data named 'acctBalance',
Type: 'Single'
SQL Query: select @dbvarBalance as acctBalance

Don't do this! The reason this works is that the "@variable" syntax is a MySQL-specific feature known as user-defined variables. What is unique and useful about these variables is that they retain their scope across the lifetime of a connected session, allowing you to reference them across different statements, as you did in your Call Studio example. The problem is that the db step in VXML Server uses connection pooling. This is important for efficient performance, but it has the side-effect that multiple calls may use the same db connection before it is ever closed. Since a MySQL user-defined variable retains its scope for the lifetime of a connection, this exposes you to some serious race conditions.

For example, let's say you have two calls executing the database interaction at about the same time. Call 1 executes the update then returns the connection to the pool. Before Call 1 has a change to execute the query step, Call 2 borrows the same connection from the pool and executes its update step. Now, if Call 1 retrieves the original connection and exectues it's query, it'll get the data for Call 2! Very bad. In fact you don't even need two concurrent calls hitting the exact same step to see issues, the update and select pieces may not even retrieve the same connection if the connection pool is being used by multiple calls.

You won't see this in testing because of the low call volume. You may not even catch it in production, but since it's such a serious risk - and a nightmare to debug if you ever do hit it - you should absolutely avoid it.

If you are using OUT parameters in MySQL, you'll need to use custom Java code similar to the Oracle example. Unlike Oracle however, MySQL actually lets you return resultsets directly from a stored procedure just like in MSSQL. Your stored proc then can be rewritten like so:

delimiter //
create procedure accountbal(in oacctnum int)
begin  select balance1 from account where acctnum=oacctnum;
end //

Then you can just call it like so:

call accountbal(1111)

You can call this via a single or multiple query, depending on how many results are returned. Just think of it as being identical to calling "select balance1 from account where acctnum=oacctnum" directly. The same holds true for MSSQL procedures. The syntax for calling an MSSQL procedure that returns a resultset is like so:

EXEC yourProc 'param1', 'param2', 'param3'

The lesson here is there isn't a single rule as to how to use stored procedures within Call Studio, it depends entirely on how the stored proc is implemented. In most cases, this is something dictated by the customer, not something you have control over. Otherwise, you could simply use a direct query and avoid the hassle. Here's a rough flow for figuring out what to do:

Does the proc return results?
  If not, you should be able to call it via the "update" query type.
  If yes, does the proc return a resultset? (Oracle cannot return a resultset at all, MySQL and MSSQL can)
    If OUT parameters, you will need to write custom Java code.
    If it returns a resultset, you can use it the same way as if you were calling the query directly.
--
To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/community/-/message_boards/view_message/15943862 or simply reply to this email.</summary>
    <dc:creator>Hemal Mehta</dc:creator>
    <dc:date>2013-06-06T18:46:44Z</dc:date>
  </entry>
  <entry>
    <title>RE: Call Studio Database Element and Stored Procedures</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15943862" />
    <author>
      <name>Edward Umansky</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15943862</id>
    <updated>2013-06-06T18:40:17Z</updated>
    <published>2013-06-06T18:40:17Z</published>
    <summary type="html">[quote=Janine Graves]
[b]--This is how I created the Stored Proc on MySql[/b]
delimiter //
create procedure accountbal(in oacctnum int, out obalance int)
begin
  select balance1 into obalance from account where acctnum=oacctnum;
end //

[b]And then in Studio, execute the stored procedure from a Studio DB element[/b]:
[b]Type: Update
SQL Query: call accountbal(1111, @dbvarBalance)[/b]

And then execute another Studio DB element to get the value from the database variable[b] @dbvarBalance[/b] into Studio element data named '[b]acctBalance[/b]', 
[b]Type: 'Single' [/b]
[b]SQL Query: select @[/b][b]dbvarBalance [/b][b]as acctBalance
[/b][/quote][b][i]
Don't do this![/i][/b] The reason this works is that the "@variable" syntax is a MySQL-specific feature known as user-defined variables. What is unique and useful about these variables is that they retain their scope across the lifetime of a connected session, allowing you to reference them across different statements, as you did in your Call Studio example. The problem is that the db step in VXML Server uses connection pooling. This is important for efficient performance, but it has the side-effect that multiple calls may use the same db connection before it is ever closed. Since a MySQL user-defined variable retains its scope for the lifetime of a connection, this exposes you to some serious race conditions.

For example, let's say you have two calls executing the database interaction at about the same time. Call 1 executes the update then returns the connection to the pool. Before Call 1 has a change to execute the query step, Call 2 borrows the same connection from the pool and executes its update step. Now, if Call 1 retrieves the original connection and exectues it's query, it'll get the data for Call 2! Very bad. In fact you don't even need two concurrent calls hitting the exact same step to see issues, the update and select pieces may not even retrieve the same connection if the connection pool is being used by multiple calls.

You won't see this in testing because of the low call volume. You may not even catch it in production, but since it's such a serious risk - and a nightmare to debug if you ever do hit it - you should absolutely avoid it.

If you are using OUT parameters in MySQL, you'll need to use custom Java code similar to the Oracle example. Unlike Oracle however, MySQL actually lets you return resultsets directly from a stored procedure just like in MSSQL. Your stored proc then can be rewritten like so:

delimiter //
create procedure accountbal(in oacctnum int)
begin  select balance1 from account where acctnum=oacctnum;
end // 

Then you can just call it like so:

call accountbal(1111)

You can call this via a single or multiple query, depending on how many results are returned. Just think of it as being identical to calling "select balance1 from account where acctnum=oacctnum" directly. The same holds true for MSSQL procedures. The syntax for calling an MSSQL procedure that returns a resultset is like so:

EXEC yourProc 'param1', 'param2', 'param3'

The lesson here is there isn't a single rule as to how to use stored procedures within Call Studio, it depends entirely on how the stored proc is implemented. In most cases, this is something dictated by the customer, not something you have control over. Otherwise, you could simply use a direct query and avoid the hassle. Here's a rough flow for figuring out what to do:

Does the proc return results?
  If not, you should be able to call it via the "update" query type.
  If yes, does the proc return a resultset? (Oracle cannot return a resultset at all, MySQL and MSSQL can)
    If OUT parameters, you will need to write custom Java code.
    If it returns a resultset, you can use it the same way as if you were calling the query directly.</summary>
    <dc:creator>Edward Umansky</dc:creator>
    <dc:date>2013-06-06T18:40:17Z</dc:date>
  </entry>
  <entry>
    <title>RE: Setting Connect Timetout for Custom Element</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15937094" />
    <author>
      <name>Yuibi Fujimoto</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15937094</id>
    <updated>2013-06-06T16:12:46Z</updated>
    <published>2013-06-06T16:12:46Z</published>
    <summary type="html">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.</summary>
    <dc:creator>Yuibi Fujimoto</dc:creator>
    <dc:date>2013-06-06T16:12:46Z</dc:date>
  </entry>
</feed>

