Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
akhhttar #1
Member since Aug 2012 · 11 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to convert JID into Windows Live ID?
Hi,

I am working on an application to find out the presence of my particular friends on Windows Live Messenger and I am using Matrix Library for that purpose. I am able to get my online contacts but their IDs are in JID format (b84b68ba1fa16309@messenger.live.com/{5df9bd6c-9b81-49bf-9316-f63e9e335a30} and I can't recognize who this person is with JID. Can someone please suggest how can I convert JID into windows Live ID format?

Thanks
-Akhtar
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You can send the following packet to the Windows Live server to lookup a Jid by Live Id:

  1. <iq xmlns="jabber:client" to="alex_gnauck@hotmail.com" type="get" id="someid">
  2.  <getjid xmlns="http://messenger.live.com/xmpp/jidlookup" />
  3. </iq>

the server returns then:

  1. <iq from="alex_gnauck@hotmail.com" id="someid" type="result" xmlns="jabber:client">
  2.  <getjid xmlns="http://messenger.live.com/xmpp/jidlookup">
  3.     <jid>e8f84c2011b88e4e@messenger.live.com</jid>
  4.  </getjid>
  5. </iq>

Lookup the Live id by Jid is not possible. You get user friendly names from the roster and the vcard feature.

Alex
This post was edited on 2012-08-12, 01:20 by Alex.
Avatar
akhhttar #3
Member since Aug 2012 · 11 posts
Group memberships: Members
Show profile · Link to this post
Thank You Alex for help!!

I am facing some other issues too, Can you please help me on these?

1. BeforePresence event only fire for currently online contacts and then connection is automatically close? How can i make the connection alive for long time so that I can continue receiving Presence events?

2. Roster Events (Start, End and item) is not triggering even AutoRoster property is set to True. Am I missing something?

Here is the sample code

  1. xmppClient.XmppDomain = "messenger.live.com";
  2.  
  3. // add some event handlers
  4. xmppClient.OnStreamError += xmppClient_OnStreamError;
  5. xmppClient.OnClose += xmppClient_OnClose;
  6. xmppClient.OnLogin += xmppClient_OnLogin;
  7. xmppClient.OnSendXml += xmppClient_OnSendXml;
  8. xmppClient.OnReceiveXml += xmppClient_OnReceiveXml;
  9. xmppClient.OnBeforeSasl += xmppClient_OnBeforeSasl;
  10.  
  11. xmppClient.OnRosterStart += xmppClient_OnRosterStart;
  12. xmppClient.OnRosterItem += xmppClient_OnRosterItem;
  13. xmppClient.OnRosterEnd += xmppClient_OnRosterEnd;
  14.  
  15. xmppClient.OnPresence += xmppClient_OnPresence;
  16. xmppClient.OnIq  += xmppClient_OnIq;
  17. xmppClient.OnMessage += xmppClient_OnMessage;
  18. xmppClient.AutoRoster = true;
  19. xmppClient.AutoPresence = false;
  20. xmppClient.Open();

Thanks
-Akhtar
This post was edited on 2012-08-16, 14:33 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by akhhttar:
1. BeforePresence event only fire for currently online contacts and then connection is automatically close? How can i make the connection alive for long time so that I can continue receiving Presence events?

what do you mean with BeforePresence event? Teh connection normally lives until you call Close() on it. Please post your complete Xml log, then we can see if the server kicks your connection.

Quote by akhhttar:
2. Roster Events (Start, End and item) is not triggering even AutoRoster property is set to True. Am I missing something?

they must trigger, please post your complete Xml log.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
For keeping the connection alive set:

  1. xmppClient.AutoReplyToPing = true;

Windows Live is sending XMPP Pings, when you don't reply to them they kick your connection. When you set AutoReplyToPing to true MatriX automatically replies to them and keeps your connection alive.

Alex
Avatar
akhhttar #6
Member since Aug 2012 · 11 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

AutoReplyToPint=True, didn't help. It still closing the connection. XmppClient behaviing differently on each run, sometimes it doesn't fire Presence event at all and sometimes it fires Presence event for some of the online contacts and then connection automatically closes. Roster events are also not triggering.

Here is Xml log for two different runs,

1st Run: Presence Event fire for one contact only, Roster events didn't fire and connection was immediately closed.

  1. 11:43:06 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  2. 11:43:07 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="16145" xmlns="jabber:client" >
  3. 11:43:07 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  4.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  5.     <required />
  6.  </starttls>
  7. </stream:features>
  8. 11:43:07 AM - OnSendXml - <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  9. 11:43:08 AM - OnReceiveXml - <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  10. 11:43:09 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  11. 11:43:09 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="16146" xmlns="jabber:client" >
  12. 11:43:09 AM - OnReceiveXml - <stream:error xmlns:stream="http://etherx.jabber.org/streams">
  13.  <see-other-host xmlns="urn:ietf:params:xml:ns:xmpp-streams">BY2MSG4030116.gateway.messenger.live.com</see-other-host>
  14. </stream:error>
  15. 11:43:09 AM - OnSendXml - </stream:stream>
  16. 11:43:09 AM - OnReceiveXml - </stream:stream>
  17. 11:43:09 AM - OnClose - redirect=True
  18. 11:43:10 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  19. 11:43:10 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="198" xmlns="jabber:client" >
  20. 11:43:11 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  21.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  22.     <required />
  23.  </starttls>
  24. </stream:features>
  25. 11:43:11 AM - OnSendXml - <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  26. 11:43:11 AM - OnReceiveXml - <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  27. 11:43:12 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  28. 11:43:13 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="199" xmlns="jabber:client" >
  29. 11:43:13 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  30.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  31.     <mechanism>X-MESSENGER-OAUTH2</mechanism>
  32.  </mechanisms>
  33. </stream:features>
  34. 11:43:13 AM - OnSendXml - <auth mechanism="X-MESSENGER-OAUTH2" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">EwA4Aq1DBAAUlbRWyAJjK5w968Ru3Cyt/6GvwXwAAcJo/jC8QRPh6oxLSMGQPu+V8ctugeklbKse8Vr4ufbIqiwVyO7Bq3hVIJIkcls12dKXIKPvmpCxhyDQM2ThKcn/v2kJlR0dWwOJUaqG7fyTeuh+/LtWnL1NX8hSSQNC2kWwOF19inz+4C88zZCETt5wZw39KJQdSg0cnSo4Ghlm+myxYrDxgqjDbvctuavnxePtTQetPfWv2+IHIIiDsPIqc+5YwlgJwZPBw1RtHuqYhtNw2w05U9+dEowpkF5dtz3peWBitOSLjr0AQXA7g33fnTcuif3ZLKkjbrUPqRvI2AHwPg0lV7mFNoCRktsAPufRSReT3f4GuyF0/N3sDZgAACO5fz7MkjXF3CAH0ISO4aPev2UsSrbyJxpeaM52g+TsiowO7bCzpwHXg5FU32vF93CzGcluAG4qNAAeZkJ9Nnha0HFacvo3TLPJC/TFhZJNqqXqEi3TDdbBda8IOIp+rfUK60pJsaQnHg7saC+MyVZBCAlBYy3cuIibO3tCvpVCzFmrGSdXFN9ovksn512TVLhcMzfpzJL50kiq65lcwbuLs6pHQHcS6dzDd6IqZRq5AxUL1USMHT8aPAsfqY61Qk32bljC/lypigJNSOm6PrRUQ0+G6IqCZxp53KAF7lCYSX3LKgIGA9cglwptzKFGH7zVUb29qI/TOauRnL8XzGjg/knN3hjAPmrqGvveyEU0UAAA==</auth>
  35. 11:43:14 AM - OnReceiveXml - <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  36. 11:43:14 AM - OnLogin -
  37. 11:43:14 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  38. 11:43:14 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="200" xmlns="jabber:client" >
  39. 11:43:15 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  40.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  41.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  42.  <sub xmlns="urn:xmpp:features:pre-approval" />
  43. </stream:features>
  44. 11:43:15 AM - OnSendXml - <iq id="MX_1" type="set" xmlns="jabber:client">
  45.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  46.     <resource>MatriX</resource>
  47.  </bind>
  48. </iq>
  49. 11:43:15 AM - OnReceiveXml - <iq id="MX_1" type="result" xmlns="jabber:client">
  50.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  51.     <jid>b84b68ba1fa16309@messenger.live.com/{088e4ac5-a522-454a-9a97-44dc97a4106a}</jid>
  52.  </bind>
  53. </iq>
  54. 11:43:15 AM - OnSendXml - <iq id="MX_2" type="set" xmlns="jabber:client">
  55.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  56. </iq>
  57. 11:43:15 AM - OnReceiveXml - <iq id="MX_2" type="result" xmlns="jabber:client">
  58.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  59. </iq>
  60. 11:43:15 AM - OnSendXml - <iq id="MX_3" type="get" xmlns="jabber:client">
  61.  <query xmlns="jabber:iq:roster" />
  62. </iq>
  63. 11:43:16 AM - OnReceiveXml - <presence from="scottgu@microsoft.com/{00000000-0000-0000-0000-000000000000}" to="b84b68ba1fa16309@messenger.live.com/{088e4ac5-a522-454a-9a97-44dc97a4106a}" xmlns="jabber:client">
  64.  <show>xa</show>
  65.  <x xmlns="vcard-temp:x:update">
  66.     <photo />
  67.  </x>
  68. </presence>
  69. 11:43:16 AM - OnReceiveXml - <presence from="jeungms@microsoft.com/{00000000-0000-0000-0000-000000000000}" to="b84b68ba1fa16309@messenger.live.com/{088e4ac5-a522-454a-9a97-44dc97a4106a}" type="unavailable" xmlns="jabber:client" />
  70. 11:43:18 AM - OnClose - redirect=False
Avatar
akhhttar #7
Member since Aug 2012 · 11 posts
Group memberships: Members
Show profile · Link to this post
2nd Run: Presence and Roster events didn't fire and connection was immediately closed.

  1. 11:53:19 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  2. 11:53:20 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="16179" xmlns="jabber:client" >
  3. 11:53:20 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  4.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  5.     <required />
  6.  </starttls>
  7. </stream:features>
  8. 11:53:20 AM - OnSendXml - <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  9. 11:53:20 AM - OnReceiveXml - <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  10. 11:53:22 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  11. 11:53:22 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="16180" xmlns="jabber:client" >
  12. 11:53:22 AM - OnReceiveXml - <stream:error xmlns:stream="http://etherx.jabber.org/streams">
  13.  <see-other-host xmlns="urn:ietf:params:xml:ns:xmpp-streams">BY2MSG4030109.gateway.messenger.live.com</see-other-host>
  14. </stream:error>
  15. 11:53:22 AM - OnSendXml - </stream:stream>
  16. 11:53:22 AM - OnReceiveXml - </stream:stream>
  17. 11:53:22 AM - OnClose - redirect=True
  18. 11:53:23 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  19. 11:53:23 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="632" xmlns="jabber:client" >
  20. 11:53:24 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  21.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  22.     <required />
  23.  </starttls>
  24. </stream:features>
  25. 11:53:24 AM - OnSendXml - <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  26. 11:53:24 AM - OnReceiveXml - <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  27. 11:53:25 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  28. 11:53:26 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="633" xmlns="jabber:client" >
  29. 11:53:26 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  30.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  31.     <mechanism>X-MESSENGER-OAUTH2</mechanism>
  32.  </mechanisms>
  33. </stream:features>
  34. 11:53:26 AM - OnSendXml - <auth mechanism="X-MESSENGER-OAUTH2" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">EwA4Aq1DBAAUlbRWyAJjK5w968Ru3Cyt/6GvwXwAAcJo/jC8QRPh6oxLSMGQPu+V8ctugeklbKse8Vr4ufbIqviwVyO7Bq3hVIJIkcls12dKXIKPvmpCxhyDQM2ThKcn/v2kJlR0dWwOJUaqG7fyTeuh+/LtWnL1NX8hSSQNC2kWwOF19inz+4C88zZCETdtZw39KJQdSg0cnSo4Ghlm+myxYrDxgqjDbvctuavnxePtTQetPfWv2+IHIIiDsPIqc+5YwlgJwZPBw1RtuqYhtNw2w05U9+dEowpkF5dtz3pepWBitOSLjr0AQXA7g33fnTcuif3ZLKkjbrUPqRvI2HwPg0lV7mFNoCRktsAPufRSReT3f4GuyF0/N3sDZgAACO5fz7MkjXF3CAH0ISO4aPev2UseSrbyJxeaM52g+TsiowO7bCzpwHXg5FU32vF93CzGcluAG4qNAAeZkJ9Nnha0HFacvo3TLPJC/TFhZJNqqXqEi3TDdbBda8IOIp+rfUK60pJsaQnnHg7saC+MyVZBCAlBYy3cuIibOtCvpVCzFmrGSdXFN9ovksn512TVLhcMzfpzJL50kiq65lcwbuLs6pHQHcS6dzDd6IqZRq5AxUL1USMHT8aPAs6fqY61Qk32bljC/lypigJNSOm6PrRUQ0+G6IqCZxp53KAF7lCYSX3LKgIGA9cglwptzKFGH7zVUb29qI/TOauRnL8XzGjg/knN3hjAPmrqGvveyEU0UAAA==</auth>
  35. 11:53:27 AM - OnReceiveXml - <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  36. 11:53:27 AM - OnLogin -
  37. 11:53:27 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  38. 11:53:27 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="634" xmlns="jabber:client" >
  39. 11:53:28 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  40.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  41.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  42.  <sub xmlns="urn:xmpp:features:pre-approval" />
  43. </stream:features>
  44. 11:53:28 AM - OnSendXml - <iq id="MX_1" type="set" xmlns="jabber:client">
  45.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  46.     <resource>MatriX</resource>
  47.  </bind>
  48. </iq>
  49. 11:53:28 AM - OnReceiveXml - <iq id="MX_1" type="result" xmlns="jabber:client">
  50.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  51.     <jid>b84b68ba1fa16309@messenger.live.com/{87bc72e5-98c5-47d8-8bba-a8ed16842731}</jid>
  52.  </bind>
  53. </iq>
  54. 11:53:28 AM - OnSendXml - <iq id="MX_2" type="set" xmlns="jabber:client">
  55.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  56. </iq>
  57. 11:53:29 AM - OnReceiveXml - <iq id="MX_2" type="result" xmlns="jabber:client">
  58.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  59. </iq>
  60. 11:53:29 AM - OnSendXml - <iq id="MX_3" type="get" xmlns="jabber:client">
  61.  <query xmlns="jabber:iq:roster" />
  62. </iq>
  63. 11:53:30 AM - OnClose - redirect=False


Here is the code for XmppClient initalization,

public void Start()
        {
            xmppClient = new XmppClient();
            xmppClient.XmppDomain = "messenger.live.com";

            // add some event handlers
            xmppClient.OnStreamError += xmppClient_OnStreamError;
            xmppClient.OnClose += xmppClient_OnClose;
            xmppClient.OnLogin += xmppClient_OnLogin;
            xmppClient.OnSendXml += xmppClient_OnSendXml;
            xmppClient.OnReceiveXml += xmppClient_OnReceiveXml;
            xmppClient.OnBeforeSasl += xmppClient_OnBeforeSasl;

            xmppClient.OnRosterStart += xmppClient_OnRosterStart;
            xmppClient.OnRosterItem += xmppClient_OnRosterItem;
            xmppClient.OnRosterEnd += xmppClient_OnRosterEnd;

            xmppClient.OnPresence += xmppClient_OnPresence;
            xmppClient.OnIq  += xmppClient_OnIq;

            xmppClient.AutoPresence = true;
            xmppClient.AutoRoster = true;
            xmppClient.AutoReplyToPing = true;

            xmppClient.Open();

           
        }

Thanks
-Akhtar
Avatar
akhhttar #8
Member since Aug 2012 · 11 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #6
2nd Run: Presence and Roster events didn't fire and connection was immediately closed.

  1. 11:53:19 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  2. 11:53:20 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="16179" xmlns="jabber:client" >
  3. 11:53:20 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  4.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  5.     <required />
  6.  </starttls>
  7. </stream:features>
  8. 11:53:20 AM - OnSendXml - <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  9. 11:53:20 AM - OnReceiveXml - <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  10. 11:53:22 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  11. 11:53:22 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="16180" xmlns="jabber:client" >
  12. 11:53:22 AM - OnReceiveXml - <stream:error xmlns:stream="http://etherx.jabber.org/streams">
  13.  <see-other-host xmlns="urn:ietf:params:xml:ns:xmpp-streams">BY2MSG4030109.gateway.messenger.live.com</see-other-host>
  14. </stream:error>
  15. 11:53:22 AM - OnSendXml - </stream:stream>
  16. 11:53:22 AM - OnReceiveXml - </stream:stream>
  17. 11:53:22 AM - OnClose - redirect=True
  18. 11:53:23 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  19. 11:53:23 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="632" xmlns="jabber:client" >
  20. 11:53:24 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  21.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  22.     <required />
  23.  </starttls>
  24. </stream:features>
  25. 11:53:24 AM - OnSendXml - <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  26. 11:53:24 AM - OnReceiveXml - <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  27. 11:53:25 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  28. 11:53:26 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="633" xmlns="jabber:client" >
  29. 11:53:26 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  30.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  31.     <mechanism>X-MESSENGER-OAUTH2</mechanism>
  32.  </mechanisms>
  33. </stream:features>
  34. 11:53:26 AM - OnSendXml - <auth mechanism="X-MESSENGER-OAUTH2" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">EwA4Aq1DBAAUlbRWyAJjK5w968Ru3Cyt/6GvwXwAAcJo/jC8QRPh6oxLSMGQPu+V8ctugeklbKse8Vr4ufbIqviwVyO7Bq3hVIJIkcls12dKXIKPvmpCxhyDQM2ThKcn/v2kJlR0dWwOJUaqG7fyTeuh+/LtWnL1NX8hSSQNC2kWwOF19inz+4C88zZCETdtZw39KJQdSg0cnSo4Ghlm+myxYrDxgqjDbvctuavnxePtTQetPfWv2+IHIIiDsPIqc+5YwlgJwZPBw1RtuqYhtNw2w05U9+dEowpkF5dtz3pepWBitOSLjr0AQXA7g33fnTcuif3ZLKkjbrUPqRvI2HwPg0lV7mFNoCRktsAPufRSReT3f4GuyF0/N3sDZgAACO5fz7MkjXF3CAH0ISO4aPev2UseSrbyJxeaM52g+TsiowO7bCzpwHXg5FU32vF93CzGcluAG4qNAAeZkJ9Nnha0HFacvo3TLPJC/TFhZJNqqXqEi3TDdbBda8IOIp+rfUK60pJsaQnnHg7saC+MyVZBCAlBYy3cuIibOtCvpVCzFmrGSdXFN9ovksn512TVLhcMzfpzJL50kiq65lcwbuLs6pHQHcS6dzDd6IqZRq5AxUL1USMHT8aPAs6fqY61Qk32bljC/lypigJNSOm6PrRUQ0+G6IqCZxp53KAF7lCYSX3LKgIGA9cglwptzKFGH7zVUb29qI/TOauRnL8XzGjg/knN3hjAPmrqGvveyEU0UAAA==</auth>
  35. 11:53:27 AM - OnReceiveXml - <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  36. 11:53:27 AM - OnLogin -
  37. 11:53:27 AM - OnSendXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  38. 11:53:27 AM - OnReceiveXml - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="634" xmlns="jabber:client" >
  39. 11:53:28 AM - OnReceiveXml - <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  40.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  41.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  42.  <sub xmlns="urn:xmpp:features:pre-approval" />
  43. </stream:features>
  44. 11:53:28 AM - OnSendXml - <iq id="MX_1" type="set" xmlns="jabber:client">
  45.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  46.     <resource>MatriX</resource>
  47.  </bind>
  48. </iq>
  49. 11:53:28 AM - OnReceiveXml - <iq id="MX_1" type="result" xmlns="jabber:client">
  50.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  51.     <jid>b84b68ba1fa16309@messenger.live.com/{87bc72e5-98c5-47d8-8bba-a8ed16842731}</jid>
  52.  </bind>
  53. </iq>
  54. 11:53:28 AM - OnSendXml - <iq id="MX_2" type="set" xmlns="jabber:client">
  55.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  56. </iq>
  57. 11:53:29 AM - OnReceiveXml - <iq id="MX_2" type="result" xmlns="jabber:client">
  58.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  59. </iq>
  60. 11:53:29 AM - OnSendXml - <iq id="MX_3" type="get" xmlns="jabber:client">
  61.  <query xmlns="jabber:iq:roster" />
  62. </iq>
  63. 11:53:30 AM - OnClose - redirect=False


Here is the code for XmppClient initalization,

public void Start()
        {
            xmppClient = new XmppClient();
            xmppClient.XmppDomain = "messenger.live.com";

            // add some event handlers
            xmppClient.OnStreamError += xmppClient_OnStreamError;
            xmppClient.OnClose += xmppClient_OnClose;
            xmppClient.OnLogin += xmppClient_OnLogin;
            xmppClient.OnSendXml += xmppClient_OnSendXml;
            xmppClient.OnReceiveXml += xmppClient_OnReceiveXml;
            xmppClient.OnBeforeSasl += xmppClient_OnBeforeSasl;

            xmppClient.OnRosterStart += xmppClient_OnRosterStart;
            xmppClient.OnRosterItem += xmppClient_OnRosterItem;
            xmppClient.OnRosterEnd += xmppClient_OnRosterEnd;

            xmppClient.OnPresence += xmppClient_OnPresence;
            xmppClient.OnIq  += xmppClient_OnIq;

            xmppClient.AutoPresence = true;
            xmppClient.AutoRoster = true;
            xmppClient.AutoReplyToPing = true;

            xmppClient.Open();

           
        }

Thanks
-Akhtar
Avatar
Alex #9
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Can you please download the example from here and test if this works for you:
http://db.tt/lxRFDN6A

There must be something wrong in your code. MatriX does not close the session until you destroy the XmppClient all call Close on it.
Please let me know if this example works.

Alex
Avatar
Alex #10
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
also in your logs I never see a reply to the roster request and I don't see your initial presence. Did you remove some content from the logs?

Alex
Avatar
akhhttar #11
Member since Aug 2012 · 11 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

Thank you for your immediate response.

I have tried your sample code but it is also producing the same results. I have made little modification in your code, I hard codded provided the Access Token as your access token generation code was not working ( I gave the correct client id and redirect url).

Here are logs of your sample application:

  1.  
  2. SEND:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  3. RECV:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="16834" xmlns="jabber:client" >
  4. RECV:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  5.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  6.     <required />
  7.  </starttls>
  8. </stream:features>
  9. SEND:<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  10. RECV:<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  11. SEND:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  12. RECV:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="16835" xmlns="jabber:client" >
  13. RECV:<stream:error xmlns:stream="http://etherx.jabber.org/streams">
  14.  <see-other-host xmlns="urn:ietf:params:xml:ns:xmpp-streams">BAYMSG1010717.gateway.messenger.live.com</see-other-host>
  15. </stream:error>
  16. SEND:</stream:stream>
  17. RECV:</stream:stream>
  18. SEND:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  19. RECV:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="1459" xmlns="jabber:client" >
  20. RECV:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  21.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  22.     <required />
  23.  </starttls>
  24. </stream:features>
  25. SEND:<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  26. RECV:<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  27. SEND:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  28. RECV:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="1460" xmlns="jabber:client" >
  29. RECV:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  30.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  31.     <mechanism>X-MESSENGER-OAUTH2</mechanism>
  32.  </mechanisms>
  33. </stream:features>
  34. SEND:<auth mechanism="X-MESSENGER-OAUTH2" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">EwA4Aq1DBAAUlbRWyAJjK5w968Ru3Cyt/6GvwXwAAWMtd5xsMICKc0AmyU+EVVnGMK96qOSMeVqN71ifGh3exMhAk+hh/JQsdvAx8PN1qrpaLua/nelsugBtaPQGdcDNH2MCopqggmCr/kE8GrDWHYshGswxi9udhmz2ZqxR5dl4SStpVC0sw/c2VrOgmu0N4Hue48MYkv7YWIKBkHf5s0Xpm0n7/v7NX+cQRrpe5+UHI/16V80SIYpjjGHj+MxERKhWUqy4CHrd/kZ6WklXFZImLa8+H+i08bwcVZ1jkLFgpRlyVOB9W30q0KZrS6IUbXKGILJOQR7Qq5bFbBOhIOaC1JmOBfTIpjPD9cmES6jOMnB9yEPeotvrdO9t3r4DZgAACDqbcVPOhGZUCAHBCHtc6Ol7MueYatTAp3niIjk0eUDLMYBrBpvEp7rXVSW3R1WbKhuLzqxz8ziHpjsy8Ox5kEt/2Y59nOvUX8o+qa06sIOEOJpG5IFhGv5GZGgUojB1syxqHNd6NclLEWRcSbOhiPhIHIiFkvIveEFGcY9XLO8K3FaBMT43gV9LhoMF+kRQ6y6gP2sxm4Wm0uOKMAmDsI+EA6CSl3DlMWHkKpuBO8VJlKHjEv7cRnHCd93GNf4nZ84n1aZz2sY5cAZCxaxS4ObJ+Dg9gOhAJQkwx1Z9dJPghQH1bVDPmFjEQCVp1UkIosMS22w9faKQ6LV6CW8mU86wq9nIitzY7KhWKZq5ssOudSgAAA==</auth>
  35. RECV:<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  36. SEND:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="messenger.live.com" version="1.0" >
  37. RECV:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="messenger.live.com" version="1.0" id="1461" xmlns="jabber:client" >
  38. RECV:<stream:features xmlns:stream="http://etherx.jabber.org/streams">
  39.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  40.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  41.  <sub xmlns="urn:xmpp:features:pre-approval" />
  42. </stream:features>
  43. SEND:<iq id="MX_1" type="set" xmlns="jabber:client">
  44.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  45.     <resource>MatriX</resource>
  46.  </bind>
  47. </iq>
  48. RECV:<iq id="MX_1" type="result" xmlns="jabber:client">
  49.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  50.     <jid>b84b68ba1fa16309@messenger.live.com/{6d959696-e8b0-4c77-aa95-eaa84abecdb4}</jid>
  51.  </bind>
  52. </iq>
  53. SEND:<iq id="MX_2" type="set" xmlns="jabber:client">
  54.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  55. </iq>
  56. RECV:<iq id="MX_2" type="result" xmlns="jabber:client">
  57.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  58. </iq>
  59. SEND:<iq id="MX_3" type="get" xmlns="jabber:client">
  60.  <query xmlns="jabber:iq:roster" />
  61. </iq>
  62. RECV:<presence from="jeungms@microsoft.com/{00000000-0000-0000-0000-000000000000}" to="b84b68ba1fa16309@messenger.live.com/{6d959696-e8b0-4c77-aa95-eaa84abecdb4}" type="unavailable" xmlns="jabber:client" />

Here is the change I made in your code:

 void xmppClient_OnBeforeSasl(object sender, SaslEventArgs e)
        {
            // this event is not thread safe because it is blocking, so invoke is required for UI updates.
            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => DisplayEvent("OnBeforeSasl")));


            var accessToken = "EwA4Aq1DBAAUlbRWyAJjK5w968Ru3Cyt/6GvwXwAAWMtd5xsMICKc0AmyU+EVVnGMK96qOSMeVqN71ifGh3exMhAk+hh/JQsdvAx8PN1qrpaLua/nelsugBtaPQGdcDNH2MCopqggmCr/kE8GrDWHYshGswxi9udhmz2ZqxR5dl4SStpVC0sw/c2VrOgmu0N4Hue48MYkv7YWIKBkHf5s0Xpm0n7/v7NX+cQRrpe5+UHI/16V80SIYpjjGHj+MxERKhWUqy4CHrd/kZ6WklXFZImLa8+H+i08bwcVZ1jkLFgpRlyVOB9W30q0KZrS6IUbXKGILJOQR7Qq5bFbBOhIOaC1JmOBfTIpjPD9cmES6jOMnB9yEPeotvrdO9t3r4DZgAACDqbcVPOhGZUCAHBCHtc6Ol7MueYatTAp3niIjk0eUDLMYBrBpvEp7rXVSW3R1WbKhuLzqxz8ziHpjsy8Ox5kEt/2Y59nOvUX8o+qa06sIOEOJpG5IFhGv5GZGgUojB1syxqHNd6NclLEWRcSbOhiPhIHIiFkvIveEFGcY9XLO8K3FaBMT43gV9LhoMF+kRQ6y6gP2sxm4Wm0uOKMAmDsI+EA6CSl3DlMWHkKpuBO8VJlKHjEv7cRnHCd93GNf4nZ84n1aZz2sY5cAZCxaxS4ObJ+Dg9gOhAJQkwx1Z9dJPghQH1bVDPmFjEQCVp1UkIosMS22w9faKQ6LV6CW8mU86wq9nIitzY7KhWKZq5ssOudSgAAA==";
               
                e.Auto = false;
                e.SaslMechanism = SaslMechanism.X_MESSENGER_OAUTH2;
                e.SaslProperties = new LiveMessengerProperties
                           {
                               AccessToken = accessToken
                           };
          
        }

 private void btnSignIn_Click(object sender, RoutedEventArgs e)
        {
            xmppClient.Open();
        }

I didn't remove any content from previous logs.

Thanks
-Akhtar
Avatar
Alex #12
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
the server never replies to this request with the roster:

  1. <iq id="MX_3" type="get" xmlns="jabber:client">
  2.  <query xmlns="jabber:iq:roster" />
  3. </iq>

but instead its sending you a unavailable presence from user jeungms@microsoft.com with this weird resource {00000000-0000-0000-0000-000000000000}

  1. <presence from="jeungms@microsoft.com/{00000000-0000-0000-0000-000000000000}" to="b84b68ba1fa16309@messenger.live.com/{6d959696-e8b0-4c77-aa95-eaa84abecdb4}" type="unavailable" xmlns="jabber:client" />

MatriX has never sent our presence before, so the server MUST NOT send you any presences. It looks to me like there is a bug in the server which is causing this behavior and then also closing your stream on the server side because of some internal errors.

Please try to contact Microsoft, or try another Live account. When you look at the Microsoft forums you will find many threads where people have XMPP problems with several accounts.

Please let us know when you have any update from MS on the problem.

Alex
Avatar
akhhttar #13
Member since Aug 2012 · 11 posts
Group memberships: Members
Show profile · Link to this post
You seems right, I think it is an issue at Microsoft end. It started working fine, when I tried with new account :)

I will post this issue on Microsoft forums and will keep you updated about the results.

Thank You very much for your help. It was really a nice experience to discuss the issue with you. Thanks :)

-Akhtar
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:
Forum: MatriX RSS