Author Topic: GAD / Desktop popup window problem  (Read 8014 times)

Offline Adam_W

  • Full Member
  • ***
  • Posts: 171
  • Karma: 0
GAD / Desktop popup window problem
« on: March 10, 2010, 10:27:24 AM »
I'm having trouble getting a GAD customisation to work....

What I ultimately want to do is pop up a new window when a call is received.  The window will contain a different picture depending on the DNIS.

I've adapted the customisation example from the Desktop Administrator's Guide so that the window pops up when the call is received (instead of when the agent logs on to the desktop).  The window appears but inside it just says:

HTTP Status 404 - /custom/welcome.jsp
--------------------------------------------------------------------------------
type Status report
message /custom/welcome.jsp
description The requested resource (/custom/welcome.jsp) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.12


Below are my custom.xml and Welcome.jsp files, which are both located in the \webapps\gdesktop\custom folder.

custom.xml:

<gcn-resources>
    <desktop>
  <javascript-onaddinteraction>
<![CDATA[
                document.forms.welcomeForm.elements.userName.value = userName;
                document.forms.welcomeForm.submit();
            ]]>
  </javascript-onaddinteraction>
  <html-body>
            <![CDATA[
                <form name="welcomeForm" target="_blank" method="get"
                      action="custom/welcome.jsp">
                    <input type="hidden" name="userName"/>
                </form>
            ]]>
        </html-body>
        <dictionary-class>custom</dictionary-class>
        <interaction-information>
          <tabs>
                <tab name="custom_disposition_code">
                    <dictionary-key>interactioninformation.dispositioncode</dictionary-key>
                    <scrollbar>true</scrollbar>
                    <javascript-oninteractionstatuschange>
                        <![CDATA[
                          if (interactionType == INTERACTION_VOICE)
                              selectTabByName("custom_disposition_code");
                        ]]>
                    </javascript-oninteractionstatuschange>
                    <javascript-onselect>
                        <![CDATA[
                            document.forms.customDispositionCodeForm.target = getDetailFrameName();
                            document.forms.customDispositionCodeForm.elements.idInteraction.value = idInteraction;
                            document.forms.customDispositionCodeForm.submit();
                        ]]>
                    </javascript-onselect>
                    <html-body>
                        <![CDATA[
                            <form name="customDispositionCodeForm" target="customDispositionCodeActionFrame"
                                              action="custom/disposition-codes-view.jsp">
                                <input type="hidden" name="idInteraction">
                            </form>
                            <iframe name="customDispositionCodeActionFrame" style="visibility:hidden" frameborder="no" width="0" height="0"></iframe>
                        ]]>
                    </html-body>
                </tab>
            </tabs>
        </interaction-information>
    </desktop>
</gcn-resources>


Welcome.jsp:

<%@ page language="java" buffer="none" contentType="text/html; charset=utf-8" %>
<html>
    <head>
        <title>Welcome</title>
    </head>
    <body bgcolor="#ccccff">
        <center><b>
            <font size="6" color="#000099">
                Welcome
            </font>
        </b></center>
        <hr>
    </body>
</html>


As you can see, I haven't even started adapting the Welcome.jsp file to show what I need yet.  I'll eventually need to make it get the DNIS, choose an image and also resize the window to fit arouond the image, as well as making it always on top.

For now if I could get it to say "Welcome" so I can prove the concept, I would be happy!  Any ideas why this isn't working??

Offline Adam_W

  • Full Member
  • ***
  • Posts: 171
  • Karma: 0
Re: GAD / Desktop popup window problem
« Reply #1 on: March 10, 2010, 06:27:45 PM »
OK, the problem with opening the new window was due to capitalisation of the "w" in "welcome.jsp"!

I've managed to get a window to popup at the start of the call, made it always on top and resized it to the correct size, using the code below in the welcome.jsp file:

<%@ page language="java" buffer="none" contentType="text/html; charset=utf-8" %>
<html>
    <head>
<script type="text/javascript" language="JavaScript">
window.onblur = function() {
setTimeout('self.focus()',100);
}
window.resizeTo(500,400);
</script>
        <title>Branding Notification</title>
    </head>
    <body>
        <center><b>
            <font size="6" color="#000099">
                Insert image here
            </font>
        </b></center>
        <hr>
    </body>
</html>


Does anyone know how to open a different image in that window depending on the value of the DNIS??

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: GAD / Desktop popup window problem
« Reply #2 on: March 11, 2010, 11:25:33 AM »
Hi,

[quote]Does anyone know how to open a different image in that window depending on the value of the DNIS??[/quote]
Yes, I know :). Some light programming in Java is required to do so. Please find the steps and code below.

1/ It is necessary to modify your custom.xml as we need id of the interaction to be passed to welcome.jsp

[code]    <javascript-onaddinteraction>
      <![CDATA[
                document.forms.welcomeForm.elements.interactionId.value = idInteraction;
                document.forms.welcomeForm.elements.userName.value = userName;
                document.forms.welcomeForm.submit();
            ]]>
    </javascript-onaddinteraction>
    <html-body>
            <![CDATA[
                <form name="welcomeForm" target="_blank" method="get"
                      action="custom/welcome.jsp">
                    <input type="hidden" name="userName"/>
                    <input type="hidden" name="interactionId"/>
                </form>
            ]]>
        </html-body>[/code]

2/ And now we can add some Java code into welcome.jsp that will get DNIS of the interaction

[code]<%@ page language="java" buffer="none" contentType="text/html; charset=utf-8" %>
<%@ 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" %>
<html>
    <head>
  <script type="text/javascript" language="JavaScript">
      window.onblur = function() {
      setTimeout('self.focus()',100);     
      }
      window.resizeTo(500,400);
      </script>
        <title>Branding Notification</title>
    </head>
    <body>
        <center><b>
            <font size="6" color="#000099">
<%
String DNIS = "";
String imageName = "";
Interaction interaction = null;
InteractionVoice voice = null;

String interactionId = (String)request.getParameter("interactionId");

AilFactory factory = AilLoader.getAilFactory();
try {
    interaction = factory.getInteraction(interactionId);

if (interaction != null) {
if (interaction.getType() ==  Interaction.Type.PHONE_CALL) {
voice = InteractionVoice)interaction;
DNIS = voice.getDNIS();
}
}
} catch (Exception ex) {

}

voice = null
interaction = null
factory = null;

switch (DNIS) {
case "12345": imageName = "12345.png"; break;
case "67890": imageName = "67890.png"; break;
default: imageName = "unknown.png"; break;
}

%>
<img src="<%= imageName %>" alt=""/>
            </font>
        </b></center>
        <hr> 
    </body>
</html>[/code]

I haven't been able to test the code so some "polishing" might be needed...

R.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7640
  • Karma: 56330
Re: GAD / Desktop popup window problem
« Reply #3 on: March 11, 2010, 05:24:41 PM »
Nice example René!  ;D

Offline Adam_W

  • Full Member
  • ***
  • Posts: 171
  • Karma: 0
Re: GAD / Desktop popup window problem
« Reply #4 on: March 11, 2010, 05:29:51 PM »
Hi René

Many thanks, that works great.  Just a couple of semi-colons missing but that was easily fixed.

Do you know if it's possible to hide the toolbars, title bar, file menu, scrollbar etc on the opened window, so it's effectively just a panel with the image in it?  I think it can be done using the window.open method, but we're obviously not calling the new window in this way...

Offline Adam_W

  • Full Member
  • ***
  • Posts: 171
  • Karma: 0
Re: GAD / Desktop popup window problem
« Reply #5 on: March 11, 2010, 07:18:06 PM »
On second thought, I can live with the toolbars being visible.  What I really need to do is make the form close when the call ends.

I've tried adding the following to the custom.xml file with no luck:
[code]<javascript-onremoveinteraction>
<![CDATA[
document.forms.welcomeForm.close();
    ]]>
  </javascript-onremoveinteraction>[/code]

What is the correct way?

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: GAD / Desktop popup window problem
« Reply #6 on: March 11, 2010, 08:40:29 PM »
Hi Adam,

IMHO there is no way to change window's properties like address field visibility etc. once the window is opened. It is restricted because of security.

Closing the window automatically once the call ends is a tricky task as it is hard to identify opened window. I would need to do some testing to find suitable way. Problem is that I don't have free time now :(

R.

Offline Adam_W

  • Full Member
  • ***
  • Posts: 171
  • Karma: 0
Re: GAD / Desktop popup window problem
« Reply #7 on: March 11, 2010, 11:33:48 PM »
Yeah, I thought it would have known which window to close because I referred to it by name, i.e. "welcomeForm".

Too easy I guess!!

Offline valeriu.craciun

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
Re: GAD / Desktop popup window problem
« Reply #8 on: June 22, 2011, 09:58:49 AM »
Hi everybody,
I know it is an old post, but I need to do the same thing to pop-up a window when a call is answered.In the example bellow I do not understand which is part of the custom.xml does the welcome.jsp execution occur when a call is received. Can you please explain?

Kind regards,
Valeriu

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: GAD / Desktop popup window problem
« Reply #9 on: June 22, 2011, 02:15:32 PM »
Hi Valeriu,

JSP file is executed using custom JavaScript events. You can find list of these in Genesys Desktop 7.6 XML Tag Reference help file.

In the example posted in this thread, welcome.jsp is executed when new interaction is added to agent's desktop (javascript-onaddinteraction). Added means answered by an agent.

R.

Offline valeriu.craciun

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
Re: GAD / Desktop popup window problem
« Reply #10 on: June 22, 2011, 03:09:31 PM »
Hi Rene,

Thank you very much for the explanation, I will definitely look into Genesys Desktop 7.6 XML Tag Reference. I never thought that something so generic like javascript-onaddinteraction label could mean answered by the agent.

Kind regards,
Valeriu