ā12-30-2013 05:31 AM
I am trying to subscribe an agent to Team and Queue notification.
I have used(edited) code from non gadget sample.
The request captured from fiddler looks something similar to:
For Team Subscription:
POST /finesse/api/Team/8945/Users HTTP/1.1
Where 8945 is the agent ID
Response :
HTTP/1.1 404 Not Found
To test it I also tried User notification:
POST /finesse/api/User/8945 HTTP/1.1
Response
HTTP/1.1 405 Method Not Allowed
Allow: GET,OPTIONS,HEAD,PUT
The added code to non gadget sample for team subscription:
this.subscribeToTeam = function (agentId, resource, handler, errHandler) {
var method = "POST",
url = _webappPath + "/api/Team/" + agentId + "/Users",
params = { "resource": resource };
_sendReq(url, method, null, params, handler, errHandler);
};
Can someone please help me to subscribe to the new nodes for notification in Finesse?
Solved! Go to Solution.
ā01-02-2014
11:53 AM
- last edited on
ā03-05-2021
10:49 AM
by
dekwan
You do not subscribe via a POST message. You have to send an iq message over the XMPP session to subscribe to a node.
For example:
<iq type='set' from='1001001@finessedevsup1.finesse.bxb'
to='pubsub.finessedevsup1.finesse.bxb'
id='sub9'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe node='/finesse/api/Team/5001/Users'
jid='1001001@finessedevsup1.finesse.bxb'/>
</pubsub>
</iq>
See chapter 7 Cisco Finesse Notifications section on Subscription Management in the Finesse WebServices Developer Guide: https://developer.cisco.com/docs/finesse/#!subscription-management
ā01-02-2014
11:53 AM
- last edited on
ā03-05-2021
10:49 AM
by
dekwan
You do not subscribe via a POST message. You have to send an iq message over the XMPP session to subscribe to a node.
For example:
<iq type='set' from='1001001@finessedevsup1.finesse.bxb'
to='pubsub.finessedevsup1.finesse.bxb'
id='sub9'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe node='/finesse/api/Team/5001/Users'
jid='1001001@finessedevsup1.finesse.bxb'/>
</pubsub>
</iq>
See chapter 7 Cisco Finesse Notifications section on Subscription Management in the Finesse WebServices Developer Guide: https://developer.cisco.com/docs/finesse/#!subscription-management
ā01-30-2014 07:15 AM
Hi Lender,
Can you give sample to subscribe queue notification using jabberwerx.js.
Thanks,
Arul
ā01-30-2014 07:25 AM
The only Finesse sample that uses jabberwerx.js is the nongadgetsample which does not include subscribing to nodes.
There is a sample of using jabberwerx.js to send a message in the Jabber tech center on DevNet
You would send an iq message using client.sendMessage(jid, message); where message is in the form:
<iq type='set' from='1001001@finessedevsup1.finesse.bxb'
to='pubsub.finessedevsup1.finesse.bxb'
id='sub9'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe node='/finesse/api/Team/5001/Users'
jid='1001001@finessedevsup1.finesse.bxb'/>
</pubsub>
</iq>
ā02-10-2014 01:44 AM
Hello Lender,
I am using the same message format to subscribe queue notification,it is accepted without any error but i didn't get any events for this subscription message, please see my below logic. is it anything require apart from this?
JS Code:
successCallback: function () {
//Get the server generated resource ID to be used for subscriptions.
//alert(_jwClient.resourceName);
_finesse.setResource(_jwClient.resourceName);
try{
//alert("inside");
messageItem="<iq type='set' from='1003@techfinesse91.srvprcce.com' to='pubsub.techfinesse91.srvprcce.com' id='sub8'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <subscribe node='/finesse/api/Queue/1' jid='1003@techfinesse91.srvprcce.com'/> </pubsub> </iq>";
_jwClient.sendMessage("pubsub.techfinesse91.srvprcce.com",messageItem);
}
catch(ex)
{
console.log("error:"+ JSON.stringify (ex));
}
}
Post Message Format:
Response Message:
Also clarify queue notification will work only with individual queue subscription(http://172.16.6.186/finesse/api/Queue/1) or we can get entire user queue changes(http://172.16.6.186/finesse/api/User/1003/Queues).
Thanks,
Arul
ā02-10-2014 06:51 AM
Did you try it with a Supervisor agent? The User is not allowed to subscribe to Queues only a supervisor can do this using the javascript library.
ā02-12-2014 10:01 AM
Lender,
We are trying only supervisor agent with non-gadget application, as per this thread we sending iq message over the XMPP session.
For the same supervisor, we getting queue update events in default Cisco supervisor desktop queue statistics gadget.
Why we are not able to subscribe over the XMPP?
Thanks,
Arul Selvan B
ā02-12-2014 12:47 PM
It seems your subscription is successful and that you just arent getting Queue any notifications: Did you try just doing a GET on the Queue to see if it is a valid Queue ID?
ā02-12-2014 01:05 PM
Also, I dont think the response message you posted is the right message to be looking at. I suggest you try the subscription with Poster and Pidgin first to make sure your subscription iq message is correct.
ā02-12-2014 01:16 PM
You also asked:
Also clarify queue notification will work only with individual queue subscription(http://172.16.6.186/finesse/api/Queue/1) or we can get entire user queue changes(http://172.16.6.186/finesse/api/User/1003/Queues).
You need to get the list of queues using GET on /finesse/api/User/1003/Queues and then subscribe to each queue using /finesse/api/Queue/<queueid>
ā02-12-2014 01:53 PM
I tried this using Poster and Pidgin and this iq worked for me
<iq type='result' id='purplecea37863' to='42070@ucc9finese10.ccpucc9a.local/cisco'/>
<iq type='set' from='42070@ucc9finese10.ccpucc9a.local' to='pubsub.ucc9finese10.ccpucc9a.local' id='sub9'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe node='/finesse/api/Queue/1007' jid='42070@ucc9finese10.ccpucc9a.local'/>
</pubsub>
</iq>
I got the following response:
<iq type='result' id='sub9' from='pubsub.ucc9finese10.ccpucc9a.local' to='42070@ucc9finese10.ccpucc9a.local/cisco'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscription node='/finesse/api/Queue/1007' jid='42070@ucc9finese10.ccpucc9a.local' subscription='subscribed'>
<subscribe-options/>
</subscription>
</pubsub>
</iq>
I then changed the user's state to Not Ready. I then got a notification when the User changed state. I got the User notification and I got a Queue notification on 1007
<message from='pubsub.ucc9finese10.ccpucc9a.local' to='42070@ucc9finese10.ccpucc9a.local' id='/finesse/api/Queue/1007__42070@ucc9finese10.ccpucc9a.local__vB1rH'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='/finesse/api/Queue/1007'>
<item id='6BYBULjMhU9lMr7'>
<notification xmlns='http://jabber.org/protocol/pubsub'><Update>
<data>
<queue>
<name>Lender_SG</name>
<statistics>
<agentsNotReady>1</agentsNotReady>
<agentsReady>0</agentsReady>
<agentsTalkingInbound>0</agentsTalkingInbound>
<agentsTalkingInternal>0</agentsTalkingInternal>
<agentsTalkingOutbound>0</agentsTalkingOutbound>
<agentsWrapUpNotReady>0</agentsWrapUpNotReady>
<agentsWrapUpReady>0</agentsWrapUpReady>
<callsInQueue>0</callsInQueue>
<startTimeOfLongestCallInQueue></startTimeOfLongestCallInQueue>
</statistics>
<uri>/finesse/api/Queue/1007</uri>
</queue>
</data>
<event>PUT</event>
<requestId></requestId>
<source>/finesse/api/Queue/1007</source>
</Update></notification>
</item>
</items>
</event>
</message>
ā02-13-2014 03:44 AM
Thanks Lender, It's working good, only thing we have to call sendIQ method while using jabberwerx.js.
JS Code:
_jwClient.sendIq("set","pubsub.techfinesse91.srvprcce.com","<pubsub xmlns='http://jabber.org/protocol/pubsub'><subscribe node='/finesse/api/Queue/3' jid='1003@techfinesse91.srvprcce.com'/></pubsub>",function(data){
alert("success");
});
Request Format:
</iq>
</iq>
</pubsub>
</iq>
</presence>
</body>
Thanks,
Arul
ā03-31-2014 12:56 AM
Hi,
I want to ask that is gadget to java app communication possible ? Foe example in gadget I am publishing data on a particular node and I want get this data after subscription through java app ?
Publishing Data in Gadgets: gadgets.Hub.publish("a.b.c.d.e.f", address);
Subscribing Data in Java App:
final String publisherNodeID = "a.b.c.d.e.f";
PubSubManager mgr = new PubSubManager(connection);
//creating node which subcribes to finesse events
LeafNode node;
try {
node = (LeafNode) mgr.getNode(publisherNodeID);
System.out.println("Node Fetched!!!!");
} catch (Exception ex) {
System.out.println("Node Created!!!!");
node = (LeafNode) mgr.createNode(publisherNodeID);
}
//an Item that has been, or will be published to a pubsub node.
//An Item has several properties that are dependent on the configuration of the node to which it has been or will be published.
//Defines the listener for items being published to a node.
node.addItemEventListener(new ItemEventCoordinator<Item>());
node.subscribe(myJID);
System.out.println("Successfully Subscribed to node: " + publisherNodeID);
//packet filter
//Listener for Finese Notification
PacketFilter filter = new MessageTypeFilter(Message.Type.normal);
connection.addPacketListener(new PacketListener() {
@Override
public void processPacket(Packet packet) {
System.out.println("Packet Received!!!");
}
But Whenever I publish data through gadgets, data is not fetched in java app.
ā03-31-2014 08:11 AM
Gadget to java app communication is not possible.
A gadget can subscribe to a hub topic in the Finesse desktop. See the HubTopic sample gadget. This does not provide support for a Java app.
ā03-31-2014 11:13 PM
I think we can do this by using Managed
Hub<http://www.openajax.org/member/wiki/OpenAjax_Hub_2.0_Specification_Managed_Hub_Overview>.
I never worked with managed hub and I even don't have idea of this. I think
Gadget publish data on particular node on finesse server and in Java App we
first login agent in finesse environment and It tries to fetch(subscribe)
data on that node and I think there should be no issue in fetching that
because in java app we are in finesse environment when we connect and
login.
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