Not logged in. · Lost password · Register
Forum: MatriX RSS
service-unavailable
Avatar
codingtest #1
Member since Nov 2013 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: jingle
  1. Matrix.Xmpp.Jingle.Jingle jingle = new Matrix.Xmpp.Jingle.Jingle();
  2. jingle.Action = Matrix.Xmpp.Jingle.Action.SessionInitiate;
  3. jingle.Initiator = new Matrix.Jid("ClientA@server-pc/Matrix");
  4. jingle.Sid = KeyGen.GetRandomString(20);
  5. jingle.Responder = new Matrix.Jid("ClientB@server-pc/Matrix");
  6.  
  7. Matrix.Xmpp.Jingle.Content content = new Matrix.Xmpp.Jingle.Content();
  8. content.Name = "this-is-the-audio-content";
  9. content.Creator = Matrix.Xmpp.Jingle.Creator.Initiator;
  10.  
  11. Description description = new Matrix.Xmpp.Jingle.Apps.Rtp.Description();
  12. description.Media = Matrix.Xmpp.Jingle.Media.Audio;
  13. PayloadType pay = new PayloadType();
  14. pay.Id = 96;
  15. pay.Name="speex";
  16. pay.Clockrate=16000;
  17. description.AddPayloadType(pay);
  18.  
  19. pay = new PayloadType();
  20. pay.Id = 97;
  21. pay.Name="speex";
  22. pay.Clockrate=8000;
  23. description.AddPayloadType(pay);
  24.  
  25. pay = new PayloadType();
  26. pay.Id = 18;
  27. pay.Name="G729";
  28. description.AddPayloadType(pay);
  29.  
  30. pay = new PayloadType();
  31. pay.Id = 0;
  32. pay.Name="PCMU";
  33. description.AddPayloadType(pay);
  34.  
  35. pay = new PayloadType();
  36. pay.Id=98;
  37. pay.Name="x-ISAC";
  38. pay.Clockrate=8000;
  39. description.AddPayloadType(pay);
  40.    
  41. content.Description = description;
  42.  
  43. TransportIceUdp transportIceUdp = new Matrix.Xmpp.Jingle.Transports.TransportIceUdp();
  44.  
  45. transportIceUdp.Pwd = KeyGen.GetRandomString(21);
  46. transportIceUdp.Ufrag = KeyGen.GetRandomString(4);
  47.  
  48. CandidateIceUdp canddate = new CandidateIceUdp();
  49. canddate.Component=1;
  50. canddate.Foundation =1;
  51. canddate.Generation=0;
  52. canddate.Id = KeyGen.GetRandomString(10);
  53. canddate.IPAddress = IPAddress.Parse("172.100.1.33");
  54. canddate.Network = 0;
  55. canddate.Port = 5222;
  56. canddate.Priority=2130706431;
  57. canddate.Protocol= Matrix.Xmpp.Jingle.Protocol.Udp;
  58. canddate.Type = Matrix.Xmpp.Jingle.CandidateType.Host;
  59. transportIceUdp.AddCandidate(canddate);
  60.  
  61. content.TransportIceUdp = transportIceUdp;
  62.  
  63. jingle.Content = content;
  64.  
  65. JingleIq jingleIq = new JingleIq {
  66.     To = "ClientB@server-pc/Matrix",
  67.     Type = IqType.set,
  68.     From = "ClientA@server-pc/Matrix",
  69.     Jingle = jingle };
  70.  
  71. xmppClient.Send(jingleIq);

My question
1.In ClientB the OnIq handler, and does not receive the iq information ClientA.
2.I am now the procedure reported <service-unavailable> error, is there something I should return <Action.ContentAccept> in ClientB type iq information?
This post was edited on 2013-11-05, 11:51 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
service-unavailable normally means that you send to a user which is not available. So you are sending to a wrong Jid.
Jids in XMPP are always normalized, which means lower case for ASCII.

  • ClientB@server-pc/Matrix has 2 capital letters in the user part which is wrong. It must be clientb@server-pc/Matrix. The resource part (MatriX) is fine and can contain upper case characters.
  • you don't have to set the From. The server stamps all your messages automatically.

Alex
Avatar
codingtest #3
Member since Nov 2013 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: xml
  1. <iq id="MX_4" to="clientB@server-pc/Matrix" type="get" from="clientA@server-pc/Matrix" xmlns="jabber:client">
  2.  <jingle action="session-initiate" initiator="clientA@server-pc/Matrix" sid="BIjUHQPiQ8uQ86mOMoH6" responder="clientB@server-pc/Matrix" xmlns="urn:xmpp:jingle:1">
  3.     <content name="this-is-the-audio-content" creator="initiator">
  4.       <description media="audio" xmlns="urn:xmpp:jingle:apps:rtp:1">
  5.         <payload-type id="96" name="speex" clockrate="16000" />
  6.         <payload-type id="97" name="speex" clockrate="8000" />
  7.         <payload-type id="18" name="G729" />
  8.         <payload-type id="0" name="PCMU" />
  9.         <payload-type id="98" name="x-ISAC" clockrate="8000" />
  10.       </description>
  11.       <transport pwd="xaflyxKaC6cMmxtkU6BAc" ufrag="BrST" xmlns="urn:xmpp:jingle:transports:ice-udp:1">
  12.         <candidate component="1" foundation="1" generation="0" id="hDDb5EVCQj" ip="172.100.1.33" network="0" port="5222" priority="2130706431" protocol="udp" type="host" />
  13.       </transport>
  14.     </content>
  15.  </jingle>
  16. </iq>
  17.  
  18.  
  19. <iq type="error" id="MX_4" from="clientB@server-pc/Matrix" to="clientA@server-pc/MatriX" xmlns="jabber:client">
  20.  <jingle xmlns="urn:xmpp:jingle:1" action="session-initiate" initiator="clientA@server-pc/Matrix" sid="BIjUHQPiQ8uQ86mOMoH6" responder="clientB@server-pc/Matrix">
  21.     <content name="this-is-the-audio-content" creator="initiator">
  22.       <description xmlns="urn:xmpp:jingle:apps:rtp:1" media="audio">
  23.         <payload-type id="96" name="speex" clockrate="16000" />
  24.         <payload-type id="97" name="speex" clockrate="8000" />
  25.         <payload-type id="18" name="G729" />
  26.         <payload-type id="0" name="PCMU" />
  27.         <payload-type id="98" name="x-ISAC" clockrate="8000" />
  28.       </description>
  29.       <transport xmlns="urn:xmpp:jingle:transports:ice-udp:1" pwd="xaflyxKaC6cMmxtkU6BAc" ufrag="BrST">
  30.         <candidate component="1" foundation="1" generation="0" id="hDDb5EVCQj" ip="172.100.1.33" network="0" port="5222" priority="2130706431" protocol="udp" type="host" />
  31.       </transport>
  32.     </content>
  33.  </jingle>
  34.  <error code="503" type="cancel">
  35.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  36.  </error>
  37. </iq>
This post was edited on 2013-11-05, 13:07 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I still see capital letters in your username. Please fix this.
Avatar
codingtest #5
Member since Nov 2013 · 10 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #3
Subject: port number
Candidate in the development of the port number the server port number?
Avatar
codingtest #6
Member since Nov 2013 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: xml
  1. <iq id="MX_4" to="clientb@server-pc/Matrix" type="get" from="clienta@server-pc/Matrix" xmlns="jabber:client">
  2.  <jingle action="session-initiate" initiator="clienta@server-pc/Matrix" sid="BIjUHQPiQ8uQ86mOMoH6" responder="clientb@server-pc/Matrix" xmlns="urn:xmpp:jingle:1">
  3.     <content name="this-is-the-audio-content" creator="initiator">
  4.       <description media="audio" xmlns="urn:xmpp:jingle:apps:rtp:1">
  5.         <payload-type id="96" name="speex" clockrate="16000" />
  6.         <payload-type id="97" name="speex" clockrate="8000" />
  7.         <payload-type id="18" name="G729" />
  8.         <payload-type id="0" name="PCMU" />
  9.         <payload-type id="98" name="x-ISAC" clockrate="8000" />
  10.       </description>
  11.       <transport pwd="xaflyxKaC6cMmxtkU6BAc" ufrag="BrST" xmlns="urn:xmpp:jingle:transports:ice-udp:1">
  12.         <candidate component="1" foundation="1" generation="0" id="hDDb5EVCQj" ip="172.100.1.33" network="0" port="5222" priority="2130706431" protocol="udp" type="host" />
  13.       </transport>
  14.     </content>
  15.  </jingle>
  16. </iq>
  17.  
  18.  
  19. <iq type="error" id="MX_4" from="clientb@server-pc/Matrix" to="clienta@server-pc/MatriX" xmlns="jabber:client">
  20.  <jingle xmlns="urn:xmpp:jingle:1" action="session-initiate" initiator="clienta@server-pc/Matrix" sid="BIjUHQPiQ8uQ86mOMoH6" responder="clientb@server-pc/Matrix">
  21.     <content name="this-is-the-audio-content" creator="initiator">
  22.       <description xmlns="urn:xmpp:jingle:apps:rtp:1" media="audio">
  23.         <payload-type id="96" name="speex" clockrate="16000" />
  24.         <payload-type id="97" name="speex" clockrate="8000" />
  25.         <payload-type id="18" name="G729" />
  26.         <payload-type id="0" name="PCMU" />
  27.         <payload-type id="98" name="x-ISAC" clockrate="8000" />
  28.       </description>
  29.       <transport xmlns="urn:xmpp:jingle:transports:ice-udp:1" pwd="xaflyxKaC6cMmxtkU6BAc" ufrag="BrST">
  30.         <candidate component="1" foundation="1" generation="0" id="hDDb5EVCQj" ip="172.100.1.33" network="0" port="5222" priority="2130706431" protocol="udp" type="host" />
  31.       </transport>
  32.     </content>
  33.  </jingle>
  34.  <error code="503" type="cancel">
  35.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  36.  </error>
  37. </iq>
This post was edited on 2013-11-05, 13:14 by Alex.
Avatar
Alex #7
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #5
Quote by codingtest:
Candidate in the development of the port number the server port number?

this does not matter at all for now. As long as the server doesn't even route your Iq you cannot proceed with the next step anyway.
Avatar
Alex #8
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #6
  1. <error code="503" type="cancel">
  2.     <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  3. </error>

this means that the user you are sending the iq to is not online.
Either the user is offline, or you send to a wrong id, or your server configuration is broken.
This post was edited on 2013-11-05, 13:33 by Alex.
Avatar
codingtest #9
Member since Nov 2013 · 10 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #6
1.Send the user is online.Sending text messages is a success.

2.Is openfire server, it is the server support jingle, I use other clients can voice chat

Would you please check my code, see what's wrong.

Code:
  1. private void button1_Click(object sender, System.EventArgs e)
  2. {
  3.     xmppClient = new XmppClient
  4.     {
  5.         XmppDomain = "server-pc",
  6.         Username = "clienta",
  7.         Password = "000000"
  8.     };
  9.  
  10.     xmppClient.OnIq+=new EventHandler<IqEventArgs>(xmppClient_OnIq);
  11.     xmppClient.OnRosterEnd+=new EventHandler<Matrix.EventArgs>(xmppClient_OnRosterEnd);
  12.     xmppClient.Open();
  13. }
  14.  
  15. private void xmppClient_OnRosterEnd(object sernder, Matrix.EventArgs e)
  16. {
  17.     Matrix.Xmpp.Jingle.Jingle jingle = new Matrix.Xmpp.Jingle.Jingle();
  18.     jingle.Action = Matrix.Xmpp.Jingle.Action.SessionInitiate;
  19.     jingle.Initiator = new Matrix.Jid("clienta@server-pc/Matrix");
  20.     jingle.Sid = KeyGen.GetRandomString(20);
  21.     jingle.Responder = new Matrix.Jid("clientb@server-pc/Matrix");
  22.    
  23.     Matrix.Xmpp.Jingle.Content content = new Matrix.Xmpp.Jingle.Content();
  24.     content.Name = "this-is-the-audio-content";
  25.     content.Creator = Matrix.Xmpp.Jingle.Creator.Initiator;
  26.    
  27.     Description description = new Matrix.Xmpp.Jingle.Apps.Rtp.Description();
  28.     description.Media = Matrix.Xmpp.Jingle.Media.Audio;
  29.     PayloadType pay = new PayloadType();
  30.     pay.Id = 96;
  31.     pay.Name = "speex";
  32.     pay.Clockrate = 16000;
  33.     description.AddPayloadType(pay);
  34.     content.Description = description;
  35.  
  36.     TransportIceUdp transportIceUdp = new Matrix.Xmpp.Jingle.Transports.TransportIceUdp();
  37.     transportIceUdp.Pwd = KeyGen.GetRandomString(21);
  38.     transportIceUdp.Ufrag = KeyGen.GetRandomString(4);
  39.    
  40.     CandidateIceUdp canddate = new CandidateIceUdp();
  41.     canddate.Component = 1;
  42.     canddate.Foundation = 1;
  43.     canddate.Generation = 0;
  44.     canddate.Id = KeyGen.GetRandomString(10);
  45.     canddate.IPAddress = IPAddress.Parse("172.100.1.33");
  46.     canddate.Network = 0;
  47.     canddate.Port = 5222;
  48.     canddate.Priority = 2130706431;
  49.     canddate.Protocol = Matrix.Xmpp.Jingle.Protocol.Udp;
  50.     canddate.Type = Matrix.Xmpp.Jingle.CandidateType.Host;
  51.     transportIceUdp.AddCandidate(canddate);
  52.     content.TransportIceUdp = transportIceUdp;
  53.    
  54.     jingle.Content = content;
  55.    
  56.     JingleIq jingleIq = new JingleIq
  57.     {
  58.         To = "clientb@server-pc/Matrix",
  59.         Type = IqType.get,
  60.         From = "clienta@server-pc/Matrix",
  61.         Jingle = jingle
  62.     };
  63.  
  64.     Console.WriteLine(jingleIq);
  65.     xmppClient.Send(jingleIq);
  66. }
  67.  
  68. private void xmppClient_OnIq(object sender, IqEventArgs e)
  69. {
  70.     if (e.Iq.Type == IqType.get)
  71.     {
  72.    
  73.     }
  74. }

Thank you very much.
This post was edited on 2013-11-05, 14:56 by Alex.
Avatar
Alex #10
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I told you at the very beginning of this thread that I need the complete logs from both clients. You have never attached them. So I am sorry, but I cannot help you anymore until you are doing this.
Avatar
Alex #11
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you are also sending your Iq in the OnRosterEnd event which is too early for some servers.

Put a command button in your codes and send your Jingle request when the Xmpp session is authenticated, the roster completely received and you got the first incoming presence packet of clientb you send the packet to.
Avatar
codingtest #12
Member since Nov 2013 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: common button
I try to increase the common button to send a jingle, but there is still an error
Avatar
codingtest #13
Member since Nov 2013 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: XML information
I don't in clientb XML information is received.
After clienta send, what should I do with clientb.
Avatar
codingtest #14
Member since Nov 2013 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: Jingle sent successfully
1.Jingle sent successfully.
Resource name is case sensitive.

2.
Clienta send IQ information, the action is SessionInitiate.

clienta return IQ information, the action is SessionAccept.


Isn't that jingle should be after the connection is successful?
Avatar
Alex #15
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You can find the Jingle documentation here:
http://xmpp.org/extensions/xep-0166.html

The complete XMPP flow is documented there with many examples.
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