WriteElement() public method

public WriteElement ( System.Xml.Linq.XElement element, XElement>.Action handler ) : void
element System.Xml.Linq.XElement
handler XElement>.Action
return void
Exemplo n.º 1
0
        public void PlaceCall(string destination, SDP sdp)
        {
            m_destination = destination;
            m_sdp         = sdp;

            XElement descriptionElement = SDPToJingle.GetDescription(m_sdp);

            m_descriptionID = Crypto.GetRandomString(6);

            XElement callElement = new XElement(JabberClientNS + "iq",
                                                new XAttribute("from", m_jid),
                                                new XAttribute("id", m_descriptionID),
                                                new XAttribute("to", m_destination),
                                                new XAttribute("type", "set"),
                                                new XElement(m_sessionNS + "session",
                                                             new XAttribute("type", "initiate"),
                                                             new XAttribute("id", m_sessionID),
                                                             new XAttribute("initiator", m_jid),
                                                             descriptionElement
                                                             //new XElement(m_transportNS + "transport")
                                                             ));

            logger.Debug("XMPPPhoneSession sending iq with session description.");
            m_xmppStream.WriteElement(callElement, OnIQResponse);
        }
Exemplo n.º 2
0
        public void SendServerDiscoveryQuery()
        {
            string   id = Crypto.GetRandomString(6);
            XElement discoveryElement = new XElement(m_jabberNS + XMPPConstants.XMPPRequestTypes.iq.ToString(),
                                                     new XAttribute("id", id),
                                                     new XAttribute("to", "gmail.com"),
                                                     new XAttribute("type", "get"),
                                                     new XElement(m_discoveryNS + XMPPConstants.XMPPRequestSubTypes.query.ToString()));

            m_xmppStream.WriteElement(discoveryElement, null);
        }
Exemplo n.º 3
0
        public void SendMessage(string message)
        {
            XElement messageElement = new XElement(m_jabberNS + XMPPConstants.XMPPRequestTypes.message.ToString(),
                                                   new XAttribute("from", m_xmppStream.JID),
                                                   new XAttribute("to", m_to),
                                                   new XElement(m_jabberNS + "body", message));

            m_xmppStream.WriteElement(messageElement, null);
        }
Exemplo n.º 4
0
        public void GetRoster()
        {
            XElement rosterElement = new XElement(m_jabberNS + XMPPConstants.XMPPRequestTypes.iq.ToString(),
                                                  new XAttribute("id", Crypto.GetRandomString(6)),
                                                  new XAttribute("from", m_xmppStream.JID),
                                                  new XAttribute("type", "get"),
                                                  new XElement(m_rosterNS + "query"));

            m_xmppStream.WriteElement(rosterElement, OnRosterResponse);
        }
Exemplo n.º 5
0
        public void Initiate()
        {
            string   id            = Crypto.GetRandomString(6);
            XElement jingleElement = new XElement(m_jabberNS + XMPPConstants.XMPPRequestTypes.iq.ToString(),
                                                  new XAttribute("id", id),
                                                  new XAttribute("from", m_xmppStream.JID),
                                                  new XAttribute("to", m_to),
                                                  new XAttribute("type", "set"),
                                                  new XElement(m_jingleNS + XMPPConstants.XMPPRequestSubTypes.jingle.ToString(),
                                                               new XAttribute("action", "session-initiate"),
                                                               new XAttribute("initiator", m_xmppStream.JID),
                                                               new XAttribute("sid", m_sessionID),
                                                               new XElement(m_jingleNS + "content",
                                                                            new XAttribute("creator", "initiator"),
                                                                            new XAttribute("name", "audio"),
                                                                            new XElement(m_jingleDescriptionNS + "description",
                                                                                         //new XAttribute(XNamespace.Xmlns + "rtp", XMPPConstants.JINGLE_DESCRIPTION_NAMESPACE),
                                                                                         new XAttribute("media", "audio"),
                                                                                         new XElement(m_jingleDescriptionNS + "payload-type",
                                                                                                      new XAttribute("id", "0"),
                                                                                                      new XAttribute("name", "PCMU"),
                                                                                                      new XAttribute("clockrate", "8000"),
                                                                                                      new XElement(m_jingleDescriptionNS + "parameter",
                                                                                                                   new XAttribute("name", "bitrate"),
                                                                                                                   new XAttribute("value", "64000"))
                                                                                                      )),
                                                                            new XElement(m_gingleTransportNS + "transport")
                                                                            //new XElement(m_jingleRTPTransportNS + "transport",
                                                                            //    GetCandidate("1.1.1.1", 0))
                                                                            )),
                                                  new XElement(m_gingleSessionNS + "session",
                                                               new XAttribute("type", "initiate"),
                                                               new XAttribute("id", m_sessionID),
                                                               new XAttribute("initiator", m_xmppStream.JID),
                                                               new XElement(m_ginglePhoneNS + "description",
                                                                            new XElement(m_ginglePhoneNS + "payload-type",
                                                                                         new XAttribute("id", "0"),
                                                                                         new XAttribute("name", "PCMU"),
                                                                                         new XAttribute("bitrate", "64000"),
                                                                                         new XAttribute("clockrate", "8000"))))
                                                  );

            m_xmppStream.WriteElement(jingleElement, (s, x) => { });
        }