Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: kevinwang on April 15, 2010, 07:42:08 PM

Title: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 15, 2010, 07:42:08 PM
I customized a tab frame in interaction-information for GAD,where  agent can attach disposition code as user data,
I defined these disposition codes in cma's business attribute, this field is also a user defined field of calling list.
My question is how to update user defined field in calling list after applying the selection of dispostion code as user data?
Is there any callling list related class or method in AIL I can use to do this?
because when agent markdone a outbound call, predefined callling list fields like call result, do not call, call time etc will be updated automatically.
there must be some easy way to do this other than using basic jsp sql way, I mean, open a db connection, statement, resultset...close db connection..
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 15, 2010, 07:49:46 PM
Ichecked the JAVA AIL SDK, should I use OutboundRecord interface, under which there are many  field get/set method.
Has anyone ever done this?
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 15, 2010, 08:07:48 PM
my question changed, my new question is how I can get the instance of this class OutboundRecord by interaction id?
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: René on April 16, 2010, 10:25:16 AM
Hi Kevin

The code below should work but I haven't had a chance to test it.

[code]Agent agentExample = (Agent) myAilFactory.getPerson("Agent_ID");
Interaction myInteraction = myAilFactory.getInteraction(...interaction ID...);
OutboundService myOutboundService = agentExample.getOutboundService();
OutboundChain myOutboundChain = myOutboundService.getChain(myInteraction);
OutbounRecord myOutboundRecord = myOutboundChain.getActiveRecord();
[/code]

R.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 16, 2010, 07:18:07 PM
Thank you very much, It seems right, I will try it.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 16, 2010, 08:49:19 PM
I tried , but there is a java.lang.NullPointerException error for 
OutboundService myOutboundService = myAgent.getOutboundService();
any suggestion?



org.apache.jasper.JasperException: Exception in JSP: /custom/apply-codes.jsp:27

24:    /* Code for calling list update */
25:   
26:    Agent myAgent = (Agent)factory.getPerson(userName);
27:    OutboundService myOutboundService = myAgent.getOutboundService();
28:    OutboundChain myOutboundChain = myOutboundService.getChain(interaction);
29:    OutboundRecord myOutboundRecord = myOutboundChain.getActiveRecord();
30:   


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:127)


root cause

java.lang.NullPointerException
org.apache.jsp.custom.apply_002dcodes_jsp._jspService(apply_002dcodes_jsp.java:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:127)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.

Title: Re: how to update user defined field in calling list after applying the selection o
Post by: René on April 18, 2010, 06:29:13 PM
Hi Kevin,

I have no chance to test it so just few ideas...

Could you check that myAgent object is returned = it is not null?
Is Outbound Contact Server listed on Connection tab of GDesktop application?
Is there any error in GDesktop log?

R.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 19, 2010, 12:22:00 PM
I guess I missed this code: document.forms.xxxxx.elements.userName value = userName in custom.xml
but , I haven't got a chance to test it.
Thank  you very much. your suggestion is very valuable.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 19, 2010, 05:10:20 PM
There is an exception error on  line 29.

28:    OutboundChain myOutboundChain = myOutboundService.getChain(interaction);
29:    OutboundRecord myOutboundRecord = myOutboundChain.getActiveRecord();

it seems I got  the OutboundChain instance correctly, but why there is an NullPointerException in 29?
because getActiveRecord() doesn't need any parameter, if OutboundChain is no problem, there should not be a problem with getActiveRecord().
Am I right?





message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /custom/apply-codes.jsp:29

26:    Agent myAgent = (Agent)factory.getPerson(userName);
27:    OutboundService myOutboundService = myAgent.getOutboundService();
28:    OutboundChain myOutboundChain = myOutboundService.getChain(interaction);
29:    OutboundRecord myOutboundRecord = myOutboundChain.getActiveRecord();
30:   
31:
32:    /* Apply disposition code in interaction


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:127)


root cause

java.lang.NullPointerException
org.apache.jsp.custom.apply_002dcodes_jsp._jspService(apply_002dcodes_jsp.java:78)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:127)

Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 19, 2010, 05:18:37 PM
[quote author=kevinwang link=topic=5472.msg23885#msg23885 date=1271697020]
There is an exception error on  line 29.

28:    OutboundChain myOutboundChain = myOutboundService.getChain(interaction);
29:    OutboundRecord myOutboundRecord = myOutboundChain.getActiveRecord();

it seems I got  the OutboundChain instance correctly, but why there is an NullPointerException in 29?


Maybe I didn't get OutboundChain instance correctly?

the following I got from AIL SDK:

getChain(Interaction ixn)
          Returns the outbound chain associated with the given interaction, or null, if this interaction has no outbound information.

But this is really a out bound interaction, why no outboundchain returned?


Kevin
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: René on April 19, 2010, 06:50:53 PM
Kevin,

Please double-check that myOutboundChain is not null. There should be no exception raised in case getActiveRecord() returns NULL as you're not using this object. Exception is thrown when you try to use NULL object.

Please check as well that variable "interaction" points to valid instance of Interaction class.

R.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 20, 2010, 02:59:00 PM
Hi ,rene,

thank you very much for your reply.

I can't get an OutboundChain instance by myOutboundService.getChain(interaction);
So I checked interaction, I found its interaction.Type is Phone_call.
Because getChain() method returns the outboundchain assoiciated with the given interaction, or null, if this interaction has no outbound information. So I doubt if the Interaction.TYPE is not correct?
If the interaction is a outbound call,  What type of interaction should be?
PHONE_CALL_OUTBOUND?

Kevin
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: René on April 20, 2010, 03:42:53 PM
Hi Kevin,

Yes, call type should be outbound. If it is inbound then the getChain() method returns null as there is no outbound service available.

How do you generate the calls?

R.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 20, 2010, 04:48:09 PM
there is a campaign running, dialing mode is perdictive with seizing, only one record in calling list (just for testing),
I mean I am very sure call was generated by ocs.


kevin
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 20, 2010, 05:15:12 PM
However, in GAD, when there is call coming, the arrow indicates it's a inbound call, and phone number is a port number for cpd.(this is a testing environment, no other call possible).

Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 20, 2010, 08:02:12 PM
I made some progress,  I got the outboundrecord instance, and be able to get pre defined calling list filed value, but when I tried to setCustomField("WrapUpCode",a); there is an outboundserviceexception.

"Record already processed?"


OutboundServiceException (OutboundService: On) of type Record already processed
com.genesyslab.ail.core.outbound.OutboundServiceImpl.executeAgentRequest(OutboundServiceImpl.java:911)
com.genesyslab.ail.core.outbound.OutboundRecordImpl.update(OutboundRecordImpl.java:191)
com.genesyslab.ail.core.outbound.OutboundRecordImpl.setCustomField(OutboundRecordImpl.java:440)
com.genesyslab.ail.core.outbound.OutboundRecordImpl.setCustomField(OutboundRecordImpl.java:401)
org.apache.jsp.custom.disposition_002dcodes_002dview_jsp._jspService(disposition_002dcodes_002dview_jsp.java:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:127)
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: cavagnaro on April 20, 2010, 09:56:20 PM
That means that your agent closed the RecordHandle by:
1. Sending RecordProcessed event
2. Putting himself in Ready

Or because you didn't configure OCS Record_Process option
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 21, 2010, 01:09:14 PM
Now I have a new problem.
When I use preview dialing mode, I can an OutboundChain Instance, everthing works well,
but when I use predictive dialing mode, there is always a nullpointexception, that means I can't get an outboundchain instance.

does this have anything to do with the option "record_processed" parameter?

The following is from outbound contact 7.2 deployment guide about 'Record_processed' option:


This option is used only in Predictive and progressive dialing modes.
In the preview dialing mode, outbound contact server updates a record only after receiving a recordProcessed event from a desktop, regardless of whether the record_processed option is set to true or false.

Actually, I am not very clear about this.


Kevin
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: cavagnaro on April 21, 2010, 04:39:22 PM
You have to use the Record Process event in order to update the fields.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 21, 2010, 05:14:19 PM
I use the following codes to update custom fields.

29:    OutboundChain myOutboundChain = myOutboundService.getChain(interaction);
30:    OutboundRecord myOutboundRecord = myOutboundChain.getActiveRecord();
31:    myOutboundRecord.setCustomField("WrapUpCode",wrapUpCode);

but when I use predictive dialing mode, I can't get the instance of OutboundChain, then there is always a nullpointerexception on 31.
these codes work for preview dialing mode.


Kevin
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: René on April 21, 2010, 08:07:09 PM
Kevin,

Is the call really outbound call generated by OCS?

R.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: kevinwang on April 21, 2010, 09:03:07 PM
yes, it's outbound call generated by OCS.
Now, it seems working properly. I made some stupid mistake. Anyway, it's fixed.
thank you very much ,rene,    and Cavagnaro.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: amarceau on September 28, 2010, 02:47:31 PM
[quote author=kevinwang link=topic=5472.msg23924#msg23924 date=1271870059]
I use the following codes to update custom fields.

29:    OutboundChain myOutboundChain = myOutboundService.getChain(interaction);
30:    OutboundRecord myOutboundRecord = myOutboundChain.getActiveRecord();
31:    myOutboundRecord.setCustomField("WrapUpCode",wrapUpCode);

but when I use predictive dialing mode, I can't get the instance of OutboundChain, then there is always a nullpointerexception on 31.
these codes work for preview dialing mode.


Kevin
[/quote]

I know this post is a few months old... But I'm trying to do this exact same thing and I can't seem to get it working.  Can you tell me where you put these lines of code?  Is it in the GAD custom.xml code?
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: René on October 01, 2010, 01:02:38 PM
Hi,

This is Java code that must be placed either in Java class or JSP page.

R.
Title: Re: how to update user defined field in calling list after applying the selection o
Post by: pavelpg on August 27, 2015, 05:29:28 AM
[quote author=kevinwang link=topic=5472.msg23905#msg23905 date=1271793732]
I made some progress,  I got the outboundrecord instance, and be able to get pre defined calling list filed value, but when I tried to setCustomField("WrapUpCode",a); there is an outboundserviceexception.

...
[/quote]

How did you get OutboundRecord instance? through InteractionVoiceOutbound.getActiveRecord() deprecated way?