06-16-2021 11:37 PM
I want take subscription of Team User Events
node /finesse/api/Team/{id}/Users
How I can subscribe to events and what I should pass as a "resource" in
JID (username@domain/resource)
Kindly help me
06-17-2021 02:35 AM
Hassnain,
This is documented here:
https://developer.cisco.com/docs/finesse/#!subscription-management/subscription-management
The following example shows how to subscribe to agent state change notifications for a specific team:
CODE SNIPPET
<iq type='set'
from='CharlesNorrad@finesse-server.cisco.com'
to='pubsub.finesse-server.cisco.com'
id='sub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<subscribe
node='/finesse/api/Team/TheA/Users'
jid='ChuckieNorrad@finesse-server.cisco.com'/>
</pubsub>
</iq>
Regards,
Gerry
07-01-2021 08:46 AM
Hi Gerry,
Is this possible with Windows/console applications as well? If so any example/library we can use for consuming it for C# code.
Thanks
Jammy
07-06-2021 08:07 AM - edited 07-06-2021 08:13 AM
Hey Jammy.
Im using Matrix XMPP in c# - It is possible to get a trial license for that.
https://www.ag-software.net/matrix-xmpp-sdk/
Here is some code you can use for inspiration:
private XmppClient xmppClient = new XmppClient(); getConfig getConfig = new getConfig(); private string lic = "Your license key"; string server = "CCX server"; public bool subscribe(string username, string password) { log.Debug(".subscribe - User:" + username); bool returnStatus = false; Matrix.License.LicenseManager.SetLicense(lic); xmppClient.SetUsername(username); xmppClient.SetXmppDomain(server); xmppClient.Password = password; xmppClient.Port = 5222; xmppClient.Uri = new System.Uri("http://" + server); xmppClient.OnValidateCertificate += XmppClient_OnValidateCertificate; xmppClient.OnLogin += XmppClient_OnLogin; xmppClient.OnError += XmppClient_OnError; xmppClient.OnClose += XmppClient_OnClose; xmppClient.OnReceiveXml += XmppClient_OnReceiveXml; xmppClient.OnMessage += xmppClient_OnMessage; xmppClient.KeepAliveInterval = 60; xmppClient.Open(); return returnStatus; } private void XmppClient_OnReceiveXml(object sender, TextEventArgs e) { //Console.WriteLine("XmppClient_OnReceiveXml" + e.Text); } private void XmppClient_OnClose(object sender, Matrix.EventArgs e) { Console.WriteLine(".XmppClient_OnClose"); } public bool unSubscribe() { xmppClient.Close(); Console.WriteLine(".unSubscribe"); return true; } private void xmppClient_OnMessage(object sender, MessageEventArgs e) { Console.WriteLine(".xmppClient_OnMessage : " + e.Message.Value); } private void XmppClient_OnError(object sender, ExceptionEventArgs e) { Console.WriteLine(".XmppClient_OnError : "+e.ToString()); } private void XmppClient_OnLogin(object sender, Matrix.EventArgs e) { Console.WriteLine(".XmppClient_OnLogin"); } private void XmppClient_OnValidateCertificate(object sender, CertificateEventArgs e) { e.AcceptCertificate = true; } }
All events will then come on the "xmppClient_OnMessage"
11-11-2021 10:32 PM
With this code implementation,I am getting exception M_xmppClient_OnError event (BOSH exception ,Message = "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.").
XmppClient m_xmppClient = new XmppClient(); m_xmppClient.Transport = Matrix.Net.Transport.Bosh; m_xmppClient.Hostname = "abc.com"; m_xmppClient.Username = "user_name"; m_xmppClient.Password = "password"; m_xmppClient.Port = 5222; m_xmppClient.SetXmppDomain("https://abc.com"); m_xmppClient.AutoRoster = true; m_xmppClient.AutoPresence = true; m_xmppClient.OnMessage += M_xmppClient_OnMessage; m_xmppClient.OnReceiveXml += M_xmppClient_OnReceiveXml; m_xmppClient.OnBind += M_xmppClient_OnBind; m_xmppClient.OnValidateCertificate += M_xmppClient_OnValidateCertificate; m_xmppClient.OnLogin += M_xmppClient_OnLogin; m_xmppClient.OnError += M_xmppClient_OnError; m_xmppClient.OnAuthError += M_xmppClient_OnAuthError; m_xmppClient.Uri = new System.Uri("https://abc.com:7552/http-bind/"); m_xmppClient.KeepAliveInterval = 60; m_xmppClient.Open(); PubSubManager mgr = new PubSubManager(m_xmppClient); mgr.OnEvent += Mgr_OnEvent; private void M_xmppClient_OnAuthError(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e) { Console.WriteLine(e.Exception); } private void M_xmppClient_OnError(object sender, Matrix.ExceptionEventArgs e) { Console.WriteLine(e.Exception); } private void M_xmppClient_OnLogin(object sender, Matrix.EventArgs e) { Console.WriteLine(e.State); } private void M_xmppClient_OnValidateCertificate(object sender, Matrix.CertificateEventArgs e) { e.AcceptCertificate = true; } private void M_xmppClient_OnBind(object sender, Matrix.JidEventArgs e) { Console.WriteLine("On bind: " + e.Jid); } private void Mgr_OnEvent(object sender, MessageEventArgs e) { Console.WriteLine(e.Message); } private void M_xmppClient_OnReceiveXml(object sender, Matrix.TextEventArgs e) { Console.WriteLine(e.Text + e.State); } private void M_xmppClient_OnMessage(object sender, MessageEventArgs e) { Console.WriteLine(e.Message.Value); Console.WriteLine(e.Message.Body); }
11-15-2021 10:31 AM
Hi,
I see in your code that you are using BOSH as the transport, but you have port 5222 and port 7552 in the bind url.
What version of Finesse are you using? Depending on the version, the HTTPS port for BOSH is either 7443 or 8445 (for 12.6) for the bind url. Port 5222 is the TCP HTTP port and 5223 is the TCP HTTPS port.
Also, did you download the tomcat certificate from the Finesse server and install it on the client machine?
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