03-04-2019 06:02 AM
On Finesse agent 11, when an agent is having an active conversation with a caller and he accidentally closes the web browser, the voice conversation does not get cut off, which is good. When he re-opens the browser and logs back in, is there a way to recover the dialog object in Finesse JavaScript API? user.getDialogs will return an empty list, so does user.getDialogsNoCache (which is not expected given the name).
While using Finesse Web API will retrieve the active dialog, but it's quite a hassle to convert it to JavaScript Dialog object. Is there an easier way?
Solved! Go to Solution.
03-05-2019 10:59 AM
Hi,
user.getDialogs() is working for me. Are you sure you are putting the code in the right place? I used the LearningSampleGadget as the base and here is my snippet of code modification:
handleUserLoad = function (userevent) { // Get an instance of the dialogs collection and register handlers for dialog additions and // removals dialogs = user.getDialogs( { onCollectionAdd : handleNewDialog, onCollectionDelete : handleEndDialog, onLoad : function() { numDialogs = dialogs.getDialogCount(true); $("#numDialogs").text(numDialogs); _dialogCollection = dialogs.getCollection(); for (var dialogId in _dialogCollection) { if (_dialogCollection.hasOwnProperty(dialogId)) { dialog = _dialogCollection[dialogId]; displayCall(dialog); } } } }); render(); },
I followed the steps that you had listed previously of the agent being on the call, close the browser window and log back in. When I logged back in, I saw the call info.
Thanx,
Denise
03-04-2019 12:38 PM
Hi,
Using the final LearningSampleGadget, I breakpointed the portion of the code where it calls user.getDialogs.
handleUserLoad = function (userevent) { // Get an instance of the dialogs collection and register handlers for dialog additions and // removals dialogs = user.getDialogs( { onCollectionAdd : handleNewDialog, onCollectionDelete : handleEndDialog }); render(); }
When I refreshed the page after the agent has a call, I was able to see that the dialogs variable has a length of 1. When I drilled down into the variable via the browser debugger, I was able to see the info.
I know you said that user.getDialogs returns an empty list. Where is the user.getDialogs call in your code? It has to be after the user is loaded.
Thanx,
Denise
03-04-2019 03:49 PM
Hi Denise, thanks for the reply. I think you may have misunderstood my original message. Please use the following steps to reproduce the scenario in question:
1. Sign into Finesse, wait for an inbound call, pick up. Of course at this point, user.getDialogs will return the dialog correctly, all is good there.
2. While the agent and the caller are talking, do NOT hang up, do NOT log out. Simply close the web browser.
3. The voice conversation of the two parties continues. Now launch the web browser, hit Finesse URL. log in using the same user credential.
4. After user is loaded, now check user.getDialogs. It will return nothing. user.getDialogNoCache will return nothing too. My question is what is the best practice of reconstructing the lost Finesse JavaScript Dialog object on the client side that is still active from the server side, due to an accidental cut-off browser session.
Thanks again
03-04-2019 09:15 PM
Hi,
I understood your original message. I just reproduced it by refreshing the browser instead of closing it. It mimics the same thing but allows me to use the browser's debugger.
The answer to your question is to use user.getDialogs. That method calls the GET dialogs API, which you said in your original post has the data.
When are you calling the user.getDialogs? Is it after the user is loaded?
Thanx,
Denise
03-05-2019 06:26 AM
Yes, both user.getDialogs & user.getDialogsNoCache return nothing AFTER user is loaded. They both work fine if the browser session was not disrupted.
03-05-2019 09:43 AM
I figured out why user.getDialogs() gave me an empty list. It's a timing issue -
When you have an active dialog at the server end, and you log into Finesse web client, it needs some time to digest the messages from the server end to build the dialog objects. If you call user.getDialogs() right after user is loaded (i.e. within handleUserLoad callback), you will get empty list.
However, after the gadget is loaded and the UI components all settled, and you call user.getDialogs triggered by a UI component, you will get the real dialog list.
So the question I want to ask is: What can be used as a reliable indication of all outstanding messages from server being handled already by the client so that we are ready to call user.getDialogs()?
03-05-2019 10:12 AM
Hi,
Let me look into it. I see it on my setup, but let me build a gadget and do the exact steps. Also, which browser are you using?
Thanx,
Denise
03-05-2019 10:59 AM
Hi,
user.getDialogs() is working for me. Are you sure you are putting the code in the right place? I used the LearningSampleGadget as the base and here is my snippet of code modification:
handleUserLoad = function (userevent) { // Get an instance of the dialogs collection and register handlers for dialog additions and // removals dialogs = user.getDialogs( { onCollectionAdd : handleNewDialog, onCollectionDelete : handleEndDialog, onLoad : function() { numDialogs = dialogs.getDialogCount(true); $("#numDialogs").text(numDialogs); _dialogCollection = dialogs.getCollection(); for (var dialogId in _dialogCollection) { if (_dialogCollection.hasOwnProperty(dialogId)) { dialog = _dialogCollection[dialogId]; displayCall(dialog); } } } }); render(); },
I followed the steps that you had listed previously of the agent being on the call, close the browser window and log back in. When I logged back in, I saw the call info.
Thanx,
Denise
03-05-2019 11:05 AM
I tried Chrome, Firefox or IE11, it's the same behavior.
I think network latency is the key. My testing scenario is for mobile agents with workstations connected to Finesse servers via WAN.
If you test it in a high speed LAN environment, I can imagine when user is loaded, the dialog objects have been built already. The timing issue I'm facing simply does not manifest.
03-05-2019 12:36 PM - edited 03-05-2019 12:36 PM
Hi,
How do you have your code? There shouldn't be any timing issues if you are putting the code in the onLoad handler of both the user instance and the getDialogs call.
On the Finesse desktop, does the call information show up in the call control gadget?
Thanx,
Denise
03-05-2019 03:31 PM
The issue I have is consistently reproducible using the LearningSampleGadget with zero modification.
Yes, the default Cisco CallControl.js would show the active dialog started before browser session disruption. I guess it has more tricks in its sleeves than a third-party gadget using JavaScript API only.
From the console output, it seems to have hit the web service API with /finesse/api/User/<id>/Dialogs, which is something we are well aware that we can do too. The challenge of course is to convert the returned XML object into JavaScript Dialog object(s), something we are trying to avoid (which is the very question I asked in the original message).
03-06-2019 02:27 PM
Hi,
@limingq2010 wrote:
The issue I have is consistently reproducible using the LearningSampleGadget with zero modification.
That would be correct, because you need to modify the LearningSampleGadget code. I shared the code that needs to be added.
@limingq2010 wrote:Yes, the default Cisco CallControl.js would show the active dialog started before browser session disruption. I guess it has more tricks in its sleeves than a third-party gadget using JavaScript API only.
It doesn't. The Finesse out of the box desktop uses the same JavaScript API/library that is available for you to use.
@limingq2010 wrote:From the console output, it seems to have hit the web service API with /finesse/api/User/<id>/Dialogs, which is something we are well aware that we can do too. The challenge of course is to convert the returned XML object into JavaScript Dialog object(s), something we are trying to avoid (which is the very question I asked in the original message).
I've been answering that very question in the last few replies. The answer is that you need to use the user.getDialogs() method. I've been trying to see how you have your code to see why you are getting an empty list as your response. Can you share your code?
Thanx,
Denise
03-07-2019 08:25 AM
I started over, re-tested the LearningSampleGadget with the modified user load handler and it worked, thank you
03-07-2019 09:49 AM
Cool. Glad it resolved your issue.
Thanx,
Denise
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide