PureConnect

 View Only

Discussion Thread View
  • 1.  How do I get the CallIdKey after making a call?

    Posted 10-23-2017 23:53
    I have a CRM application that is written on the top of Asp.NET MVC 5 framework. I need to add a button to allow my users to click to place a call. Once the call is placed, I need to be able to retrieve the CallIdKey from the interaction and store it into my CRM records. Each time I try to access the `CallIdKey` attribute i get the following exception
    Additional information: The requested object or attribute is not being watched. Name: Eic_CallIdKey
    Questions 1) How do I get the `CallIdKey` attribute or how to I add a watch to be able to that info? 2) Currently as you can see from my code, I make a new connection/session for each request to the server, I am guessing this is a bad practice. How can I establish a connection between my app and the IC server and keep that connection alive until the user logout from my app? Here is my code using ININ.IceLib.Connection; using ININ.IceLib.Interactions; using System; using System.Threading.Tasks; using System.Web.Mvc; namespace IceLibTest.Controllers { public class HomeController : Controller { private Session _dialerSession; private InteractionsManager _interactionsManager; // Sign in and set the dialer session protected void SignIn() { SessionSettings sessionSettings = new SessionSettings(); var hostSettings = new HostSettings(new HostEndpoint("MyServerName")); var authSettings = new WindowsAuthSettings(); var stationSettings = new StationlessSettings(); _dialerSession = new Session(); _dialerSession.Connect(sessionSettings, hostSettings, authSettings, stationSettings); } // Get an instance of the interaction manager protected InteractionsManager GetInteractionManager() { if (_interactionsManager == null) { if(_dialerSession == null) { SignIn(); } _interactionsManager = InteractionsManager.GetInstance(_dialerSession); } return _interactionsManager; } // Make a call public JsonResult MakeCall(string phone, int taskId) { var call = new CallInteractionParameters(phone); call.AdditionalAttributes["TaskId"] = taskId.ToString(); var interaction = GetInteractionManager().MakeCall(call); if (interaction == null) { return Json(new { CallIdKey = null, Result = "Failed"}, JsonRequestBehavior.AllowGet); } return Json(new { CallIdKey = interaction.CallIdKey, Result = "Success"}, JsonRequestBehavior.AllowGet); } } }


  • 2.  RE: How do I get the CallIdKey after making a call?

    Posted 10-24-2017 13:39
    Try using the GetStringAttribute method, assuming the Interactionid property is just the 10 digit interaction id.. return Json(new { CallIdKey = interaction.GetStringAttribute("Eic_CallIdKey"), Result = "Success"}, JsonRequestBehavior.AllowGet); This may be the shortest method to get the value. Otherwise you will have to setup watches.


  • 3.  RE: How do I get the CallIdKey after making a call?

    Posted 10-24-2017 14:21
    Originally posted by Seanatron;36125
    This may be the shortest method to get the value. Otherwise you will have to setup watches.
    The GetStringAttribute() method worked. Can you please share some code with me on how to properly setup a watcher? Also, at what point in time I would start watching? I would like to watch the call, and listen for the disconnect event. so when the call is disconnected, I want to do something else.


  • 4.  RE: How do I get the CallIdKey after making a call?

    Posted 10-24-2017 21:32
    Originally posted by malhayek;36127
    The GetStringAttribute() method worked. Can you please share some code with me on how to properly setup a watcher? Also, at what point in time I would start watching? I would like to watch the call, and listen for the disconnect event. so when the call is disconnected, I want to do something else.
    You may need to create a class instantiated at login that sets up the watches of InteractionQueue // For this example, we are interested in the "MyInteractions" queue of a user with ID "userid". QueueId queueId = new QueueId(QueueType.MyInteractions, "userid"); _interactionQueue = new InteractionQueue(_interactionsManager, queueId); // For this example, we are interested in watching the StateDescription and RemoteId attributes of the Interactions // in the Queue. The watched attributes can also include custom attribute names. // // Any attribute that will later be retrieved from the Interaction must be included in an Interaction or InteractionQueue // watch that the Interaction instance is part of. string[] watchedAttributes = new[] { InteractionAttributeName.StateDescription, InteractionAttributeName.RemoteId }; // Individual interaction and conference interaction adds/removes/changes can be received, // as an alternative to the "batching" of QueueContentsChanged. // (If there is a QueueContentsChanged event handler, then the individual added/removed/changed events will not be fired.) _interactionQueue.InteractionAdded += QueueInteractionAdded; _interactionQueue.InteractionChanged += QueueInteractionChanged; _interactionQueue.InteractionRemoved += QueueInteractionRemoved; _interactionQueue.ConferenceInteractionAdded += QueueConferenceInteractionAdded; _interactionQueue.ConferenceInteractionChanged += QueueConferenceInteractionChanged; _interactionQueue.ConferenceInteractionRemoved += QueueConferenceInteractionRemoved; _interactionQueue.LostRights += QueueLostRightsEventHandler; // Subscribe to events before starting the watch. You can just do QueueContentsChanged if you do not want all of those watches. I am still learning the intricacies of MVC and implementing with IceLib, so I am not entirely sure how you would inform the users of these changes without some sort of polling or message system to the client (AJAX). In my thinking this way again, I keep leaning towards ICWS or a .NET Web Forms site. Interested on how you are accomplishing EDIT: There is an AspIceLibClientDemo sample application installed if you need some extra info. This is not an MVC application of course.


  • 5.  RE: How do I get the CallIdKey after making a call?

    Posted 10-24-2017 21:52
    Yeah that's what is confusing me. Even if I watch when the user login. I would need to be able to send a message back to the client saying here is what have been added/changed/removed. somehow the client need to handle the changes. I will need some kind of a demon running 1) Keep the session Alive between the Client and the server. 2) Keep watching the queue as long as the session is alive. I think the best way to do that using a web app is WebSocket. I am not sure if IceLib offer alternative solution. I wish someone with experience shed some light on this topic. Perhaps someone from the dev team. Now sure if there is an way to bring this thread to someone's attention.


Need Help finding something?

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