cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2883
Views
5
Helpful
18
Replies

Finesse. How to change the call state from hold with finesse.restservices.Dialog.Actions?

Nikolay.Dmukha
Level 1
Level 1

Hello.

I am newer in development. Now i am working on the task about consult call in Finesse.

The own Finesse mechanism is:

1. agent take a call

2. than agent click the button Consult to make consualt call

3. while agent are talking with colleague he undertand that he need to call to another colleague

4. agent end the current consult call

5. but for new consult call agent should click Retrieve button and next he should make a new consult call

I made my own gadget with consult call button. And now i want after first(wrong) consult call make another consult call without pushing Retrieve button. So i need in this momet in my JS-code make an action - change the call state from HOLD. 

According the guide i should do it with "finesse.restservices.Dialog.Actions".

But I don`t understand how to do it. What should i use the retrieve the call in .js? Can you show me the correct example of this?

p.s. in my .js i have the current user id, user state, user extension, current dialog id.

18 Replies 18

No prbolem, Denise.

I am trying but have no success - both commands execute in the same time. I don`t know why.

I have rad about callback functions in JS adn try to use it:

 

function retrieve(makeCC) {
   origDialog.requestAction(mediaAddress, "RETRIEVE", {
      success: function (rsp) {
      clientLogs.log("makeConsultCall to '" + phoneNumber + "' success (status: " + rsp.status + ").");
      makeCC();
   },
   error: function (rsp) {
      clientLogs.log("makeConsultCall to '" + phoneNumber + "' failed (status: " + rsp.status + ").");
   }
});
}
function makeCC() {
   origDialog.makeConsultCall(mediaAddress, phoneNumber, {
   success: function (rsp) {
     clientLogs.log("makeConsultCall to '" + phoneNumber + "' success (status: " + rsp.status + ").");
   },
   error: function (rsp) {
      clientLogs.log("makeConsultCall to '" + phoneNumber + "' failed (status: " + rsp.status + ").");
   }
});
}
retrieve(makeCC);

 

In Chrome developers tools I have the messages one by one Status code: 202 Accepted(find in attach). So I don`t understand why the retrieve and consult action execute in the same time :(

 

Hi,

 

Hmm...I went back and looked at your original question and my response. Seems like I must not have been thinking clearly when I originally responded. Let me try again...

 

Steps 1-4 remain the same, step 5 needs to change and a step 0 is added.

 

@Nikolay.Dmukha wrote:

1. agent take a call

2. than agent click the button Consult to make consualt call

3. while agent are talking with colleague he undertand that he need to call to another colleague

4. agent end the current consult call

5. but for new consult call agent should click Retrieve button and next he should make a new consult call

0. Always store the previous Agent's state in a global variable.

1. When the agent takes a call, the dialog's change handler (_processCall in a lot of the sample gadgets) gets triggered. At this time, you probably want to store the dialog object that you get as a parameter to two global variable, lets say origDialog and curDialog

2. When the agent gets on the Consult call, that dialog will be stored into curDialog. So at this time origDialog = call from #1 and curDialog is the consult

3.  ----

4. In the onCollectionDelete for the dialog (handleEndDialog in the sample gadgets), you can check if the origDialog is different than curDialog. If it is, set curDialog to origDialog.

5. Now curDialog has the call that you need to retrieve, so you would do curDialog.requestAction("", Action.RETRIEVE, {}) to retrieve the call. When the retrieve is successful, the curDialog's (and origDialog since they are now equal) change handler (_processCall in most examples) will be triggered to show that the participant's state is now ACTIVE. In HERE, that is where you need to do the consult by using curDialog.makeConsultCall. Now, when the consult is successful, curDialog needs to point to that dialog object.

Now, how do you determine when to call the consult in the change handler? The only thing I can think of is an "IF retrieve" statement in the change handler. How do you do THAT? That is where it gets complex. This is what I would try out:

  1. Have a boolean global variable that determines if the consult button on this gadget is pushed.
  2. If I am remembering correctly, in your step 2 above, the agent state should be in Hold. So upon a successful Retrieve, the agent's state went from Hold->Ready. So in the dialog's change handler, if the agent's state goes from Hold -> Ready AND the consult button is pushed (previous step), then call the curDialog.makeConsultCall. Why do you want the global variable from the previous step? Because you don't want the consult call to be triggered when the agent uses the retrieve button from the out of the box call control gadget.

I'd give this logic a shot. I can't think of any other way at the moment right now.

 

Thanx,

Denise

Hello Denise.

Thanks for your reply.

I just found the next thing - if i set in Chrome developers tools slow internet(Network -> Throttling) the my .js code execute correctly without any error...

How to fix it i don`t know. I will be researching this behavior.

Hi,

 

That makes perfect sense actually. The reason why is because when you have a slow internet connection, it give time to process the RETRIEVE before the CONSULT is sent.

 

The reason why my original suggestion doesn't work is because the RETRIEVE's success handler is only the 200 OK, not the dialog notification that the call was successfully retrieved. Therefore, when the consult is called, the retrieve may not have actually happened yet.

 

Thanx,

Denise