cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
192
Views
10
Helpful
3
Replies
Enthusiast

Finesse: how to listen to Participants changes?

I have a finesse gadget that's using the javascript api to attempt to listen to any additions or changes to the number of participants. I'm specifically looking for the event that conferenced agents drop off a call and there is only one agent and one left, though this shouldn't matter.

 

Code that I've tried:

dialog = new finesse.restservices.Dialog({
    onChange : handleDialogChange
});

partisipants = dialog.getParticipants({
    onCollectionAdd : handleOnAdd,
    onCollectionDelete : handleOnDelete
});

partisipants = new finesse.restservices.dialog.partisipants({
    onChange : handlePartissChange
});

None of these have seemed to work though. My handlers never get called as if the data isn't being changed. However, if I call the finesse api directly through Postman I can see the data is changing when agents change the participants node.

 

Please help to understand how my code can get called on the participants change event.

Thanks!

 

 

I'm on Finesse with UCCE 11.6 if it makes a difference.

Here's a sample Dialog showing two Participants:

<Dialog>
  <associatedDialogUri></associatedDialogUri>
  <fromAddress>1310</fromAddress>
  <id>16785772</id>
  <mediaProperties>
  ...
  </mediaProperties>
  <mediaType>Voice</mediaType>
  <participants>
    <Participant>
      <actions>
        <action>TRANSFER_SST</action>
        <action>CONSULT_CALL</action>
        <action>HOLD</action>
        <action>UPDATE_CALL_DATA</action>
        <action>SEND_DTMF</action>
        <action>DROP</action>
      </actions>
      <mediaAddress>6000010</mediaAddress>
      <mediaAddressType>AGENT_DEVICE</mediaAddressType>
      <startTime>2019-09-12T18: 34: 07.337Z</startTime>
      <state>ACTIVE</state>
      <stateCause></stateCause>
      <stateChangeTime>2019-09-12T18: 34: 07.337Z</stateChangeTime>
    </Participant>
    <Participant>
      <actions>
        <action>TRANSFER_SST</action>
        <action>CONSULT_CALL</action>
        <action>HOLD</action>
        <action>UPDATE_CALL_DATA</action>
        <action>SEND_DTMF</action>
        <action>DROP</action>
      </actions>
      <mediaAddress>1310</mediaAddress>
      <mediaAddressType></mediaAddressType>
      <startTime>2019-09-12T18: 34: 07.337Z</startTime>
      <state>ACTIVE</state>
      <stateCause></stateCause>
      <stateChangeTime>2019-09-12T18: 34: 07.337Z</stateChangeTime>
    </Participant>
  </participants>
  <state>ACTIVE</state>
  <toAddress>6000010</toAddress>
  <uri>/finesse/api/Dialog/16785772</uri>
</Dialog>

 

3 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Finesse: how to listen to Participants changes?

Hi,

 

Unfortunatelly dialog.getParticipants() method does not allow to specify callback. You should use dialogs 'change' handler do detect any change in dialog (including changes in participant list).

Here is an example:

 

// get dialog list for finesse user
user.getDialogs({
onChange : handleDialogAdd
})


function handleDialogAdd(dialog) {
// add change handler to detect participant list change
dialog.addHandler("change", handleDialogChange);
}

function handleDialogChange(dialog) {
var plist = dialog.getParticipants();

// process list futher here
}

 

Dariusz Pazdzior

Cisco Employee

Re: Finesse: how to listen to Participants changes?

Hi,

 

Dariusz is correct in how to get the participants. For a full sample code that shows how to use the change handler (not getParticipant specifically), take a look here: https://github.com/CiscoDevNet/finesse-sample-code/tree/master/LearningSampleGadget

 

Thanx,

Denise

Enthusiast

Re: Finesse: how to listen to Participants changes?

This was very close to what I needed, thanks for posting this!

 

After experimenting a while I found that I needed to move the change listener down to the handleNewDialog function since the dialog.onChange only gets fired when the page loads.

My js file is attached(renamed extension).

 

This community is the best, thanks again Dariusz and Denise.

3 REPLIES 3

Re: Finesse: how to listen to Participants changes?

Hi,

 

Unfortunatelly dialog.getParticipants() method does not allow to specify callback. You should use dialogs 'change' handler do detect any change in dialog (including changes in participant list).

Here is an example:

 

// get dialog list for finesse user
user.getDialogs({
onChange : handleDialogAdd
})


function handleDialogAdd(dialog) {
// add change handler to detect participant list change
dialog.addHandler("change", handleDialogChange);
}

function handleDialogChange(dialog) {
var plist = dialog.getParticipants();

// process list futher here
}

 

Dariusz Pazdzior

Cisco Employee

Re: Finesse: how to listen to Participants changes?

Hi,

 

Dariusz is correct in how to get the participants. For a full sample code that shows how to use the change handler (not getParticipant specifically), take a look here: https://github.com/CiscoDevNet/finesse-sample-code/tree/master/LearningSampleGadget

 

Thanx,

Denise

Enthusiast

Re: Finesse: how to listen to Participants changes?

This was very close to what I needed, thanks for posting this!

 

After experimenting a while I found that I needed to move the change listener down to the handleNewDialog function since the dialog.onChange only gets fired when the page loads.

My js file is attached(renamed extension).

 

This community is the best, thanks again Dariusz and Denise.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards