Genesys CTI User Forum
Genesys CTI User Forum => Genesys-related Development => Topic started by: Kubig 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
-
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
-
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.
-
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
-
Hi,
does not matter. Where do you get "agentESDK_",which you used as argument in method AgentServiceExtensions.Ready()?
thx
-
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
-
Many thanks for your reply...What parameter values do you set in GetDevice method? Or where do you get this values(channelName,deviceName)?
thx
-
Hi
It is from Workspace agent object.
String deviceName = agent_.FirstMediaVoice.Device.Name;
String channelName = agent_.FirstMediaVoice.Channel.Name;
Regards
Robert
-
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?
-
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
-
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
-
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
-
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?
-
Hi
You're welcome.
:-) it is up to you what you want to achieve :-).
Regards
Robert
-
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.
-
Hi
Same way it will never work.
You want to request interaction server not tserver.
[code]
Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.ReasonInfo reasons = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.ReasonInfo.Create("BCW", "0");
Genesyslab.Enterprise.Model.Channel.IClientChannel chnl = agent_.FirstMediaEmail.Channel;
log_.Info("channel protocol id: " + isrv.ServerContext.ProxyId);
RequestCancelNotReadyForMedia request = RequestCancelNotReadyForMedia.Create(isrv.ServerContext.ProxyId+1, null, "email", reasons);
chnl.Protocol.Request(request);
[/code]
I did short test with request using platform sdk.
But there is media type and proxy client id hardcoded.
Maybe it will give you some hint.
Regards
Robert
-
Thx for your reply and hints. May be, I am on low-level SDK and I think,that I would use IWS commands. Commands for voice and openmedia contents request Ready with KeyValueCollection in parameter. So,I have created new topic.
I think,that I should use IdentityServiceExtensions and method ReadyMultimedia - but I cannot configure correctly all required parameters yet :-( I still get exception " No place for agent"
Thanks again for all,Robert.