" /> Inbound voice - last agent routing. - Genesys CTI User Forum

Author Topic: Inbound voice - last agent routing.  (Read 8381 times)

Offline andbra

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Inbound voice - last agent routing.
« on: July 15, 2009, 12:11:35 PM »
Advertisement
Hello,

I am making a strategy to route the call from a customer to the same agent the customer spoke to the last time he called if the last call was made the same business day.

I am planning to use a post routing action to write info about the call(AgentID, Customer ID etc.) to a table in a db, and access that same table when the customer calls in again. The customer must be identified, and the selected agent must be "Ready" state when the customer calls the 2nd (or 3rd etc.) time.

Is there any other easy way of doing this, or is the custom db-way the way to do it?

Input and ideas are much appreciated. :)

Regards,
Anders

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Inbound voice - last agent routing.
« Reply #1 on: July 15, 2009, 03:13:48 PM »
Hi,

Storing info about last agent into database is standard way of "last-agent" implementation in my point of view. I used it several times. It's possible to use web services as well if database isn't preferred solution.

If you have Multimedia (MCR) solution then information about last agent can be stored in/retrieved from UCS database. It is supported by GDesktop and it should be possible to implement support for that feature into your desktop application as well.

R.

Offline andbra

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Inbound voice - last agent routing.
« Reply #2 on: July 30, 2009, 10:17:44 AM »
Hello!

I have now started the development of this last-agent-routing, and I have come a bit down the road. :)

I have encountered a problem when getting the AgentID from my created table.

I try to use a stored procedure to access the correct row with the right agent based on some variables from my strategy.

My problem is that I can't get the stored procedure to return the Agent ID, it doesn't return anything.

Here is my Stored procedure:

[code]
ALTER PROCEDURE [dbo].[find_sisteagent]
-- Add the parameters for the stored procedure here
@Date varchar(20) = 0,
@Type nchar(10) = 0,
@cust_number varchar(20) = 0,
@Agent_group nchar(10)


AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

    -- Insert statements for procedure here


SELECT TOP 1 Agent FROM SisteAgent
where Agent_group = @Agent_group and Date = @Date and Type = @Type and cust_number = @cust_number
ORDER by ID DESC


END
[/code]

As you can see, I pass 4 values to the stored procedure from my strategy, and I want to return the Agent from my table.

In the logs, when I test it, it doesn't return anything, it just says:

DEvent: nMsgID=MSG_PROCCOMPLETED; nServer=5; nStatus=1; nRequestID=412; nProfileTime 0 szSQLCmd=''; pRecord=0x0
12:14:28.294_D_I_014901b17d70e126 [05:02] MSG_PROCCOMPLETED (status 1) is received from dbserver MM_DBServer
12:14:28.294_I_I_014901b17d70e126 [09:05] >>>>>>>>>>>>resume interpretator(0)
    _I_I_014901b17d70e126 [09:04] ASSIGN: __DBReturn(SCRIPT) <- STRING:
    _I_I_014901b17d70e126 [09:04] ASSIGN: varReturAgent(LOCAL) <- STRING:



??? How do I get hold of the returned value from the stored procedure ???

Anders :)

Offline PavelR

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Inbound voice - last agent routing.
« Reply #3 on: July 30, 2009, 02:26:16 PM »
Hi,
can you send us the definition script of SisteAgent table + any sample data (from SisteAgent table as well as stored procedure input values)? Did you test stored procedure execution in Management Studio (Query Analyzer)?

Regards

pr

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Inbound voice - last agent routing.
« Reply #4 on: July 30, 2009, 09:29:53 PM »
Hi Anders,

Possibilities of IRD are a bit limited when working with stored procedures - it doesn't allow you to work with rows returned by stored procedure. I think there is a trick how to do it but I cannot recall it now.

I would recommend you slight modification of your SP to make it "IRD friendly" ;)

[code]ALTER PROCEDURE [dbo].[find_sisteagent]
-- Add the parameters for the stored procedure here
@Date varchar(20) = 0,
@Type nchar(10) = 0,
@cust_number varchar(20) = 0,
@Agent_group nchar(10),
          @Agent nchar(50) OUTPUT

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
        SET NOCOUNT ON;

    -- Insert statements for procedure here
    SELECT TOP 1 @agent=Agent FROM SisteAgent
    WHERE Agent_group = @Agent_group AND Date = @Date AND Type = @Type AND cust_number = @cust_number
    ORDER by ID DESC

END[/code]

It's necessary to modify your strategy as well:

1/ Open Database Wizard object
2/ On "Procedure" tab - add new parameter: key = "@Agent", value = "@out" (select that value from list, do not type it!)
3/ On next tab "Using output value(s)" choose the 1st option "Assign output value to a variable. Output value is always considered as a string, integer or float"
4/ Select variable you'd like to store returned value on next tab

Hope it helps you
R.

Offline andbra

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Inbound voice - last agent routing.
« Reply #5 on: July 31, 2009, 07:56:23 AM »
Hello!

Thank you for your help this far. :)

PavelR:

I have now modified my SP and my Strategy DB object regarding to Renès description, and that helped alot. :) I wasn't aware of the @out value. I have tested the SP with Query analyzer in Management Studio, and @Agent contains the correct value when testing.

Renè: As I wrote to PavelR, I wasn't aware of the @out value. I now get returned a value, but it is: "x7"

When it should be a text string on the format "XY12345" (or blank if no match)

It returns the same value no matter what the result should be, e.g. when it should be blank it also returns "x7"

I have tried defining @Agent with idfferent Data types, varchar, nchar etc. but they all give me the same result..

Any ideas why the value look like this?  ???

Anders

Offline andbra

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Inbound voice - last agent routing.
« Reply #6 on: July 31, 2009, 11:53:01 AM »
Ok, so I gave up on the Stored procedure approach, and configured fields, table access etc. in config manager to use the built-in SELECT of th DB Wizard in IRD. I now get the AGentID that I want returned, and everything is fine.....so far..

I have the AGentID, and create a variable; varAgentTarget, containing the AgentID (XY12345@MM_StatServer.A). All is fine.

Now I want to know if that agent is ready(WaitForNextCall). Ok, so I create a statistic in IRD, IsAgentReady.

Name: IsAgentReady
Category: CurrentState
Tick box: Agent/Group Statistics
Subject: AgentStatus
Mask: Active
And Choose WaitForNextCall.

When I use the SData[varAgentTarget,'IsAgentReady'],

I get the following in my URS log:

"can not get sdata, 0 will be used"

I have tried getting SData for a number of Statistics with no luck.

This is in a test environment, and this is working in our production environment with the exact same configuration.

What is wrong with this?(Or me?) ;)

Is there any other way of detecting if an agent is ready?

Anders

KBS

  • Guest
Re: Inbound voice - last agent routing.
« Reply #7 on: July 31, 2009, 12:24:56 PM »
Anders -
when you tested for the statistic, did you make more than one call?

In my experience, when the statistic is first requested, you get that message, because URS hasn't tracked the statistic for that object [agent] yet. Subsequent calls for the same agent should produce a statistic for it.

One thought - not sure what your call flow looks like, but would there be a benefit in using the Selection object with the last agent (Timeout 2 seconds, no treatment) instead of checking the statistic first, then targeting? If the agent is available, he/she gets the call. If not, you can continue and target other agents/groups?

Offline andbra

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Inbound voice - last agent routing.
« Reply #8 on: July 31, 2009, 12:36:16 PM »
Hi KBS,

yes, I tested the statistic more than one time, and I noticed that the first time, the statistic was opened, and the request didn't go though. :)

The next time however, I got the error stated in my last post.

Regarding the timeout on the selection object: That is an option, but the specification from the customer states that we should only try to route the call to the selected agent if he's in Ready state. One other issue with this, is that the agent have to answer the call within 2 seconds. :) The customer would probably not notice it if I did it this way, but I prefer doing it as specified.. ;) However, this would actually have one advantage, and that is, if the agent sets himself ready during 2 sec(or other specified timeout), he would actually get the call. :) Maybe I'll check with them if this is preferred.

Anyway, I am curious to why the SData error happens. I have tried restarting StatServer, URS and TServer with no luck.

Anders

Offline Fra

  • Hero Member
  • *****
  • Posts: 856
  • Karma: -3
Re: Inbound voice - last agent routing.
« Reply #9 on: July 31, 2009, 01:17:05 PM »
[quote author=andbra link=topic=4470.msg20098#msg20098 date=1249041181]
I have the AGentID, and create a variable; varAgentTarget, containing the AgentID (XY12345@MM_StatServer.A). All is fine.

Now I want to know if that agent is ready(WaitForNextCall). Ok, so I create a statistic in IRD, IsAgentReady.

Name: IsAgentReady
Category: CurrentState
Tick box: Agent/Group Statistics
Subject: AgentStatus
Mask: Active
And Choose WaitForNextCall.

When I use the SData[varAgentTarget,'IsAgentReady'],

I get the following in my URS log:

"can not get sdata, 0 will be used"

I have tried getting SData for a number of Statistics with no luck.

This is in a test environment, and this is working in our production environment with the exact same configuration.

What is wrong with this?(Or me?) ;)
[/quote]

Andre,
we can help if you post the URS logs. Anyway here some guesses:
[list]
[li]is URS connected to MM_StatServer?[/li]
[li]has the DN the agent logs in been added to a place?[/li]
[li]have you defined the IsAgentReady stat in MM_StatServer?[/li]
[li]can you use try to test your strategy adding an 'IF block' with SData[varAgentTarget,'StatAgentsAvailable'] = 1 ?[/li]
[/list]

Fra

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Inbound voice - last agent routing.
« Reply #10 on: July 31, 2009, 01:23:47 PM »
Anders,

SData won't work as it requires an agent to be identified by EmployeeId not by AgentId. Correct format is: <Agent EmployeeId>@<StatServer Name>.A

You can find more info about SData and target types in Universal Routing Reference Guide.

R.

Offline andbra

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Inbound voice - last agent routing.
« Reply #11 on: July 31, 2009, 01:40:01 PM »
Hi Fra,


[list]
[li]URS is connected to MM_StatServer.[/li]
[li]The DN has been added to a place, the place is working, and calls get routed to the agent correctly.[/li]
[li]The Statistic IsAgentReady is not defined in MM_StatServer, it is defined in IRD, I thought that should be enough?[/li]
[li]I tried SData[varAgentTarget,'StatAgentsAvailable'], but got the same error message in the URS log as I got with the IsAgentReady statistic. I also tried the StatAgentsTotal on an Agent group which I knew there were agents in, and I got the same error..[/li]
[/list]

Renè:

Sorry, bad wording on my part. :) AgentID is the same as EmployeeId.

Here is some lines from the URS log using IsAgentReady statistic:

[code]
15:30:57.553_M_I_ [10:06] STATOBJECT(02fcdeb0 10 2) tenant=Resources name=XY12345@MM_StatServer.A: statistic <IsAgentReady> asked
   _I_E_014901b6c6dc2015 [10:0d] can not get sdata, 0 will be used
 result of SData: FLOAT: 0
   _I_I_014901b6c6dc2015 [09:04] ASSIGN: vAgentStatus(LOCAL) <- FLOAT: 0

15:30:57.553 Int 22000 0
15:30:57.553_I_I_014901b6c6dc2015 [07:07] HERE IS TARGETS
TARGETS: XY12345@MM_StatServer.A
15:30:57.553_M_I_ [17:0c] VQ 02fa1d60 created: type=0, tenant=Resources
==========================================
   _M_I_ [17:06] VQ 02fa1d60 Target 02fd5d50 added: name=XY12345, location=MM_StatServer, type=A, state=##state, activity=unknown
15:30:57.553_M_I_ [10:06] STATOBJECT(02f9f3c0 18 2) tenant=Resources name=XY12345@MM_StatServer.A: statistic <##state> asked
   _M_I_ [17:09] VQ 02fa1d60 Target "XY12345"(02fd5d50): connected to state Agent XY12345
[/code]

And here is URS log using StatAgentsAvailable:

[code]
_I_I_014901b6c6dc2019 [10:0d] HERE IS SDATA: XY12345@MM_StatServer - StatAgentsAvailable
15:34:22.522_M_I_ [10:06] STATOBJECT(02fc3b20 39 2) tenant=Resources name=XY12345@MM_StatServer.A: statistic <StatAgentsAvailable> asked
   _I_E_014901b6c6dc2019 [10:0d] can not get sdata, 0 will be used
 result of SData: FLOAT: 0
   _I_I_014901b6c6dc2019 [09:04] ASSIGN: vAgentStatus(LOCAL) <- FLOAT: 0

15:34:22.522 Int 22000 0
15:34:22.522_I_I_014901b6c6dc2019 [07:07] HERE IS TARGETS
TARGETS: XY12345@MM_StatServer.A
15:34:22.522_M_I_ [17:0c] VQ 0262ddd0 created: type=0, tenant=Resources
==========================================
   _M_I_ [17:06] VQ 0262ddd0 Target 02fc8730 added: name=XY12345, location=MM_StatServer, type=A, state=##state, activity=unknown
15:34:22.522_M_I_ [10:06] STATOBJECT(02f9f3c0 18 2) tenant=Resources name=XY12345@MM_StatServer.A: statistic <##state> asked
   _M_I_ [17:09] VQ 0262ddd0 Target "XY12345"(02fc8730): connected to state Agent XY12345
[/code]

Here is the Selection part when the call gets routed:

[code]
_M_I_014901b6c6dc2019 [10:0c] tenant Resources Agent XY12345: dn XXXXX(ready since 1249047225) is OK
   _M_I_014901b6c6dc2019 [17:0b] VQ 0262ddd0 Target "XY12345"(02fc8730) Component #1 XY12345: statvalue: 0, 0(N) the best
   _M_I_014901b6c6dc2019 [17:0b] VQ 0262ddd0 Target "XY12345"(02fc8730): Component XY12345 was SELECTED
   _M_I_014901b6c6dc2019 [17:0e] VQ 0262ddd0 Target "XY12345"(02fc8730): statvalue: 0, 9.18881801813e-007(N) the best

.
.
.

========== DN Information ===========
DN Number XXXXX(edited out)
DN Access XXXXX(edited out)
Agent Name XY12345
Place Name XXXXX(edited out)
Agent Login XXXXX(edited out)
Switch Name XXXXX(edited out)
DN Type 1
=====================================
====================== Target Information =====================
Target Name     < XY12345>
Target Location < MM_StatServer >
Target Type     < A >
STATE MAPPING INFO - STATISTIC < ##state >:
Stat Server DN info available
Modelling Statistic  : NOT available
==============================================================
[/code]

Anders
« Last Edit: July 31, 2009, 01:52:06 PM by andbra »

Offline Fra

  • Hero Member
  • *****
  • Posts: 856
  • Karma: -3
Re: Inbound voice - last agent routing.
« Reply #12 on: July 31, 2009, 02:45:11 PM »
[quote author=andbra link=topic=4470.msg20106#msg20106 date=1249047601]
[list][li]The Statistic IsAgentReady is not defined in MM_StatServer, it is defined in IRD, I thought that should be enough?[/li][/list]
[/quote]
No, it's not. Defining a stat in IRD just helps you re-use it, that doesn't mean that will be automatically configured in Stat Server.

[quote author=andbra link=topic=4470.msg20106#msg20106 date=1249047601]
[list][li]I tried SData[varAgentTarget,'StatAgentsAvailable'], but got the same error message in the URS log as I got with the IsAgentReady statistic. I also tried the StatAgentsTotal on an Agent group which I knew there were agents in, and I got the same error..[/li][/list]
[/quote]
Can you open a CCPulse on the MM_StatServer and see whether you can monitor the agent and the agent group he is in with the stats you are trying to use? (well, you have to define them and restart StatServer first).

Fra


Offline kubikle

  • Full Member
  • ***
  • Posts: 140
  • Karma: 7
Re: Inbound voice - last agent routing.
« Reply #13 on: July 31, 2009, 07:59:39 PM »
Could log of router and/or statserver be checked for presence of StatInvalid message (sent by statserver to router)? Its presence could be reason of why router returns 0.