PureConnect

 View Only
Discussion Thread View
Expand all | Collapse all

Why the QueueInteractionAdded event handles waits until the recipient picks up?

  • 1.  Why the QueueInteractionAdded event handles waits until the recipient picks up?

    Posted 11-28-2017 22:14
    I am trying to use the IceLib in a Asp.Net MVC 5 Environment. So far, I am able to interact with the interaction successful. With an issue in the queue watching process. To watch my queue, I create a WebSocket connection between the browser and the server using SignalR package. Inside my SignalR Hub, I call the following code when the client connects to the server so when a interaction is added, changes or removed from the queue, the browser is notified. private void WatchMyInteractions(ViewCompanyServer dialerServer) { var interactionManager = GetInteractionManager(ConnectionManager); QueueId queueId = new QueueId(QueueType.MyInteractions, GetIdentity.Name); InteractionQueue _interactionQueue = new InteractionQueue(interactionManager, queueId); _interactionQueue.InteractionAdded += QueueInteractionAdded; _interactionQueue.InteractionChanged += QueueInteractionChanged; _interactionQueue.InteractionRemoved += QueueInteractionRemoved; _interactionQueue.StartWatching(GetAttributes()); } public void QueueInteractionAdded(object sender, InteractionAttributesEventArgs e) { // This line sends the interaction attributes to the browser SendInteraction(e.Interaction, "Added"); // PROBLEM - this code hangs until the recipient pick up before the message is sent to the browser. } public void QueueInteractionChanged(object sender, InteractionAttributesEventArgs e) { // This line sends the interaction attributes to the browser SendInteraction(e.Interaction, "Changed"); } public void QueueInteractionRemoved(object sender, InteractionEventArgs e) { // This line sends the interaction attributes to the browser SendInteraction(e.Interaction, "Removed"); } protected void SendInteraction(Interaction interaction, string type) { if (interaction != null) { // This just create a new GenericModel with the attributes that are being watched. var obj = new InteractionQueueGenericModel(interaction, type); // This line converts the object to json then send it to the browser. Clients.User(GetIdentity.Name).updatePhone(JsonConvert.SerializeObject(obj)); } } However, I am running into a problem when making the call while watching my Queue. When the call is made using the code below, the application waits/hangs until the other-party/recipient picks up before the `SendInteraction(e.Interaction, "Added")` is processed. So the browser, won't know that a call is being made "or the it does not know that e.Interaction.State == "Proceeding" " until after the SendInteraction() method is called. In another words, the `QueueInteractionAdded()` method gets called, but it hang on the `SendInteraction()` line until the other party picks up before the message is sent to the browser. Then after that, any change to the interaction the user is notified correctly. I currency make my calls using following code InteractionsManager.GetInstance(session).MakeCall(new CallInteractionParameters("800-000-4444")); How can I prevent the app from having to wait on the `SendInteraction(e.Interaction, "Added")` line? What am I doing wrong here?


  • 2.  RE: Why the QueueInteractionAdded event handles waits until the recipient picks up?

    Posted 11-29-2017 16:41
    I think I figured out how to get it to work without having to wait, but not sure the exact cause! It seems that one of more of the following attributes takes a while to get populated which cause the app to take a while. private static readonly string[] _WatchedAttributes = { InteractionAttributeName.RemoteAddress, InteractionAttributeName.RemoteName, InteractionAttributeName.RemoteId, InteractionAttributeName.Direction, InteractionAttributeName.CallType, InteractionAttributeName.StateDescription, InteractionAttributeName.Muted, InteractionAttributeName.ConferenceId, InteractionAttributeName.LocalId, InteractionAttributeName.LocalName, "Eic_CallState" } So to get this to work, I only accessed the following properties on the `QueueInteractionAdded` event CallIdKey, InteractionId.Id, State and Direction.


Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources