Author Topic: IWS - Custom ready state  (Read 13454 times)

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
IWS - Custom ready state
« on: November 13, 2012, 03:32:34 PM »
Hi All,
did somebody solve following requirement:

I want to change agent's state from IWS.So,I wrote custom code,but current DLL files from IWS (Genesys.Desktop) does not contain method,which allows to send "ReasonCodes" for Ready state.

Could you,please,point me to the solution - have to use other namespace(PSDK)?

Many thanks

Offline RobertH

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
Re: IWS - Custom ready state
« Reply #1 on: November 14, 2012, 04:27:19 PM »
Hi

Are you sure?
Did you try this?

Interaction Workspace 8.1.1 .NET Developer's Guide and API Reference
NotReady Method

Namespaces ► Genesyslab.Desktop.Modules.Core.Model.Agents ► IAgent ► NotReady()

NotReady() Sets the agent's state to Not Ready.

NotReady(String) Sets the current agent's state to Not Ready with Action Code. 

Regards
Robert

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: IWS - Custom ready state
« Reply #2 on: November 15, 2012, 07:21:36 AM »
But,as I wrote...I need set [b]Ready [/b]state with ReasonCode. In BusinessAttributes I can create ReadyState with ReasonCode,but in IWS I cannot use it.

Offline RobertH

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
Re: IWS - Custom ready state
« Reply #3 on: November 15, 2012, 07:34:55 AM »
Hi

Sorry my fault.

Then you need to use enterprise SDK.
using Genesyslab.Enterprise.Extensions;

IEnterpriseServiceProvider serviceProvider = agent_.EntrepriseService.Provider;
IDeviceService deviceService = serviceProvider.Resolve<IDeviceService>("deviceService");
IIdentityService identityService = serviceProvider.Resolve<IIdentityService>("identityService");

Genesyslab.Enterprise.Model.Device.IDevice deviceS = deviceService.GetDevice(deviceName, tenantName, channelName);

KeyValueCollection Reasons = new KeyValueCollection();
KeyValueCollection Extensions = new KeyValueCollection();
AgentServiceExtensions.Ready(identityService, agentESDK_, deviceS, null, WorkMode.Unknown, Reasons, Extensions);

I used it for NotReady lond time ago but can see it is available also for ready status.
Consult ESDK AgentServiceExtensions..::.Ready Method (IIdentityService, IAgent, IDevice, String, WorkMode, KeyValueCollection, KeyValueCollection)

Regards
Robert

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: IWS - Custom ready state
« Reply #4 on: November 15, 2012, 12:15:48 PM »
Hi,
does not matter. Where do you get "agentESDK_",which you used as argument in method AgentServiceExtensions.Ready()?

thx

Offline RobertH

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
Re: IWS - Custom ready state
« Reply #5 on: November 15, 2012, 08:32:10 PM »
Hi

Can be done this way:

using Genesyslab.Desktop.Modules.Core.Model.Agents;

private Genesyslab.Enterprise.Agent.IAgent agentESDK_;

// this is Workspace agent
IAgent agent_;

// this is enterprise agent
agentESDK_ = agent_.EnterpriseAgent;

Regards
Robert

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: IWS - Custom ready state
« Reply #6 on: November 16, 2012, 10:15:29 AM »
Many thanks for your reply...What parameter values do you set in GetDevice method? Or where do you get this values(channelName,deviceName)?

thx

Offline RobertH

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
Re: IWS - Custom ready state
« Reply #7 on: November 16, 2012, 04:16:58 PM »
Hi

It is from Workspace agent object.

String deviceName = agent_.FirstMediaVoice.Device.Name;
String channelName = agent_.FirstMediaVoice.Channel.Name;

Regards
Robert

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: IWS - Custom ready state
« Reply #8 on: November 19, 2012, 08:30:55 AM »
Great,Robert. Many thanks...all works fine.

I have last question,if I use ESDK for set Ready state with ReasonCode,change of state take a "long" time(5sec),via IWS dll is more quickly..is any way how to improve it?

Offline RobertH

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
Re: IWS - Custom ready state
« Reply #9 on: November 19, 2012, 05:53:58 PM »
Hi

You're welcome.
Have no idea. Request should be sent instantly, if you don't delay in code. How fast is response from tserver can be verified from tserver logs.

Regards
Robert

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: IWS - Custom ready state
« Reply #10 on: November 26, 2012, 12:09:48 PM »
Hi,
it's not a problem on Genesys site. That seems like the code take a long time. In T-Server logs I see that if the request received,the event is created immediately and have sended to the client. The create of request take a long time

Offline RobertH

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
Re: IWS - Custom ready state
« Reply #11 on: November 29, 2012, 03:12:22 PM »

Hi

You are right from extensions it takes some time.
I did create new project just to verify this and result can look like this:

[code]

public void Create()
        {
            agentESDK_ = agent_.EnterpriseAgent;
            IEnterpriseServiceProvider serviceProvider = agent_.EntrepriseService.Provider;
            IDeviceService deviceService = serviceProvider.Resolve<IDeviceService>("deviceService");
            identityService_ = serviceProvider.Resolve<IIdentityService>("identityService");
            String deviceName = agent_.FirstMediaVoice.Device.Name;
            String channelName = agent_.FirstMediaVoice.Channel.Name;

            string device = agent_.FirstMediaVoice.Device.ToString();
            string[] tenant = device.Split(' ');
            string[] arrTenantName = tenant[1].Split('=');
            string tenantName = arrTenantName[1];
            tenantName = tenantName.Replace(";", "");

            deviceS_ = deviceService.GetDevice(deviceName, tenantName, channelName);
            log_.Info("OK");
           
        }

private void button1_Click(object sender, RoutedEventArgs e)
        {

            log_.Info("Click");
            KeyValueCollection Reasons = new KeyValueCollection();
            KeyValueCollection Extensions = new KeyValueCollection();
            Reasons.Add("BCW", "0");
           
            identityService_.Ready(agentESDK_, deviceS_, "", WorkMode.Unknown, Reasons, Extensions, 1000);
            log_.Info("OK");

        }

[/code]

Reaction is about 1 second ... it is timeout set in request I sent.
Workspace log:

[code]

12-11-29 16:05:53.597 [            1] INFO  ace.Test.TWRegionBtn - Click
12-11-29 16:05:53.607 [            14] WARN                  ESDK - [GetVirtualDevice] Virtual Device is identical as input device 5001
12-11-29 16:05:53.608 [            14] WARN                  ESDK - [GetVirtualMessage] No Switch Policy profile found for [Request] RequestAgentReady
12-11-29 16:05:53.630 [defaultInvoker] INFO                  ESDK - Voice strategy 'VoiceProtocolEventStrategy' [Dn] 5001 Processing msg [Name] EventAgentReady [EndPoint] sip_server - tcp://120-gen8:6000
12-11-29 16:05:53.710 [            14] INFO  edia.AgentMultimedia - DeviceEvent State:'Registered' Message:'' AgentMultimedia 'a5001' Place 'p5001'
12-11-29 16:05:53.741 [            16] INFO  Media.MediaOpenMedia - [AgentEvent Begin] event:EventCurrentAgentStatus ReferenceId:-1 State:LoggedIn  SourceDevice:p5001[workitem(workitem)]
12-11-29 16:05:53.764 [            16] INFO  Media.MediaOpenMedia - [AgentEvent End] ReferenceId:-1 [workitem(workitem)]
12-11-29 16:05:53.838 [            4] INFO  edia.AgentMultimedia - [AgentEvent Begin] event:EventCurrentAgentStatus ReferenceId:-1 State:LoggedIn AgentMultimedia 'a5001' Place 'p5001'
12-11-29 16:05:53.860 [            4] INFO  edia.AgentMultimedia - [AgentEvent End] ReferenceId:-1 AgentMultimedia 'a5001' Place 'p5001'
12-11-29 16:05:53.991 [            14] INFO  edia.AgentMultimedia - DeviceEvent State:'Registered' Message:'' AgentMultimedia 'a5001' Place 'p5001'
12-11-29 16:05:54.018 [            4] INFO  edia.AgentMultimedia - [AgentEvent Begin] event:EventCurrentAgentStatus ReferenceId:-1 State:LoggedIn AgentMultimedia 'a5001' Place 'p5001'
12-11-29 16:05:54.021 [            16] INFO  Media.MediaOpenMedia - [AgentEvent Begin] event:EventCurrentAgentStatus ReferenceId:-1 State:LoggedIn  SourceDevice:p5001[workitem(workitem)]
12-11-29 16:05:54.022 [            16] INFO  Media.MediaOpenMedia - [AgentEvent End] ReferenceId:-1 [workitem(workitem)]
12-11-29 16:05:54.025 [            4] INFO  edia.AgentMultimedia - [AgentEvent End] ReferenceId:-1 AgentMultimedia 'a5001' Place 'p5001'
12-11-29 16:05:54.030 [            16] INFO                  ESDK - [Agent] 5001 (FQN=098b4b3e-bb79-4e20-a94a-75a5a764e3ea) Found Virtual Device '5001' (FQN=c35533b7-92c9-44a9-ba1b-81bdb3a0c4bf)
12-11-29 16:05:54.031 [            16] INFO  ice.Voice.MediaVoice - [AgentEvent Begin] EventAgentReady AgentID 5001 State:Ready  [voice, AgentId:5001, SIP(5001)]
12-11-29 16:05:54.358 [            16] INFO  ndpointCommunication - 5001 is a SIP DN. Look for an already started SIP Endpoint for this DN and Sip Server 192.168.1.120:5060.
12-11-29 16:05:54.359 [            16] INFO  ndpointCommunication - There is already an IW SIP Endpoint for this 5001 SIP DN.
12-11-29 16:05:54.625 [            1] WARN                  ESDK - Proxy [EndInvoke] Timeout on internal [ReqId] 6 Submitted [ReqId] -1 after (1006,0575 ms)
12-11-29 16:05:54.628 [            1] INFO  ace.Test.TWRegionBtn - OK

[/code]

Hope this will help.
Robert

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: IWS - Custom ready state
« Reply #12 on: November 30, 2012, 09:16:44 AM »
Great job,Robert! Thank you very much.

May I have last question?... I would like to change status of whole place(ie. voice,email,chat,.., channels) - it is possible to change whole "place" status or what code do you preffer?

Offline RobertH

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
Re: IWS - Custom ready state
« Reply #13 on: November 30, 2012, 08:29:24 PM »
Hi
You're welcome.

:-) it is up to you what you want to achieve :-).

Regards
Robert


Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: IWS - Custom ready state
« Reply #14 on: December 01, 2012, 11:27:45 PM »
Yes, I would like to set same reason code at email channel - but similiar code for email does not work,logically. Did you any hint for me,Robert? Not Ready state on both channel type via "IWS" SDK is OK.