Genesys CTI User Forum
Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: ralonso on July 19, 2011, 11:06:53 AM
-
I'm doing tests customization of GAD.
When I get a new interaction event I want to open a popup and launch a query on a database (MSSQL) with the ANI of the call.
Following some examples I've seen in a Rene post , I managed to launch the popup when I get a call.
Before further testing I would like to know if I want to do is possible.
Sorry for my english.
-
Hi,
Yes, it's definitely possible. However, you would need to deploy required ODBC drivers for MSSQL to GDesktop's Tomcat instance.
R.
-
Hello again,
I am trying to extract the ANI of a call to generate the query in the database.
I'm using this code:
[quote]<%@ page language="java" buffer="none" contentType="text/html; charset=utf-8" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="com.genesyslab.ail.AilLoader" %>
<%@ page import="com.genesyslab.ail.AilFactory" %>
<%@ page import="com.genesyslab.ail.Interaction" %>
<%@ page import="com.genesyslab.ail.Interaction.Type" %>
<%@ page import="com.genesyslab.ail.InteractionVoice" %>
<%@ page import="com.genesyslab.ail.ws.interaction.voice" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript">
window.parent.includeGDFunctionalities(window);
function custom_load() {
activateGDFunctionalities();
}
function custom_unload() {
unactivateGDFunctionalities();
}
</script>
</head>
<body height="0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
onLoad="custom_load()" onUnload="custom_unload()">
<script language="javascript">
<%
String ani;
com.genesyslab.ail.ws.interaction.voice
AilFactory ail = AilLoader.getAilFactory();
String interactionId = request.getParameter("interactionId");
Interaction interaction = ail.getInteraction(interactionId);
if(interaction instanceof InteractionVoice)
{ InteractionVoice iv = (InteractionVoice)interaction;
ani = iv.getANI();
};
%>
ANI <b><%=ani %>
</script>
</body>
</html>[/quote]
the problem is do not return anything. ???
-
hi,
anyone can help? I do not understand why do not return anything.
Regrads.
-
Hi,
Please check that [i]interactionId[/i] parameter is passed to your JSP page.
[i]getInteraction[/i] method returns object of type Interaction so I'm not sure if your statement "[i]if(interaction instanceof InteractionVoice)[/i]" is correct.
R.
-
this is my custom.xml
[code]<gcn-resources>
<desktop>
<javascript-onaddinteraction>
<![CDATA[
document.forms.welcomeForm.elements.interactionId.value = idInteraction;
document.forms.welcomeForm.submit();
]]>
</javascript-onaddinteraction>
<html-body>
<![CDATA[
<form name="welcomeForm" target="_blank" method="get"
action="custom/welcome.jsp">
<input type="hidden" name="interactionId"/>
</form>
]]>
</html-body>
</desktop>
</gcn-resources>[/code]
i get this http://gce/gdesktop/custom/welcome.jsp?interactionId=Phonecall-5001-006f01f47b204002
-
I finally made it work.
InteractionID not return the ANI field (do not know why) I picked up the information from the contactID.
I leave the code here in case anyone wants to use.
custom.xml
[code]
<gcn-resources>
<desktop>
<dictionary-class>custom</dictionary-class>
<customer-records>
<javascript-onload>
<![CDATA[
switch(interactionType) {
case INTERACTION_VOICE:
selectTabByName("AdditionalInformation");
break;
}
]]>
</javascript-onload>
<tabs>
<tab name="AdditionalInformation">
<dictionary-key>AdditionalInformation</dictionary-key>
<javascript-onselect>
<![CDATA[
document.forms.additionalInformationForm.target = getDetailFrameName();
document.forms.additionalInformationForm.elements.idInteraction.value = idInteraction;
document.forms.additionalInformationForm.elements.idContact.value = idContact;
document.forms.additionalInformationForm.submit();
]]>
</javascript-onselect>
<html-body>
<![CDATA[
<form name="AdditionalInformationForm" action="custom\additionalInformation.jsp">
<input type="hidden" name="idInteraction">
<input type="hidden" name="idContact">
</form>
]]>
</html-body>
</tab>
</tabs>
</customer-records>
</desktop>
</gcn-resources>
[/code]
additionalinformation.jsp
[code]
<%@ page language="java" buffer="none" contentType="text/html; charset=utf-8" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*" %>
<%
com.genesyslab.ail.AilFactory factory = com.genesyslab.ail.AilLoader.getAilFactory();
com.genesyslab.ail.Interaction interaction = factory.getInteraction( (String)request.getParameter( "idInteraction" ) );
com.genesyslab.ail.ContactManager contactManager = factory.getContactManager();
com.genesyslab.ail.Contact contact = factory.getContactManager().getContact( (String)request.getParameter( "idContact" ) ,null);
%>
<html>
<head>
<title>Informacion Cliente</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="font-size: 13pt;" bgcolor="#ced3de">
</p>
<%
java.sql.Connection con;
java.sql.Statement s;
java.sql.ResultSet rs;
java.sql.PreparedStatement pst;
out.println("");
con=null;
s=null;
pst=null;
rs=null;
String url= "jdbc:jtds:sqlserver://localhost/pruebas";
String id= "prueba";
String pass = "Prueb11";
try{
Class.forName("net.sourceforge.jtds.jdbc.Driver");
con = java.sql.DriverManager.getConnection(url, id, pass);
}catch(ClassNotFoundException cnfex){
cnfex.printStackTrace();
}
String sql = "select * from contactos where telefono="+contact.getPrimaryPhoneNumber()+"";
try{
s = con.createStatement();
rs = s.executeQuery(sql);
%>
<%
while( rs.next() ){
%>
<tr>
<td>ID de Cliente: <%= rs.getString("cust_id") %></td>
<br></br>
<td>Numero de telefono: <%= rs.getString("telefono") %></td>
<br></br>
<td>Nombre del Cliente: <%= rs.getString("nombre") %></td>
</tr>
<%
}
%>
<%
}
catch(Exception e){e.printStackTrace();}
finally{
if(rs!=null) rs.close();
if(s!=null) s.close();
if(con!=null) con.close();
}
%>
</body>
</html>
[/code]