Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Finesse Cisco Presence connection
Avatar
gutterwall #1
Member since Mar 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
Subject: Finesse Presence Example.
I am trying to connect to Finesse using xmppClient, and I get a not-authorized. 
 
  1. <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  2.  <not-authorized />
  3. </failure>
I connected successfully using the Rest api, and can change states.  But I need to know the presence of the current user to grab the screen pop handler for a thick client screen pop listener...

HELP?
Here's my code that doesn't work...

  1. private void ConnectBosh()
  2. {        
  3.       m_xmppClient.Transport = Matrix.Net.Transport.Bosh;
  4.       m_xmppClient.PreferredSsoSaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.Plain;
  5.       m_xmppClient.AutoPresence = true;
  6.       m_xmppClient.Uri = new System.Uri(string.Format("https://{0}:7443/http-bind/",FinesseFQDN));
  7.       m_xmppClient.Password = LoggedOnPassword;
  8.       m_xmppClient.Username = string.Format("{0}@{1}" , LoggedOnUserName, FinesseFQDN);
  9.       serverJid = m_xmppClient.Username;
  10.       m_xmppClient.AutoPresence = true;
  11.       m_xmppClient.OnReceiveXml += xmppClient_OnRecieveXml;
  12.       m_xmppClient.OnPresence += xmppClient_OnPresence;
  13.       m_xmppClient.OnError += m_xmppClient_OnError;
  14.       m_xmppClient.OnAuthError += m_xmppClient_OnAuthError;
  15.       m_xmppClient.OnBindError += m_xmppClient_OnBindError;
  16.       m_xmppClient.OnMessage += m_xmppClient_OnMessage;
  17.       m_xmppClient.OnBind += m_xmppClient_OnBind;
  18.       m_xmppClient.Port = 7443;
  19.       m_xmppClient.OnClose += m_xmppClient_OnClose;            
  20.       m_xmppClient.XmppDomain = FinesseFQDN;                    
  21.       m_xmppClient.Open();
  22.       PubSubManager mgr = new PubSubManager(m_xmppClient);            
  23.       mgr.OnEvent += mgr_OnEvent;
  24. }

Here's my RestAPI function I got working just to share the wealth...  Need to add Reason codes later.

  1. private string ChangeStates(UserStates NewState)
  2. {
  3.     string m_strAuth = Convert.ToBase64String(Encoding.ASCII.GetBytes(LoggedOnUserName + ":" + LoggedOnPassword));
  4.  
  5.     // setup WebClient
  6.     System.Net.WebClient m_wc = new WebClient();
  7.     m_wc.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
  8.     m_wc.Headers.Add("Authorization", string.Format("Basic {0}", m_strAuth));
  9.     m_wc.Headers.Add("Content-Type", "application/xml");
  10.    
  11.     // perform the PUT request
  12.     byte[] dataBytes = Encoding.UTF8.GetBytes(BuildStateString(NewState));
  13.     string URL = string.Format("{0}:{1}/finesse/api/User/{2}", UccxFQDN, FinessePort, LoggedOnUserName);
  14.     byte[] responseArray = m_wc.UploadData(URL, "PUT", dataBytes);
  15.     return Encoding.ASCII.GetString(responseArray);
  16. }
This post was edited 2 times, last on 2016-03-16, 16:28 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
not authorized means that there is an authentication Error.
With secure SASL authentication either your username, password or XMPP Domain is wrong.

Posting your complete Xml Log can also help to find the problem.
I also suggest to use Sockets instead of BOSH.

Alex
Avatar
gutterwall #3
Member since Mar 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
  1. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="{username}@{Servername}" version="1.0" id="62ee07f3" >
  2. <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  3.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  4.     <mechanism>PLAIN</mechanism>
  5.  </mechanisms>
  6.  <compression xmlns="http://jabber.org/features/compress">
  7.     <method>zlib</method>
  8.  </compression>
  9.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  10.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  11. </stream:features>
  12. <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  13.  <not-authorized />
  14. </failure>
  15. <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  16.  <not-authorized />
  17. </failure>

I commented out the {username}@{servername}
This post was edited on 2016-03-16, 17:29 by Unknown user.
Avatar
gutterwall #4
Member since Mar 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #2
What would using Sockets look like?
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
We need the complete stream, and you should not comment the servername, because the server name maybe the problem.
You should only comment out the Base64 data in the <auth/> tag.

I also need send and receive, your log is incomplete.

Alex
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #4
Quote by gutterwall:
What would using Sockets look like?

remove those 2 lines:

Quote by csharp:
m_xmppClient.Transport = Matrix.Net.Transport.Bosh;
m_xmppClient.Uri = new System.Uri(string.Format("https://{0}:7443/http-bind/",FinesseFQDN));

the default is sockets.

Alex
Avatar
gutterwall #7
Member since Mar 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
When I take out those lines, I get a No Such Host is Known.

What would a xmppdomain look like?  {username}@{domain}?  or just {domain}
https://server.domain.com:7445  or username@server.comain.com  or what?  I am confused as all get out.

Thanx so much for your help Alex!
Avatar
Alex #8
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
XmppClient.XmppDomain is the server domain confugured in your XMPP server.
A domain does not include the protocol or a port, so its something like jabber.org, or xmpp.org for example.

Have you tried to use the MiniClient example to connect to your server?
https://gitlab.com/matrix-xmpp/samples/tree/master/csharp/…

Alex
Avatar
gutterwall #9
Member since Mar 2016 · 5 posts
Group memberships: Members
Show profile · Link to this post
MiniClient helped after I figured out I just needed server name in Server...  haha..

Thanx I think I got it!
Avatar
Alex #10
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
great to hear that its working now.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: