In my custom extension to Workspace Desktop Edition I want to open a connection to Interaction Server and create a new interaction with attached data.
Genesys recommend to do it in this way:
-----------------------------------------------------------------------------------------------------------
InteractionServerProtocol interactionServerProtocol = new InteractionServerProtocol(
new Endpoint("InteractionServer", host, port));
interactionServerProtocol.ClientName = "EntityListener";
interactionServerProtocol.ClientType = InteractionClient.MediaServer;
KeyValueCollection userData = new KeyValueCollection();
userData.Add("crmactivityid", activityid);
userData.Add("crmactivitytype", activitytype);
try
{
interactionServerProtocol.Open();
RequestSubmit requestSubmit = RequestSubmit.Create(
interactionServerProtocol.ProxyId,
null,
null,
inboundQueue,
tenantID,
"crmemail",
"Inbound",
"InboundNew",
true,
System.DateTime.UtcNow,
userData,
null,
null,
null);
IMessage response =
interactionServerProtocol.Request(requestSubmit);
WriteToLog("Response: " + response.Name);
}
catch(Exception exception)
{
WriteToLog(
"Exception while sending request to interaction server: " +
exception.Message);
}
-----------------------------------------------------------------------------------------------------------
But I believe that the using of existing channel with Interaction Server is more efficient method.
Currently, I use the existing channel with the server in this way:
-----------------------------------------------------------------------------------------------------------
IChannelManager channelManager = container.Resolve<IChannelManager>();
Genesyslab.Enterprise.Model.Channel.IClientChannel interactionServerChannel =
channelManager.Register(INTERACTION_SERVER_NAME, "WDE");
InteractionServerProtocol interactionServerProtocol = (InteractionServerProtocol)interactionServerChannel.Protocol;
try
{
RequestSubmit requestSubmit = RequestSubmit.Create(MEDIA_TYPE, INTERACTION_TYPE);
requestSubmit.Queue = defaultQueue;
requestSubmit.TenantId = agent.ConfPerson.Tenant.DBID;
requestSubmit.InteractionSubtype = INTERACTION_SUBTYPE;
requestSubmit.IsOnline = false;
requestSubmit.ProxyClientId = interactionServerProtocol.ServerContext.ProxyId + 1;
requestSubmit.UserData = userData;
IMessage response = interactionServerProtocol.Request(requestSubmit);
if (response != null && response.Name != "EventError")
{
EventAck eventAck = (EventAck)response;
}
}
catch (Exception exception)
{
LogException(exception);
}
-----------------------------------------------------------------------------------------------------------
As you can see, there is "requestSubmit.ProxyClientId = interactionServerProtocol.ServerContext.ProxyId + 1;" line of code in C#. Interaction Server does not create interaction without ProxyClientId determining. But using of "interactionServerProtocol.ServerContext.ProxyId + 1" is not entirely correct method.
Maybe, there is a more correct method to define ProxyClientId. In other words, how to use an existing channel with Interaction Server?
Please, advice.