PureConnect

 View Only

Discussion Thread View
  • 1.  attribute is not being watched. Name: Eic_State

    Posted 11-05-2010 20:34
    In my Session_ConnectCompleted event I have code that looks like the below: var attrs = new List<string> {InteractionAttributeName.State}; this.InteractionQueue.StartWatching(attrs.ToArray()); and later on I check state in various places, for example: public bool IsOnCall { get { var onCall = (null != this.PhoneSession && null != this.CallInteraction && this.PhoneSession.ConnectionState == ConnectionState.Up && this.CallInteraction.State != InteractionState.ExternalDisconnect && this.CallInteraction.State != InteractionState.InternalDisconnect); return onCall; } } Sometimes and it seems sporadic, I get the below exception doing this: Exception outermost view of call stack -------------------------------------------------------------------------------- Exception type: ININ.IceLib.NotCachedException Source: ININ.IceLib.Interactions Source Assembly: ININ.IceLib.Interactions.DLL Source Assembly Version: 0.0.0.0 Source Type: ININ.IceLib.Interactions.WatchedAttributeCache Source Method: System.String GetAttributeAsString(System.String) Debug Build?: True Message: The requested object or attribute is not being watched. Name: Eic_State Stack Trace: at ININ.IceLib.Interactions.WatchedAttributeCache.GetAttributeAsString(String name) at ININ.IceLib.Interactions.Interaction.GetWatchedStringAttribute(String attributeName) at ININ.IceLib.Interactions.Interaction.get_State() at TeamWorks.Shared.CTI.PhoneAgent.get_IsOnCall() at TeamWorks.Shared.CTI.PhoneAgent.Call(DialInfo dialInfo) I'm already watching State and there is no EIC State attribute as far as I can see. Any ideas on what might be causing this and how to resolve? Thanks


  • 2.  RE: attribute is not being watched. Name: Eic_State

    Posted 11-11-2010 19:08
    Any chance this is in a method that is being called from an event? If so, you may be on the wrong thread when the call comes back.


  • 3.  RE: attribute is not being watched. Name: Eic_State

    Posted 11-11-2010 19:13
    At the point of the crash, no. I thought it might be a threading issue at first but it appeared to be on the same thread and when I checked IsWatching(attributeName) it said true at the point of the exception. The crash would appear to happen at random after several different connects/disconnects and various phone operations over time. In any event I changed the code to save the state property to a variable anytime it changed. The code then checks the variable instead of Interaction.State (in theory they should always be in sync).


  • 4.  RE: attribute is not being watched. Name: Eic_State

    Posted 11-12-2010 18:51
    If I were to add this back or monitor other attributes, how would I handle watching attributes on both threads? Currently I call StartWatching in the Session_ConnectCompleted event which I would assume would be back on the main UI thread from which the session was kicked off from?


  • 5.  RE: attribute is not being watched. Name: Eic_State

    Posted 11-12-2010 19:02
    It should be on the correct thread, but there is and easy way to check. If (InvokeRequired) { blah blah blah } If it takes the InvokeRequired path then that means it came back on a thread other than the main thread.


  • 6.  RE: attribute is not being watched. Name: Eic_State

    Posted 11-12-2010 19:08
    Yeah I already have the proper InvokeRequired checked in there at least for the UI control portion. However the main class is not a Control so InvokeRequired doesn't work and I have to use SynchronizationContext. My question was more to the effect of if I wire up InteractionQueue_InteractionChanged on the main UI thread will that fire regardless of whether the change happened using an IceLib Async or Sync method/event? Something still seems up though because before the exact same steps would work for a while then suddenly not over time. Almost as if something times out/ goes out of scope etc. Is there a way to perhaps write the code defensively in such a way to ensure the attribute is watched / available no matter what?


  • 7.  RE: attribute is not being watched. Name: Eic_State

    Posted 11-12-2010 19:37
    As long as the InteractionChanged event comes back on the gui thread you should be ok. I don't know of any way to code it defensively, but here's how I have my InteractionChanged event coded. _myInteractions.InteractionChanged += new EventHandler<InteractionAttributesEventArgs>(_myInteractions_InteractionChanged); void _myInteractions_InteractionChanged(object sender, InteractionAttributesEventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(new EventHandler<InteractionAttributesEventArgs>(_myInteractions_InteractionChanged), new object[] { sender, e }); } else { updateMyInteractionsList(e.Interaction); if (lvMyInteractions.SelectedItems.Count > 0) { if (lvMyInteractions.SelectedItems[0].Name == e.Interaction.InteractionId.ToString()) { updateCallControlButtons(e.Interaction); } } } }


Need Help finding something?

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