Exemple #1
0
        /// <summary>
        /// Accept VOIP/Video/Audio call.  Should only be used after a SessionInitiate was received.
        /// </summary>
        /// <param name="to">recipient jid</param>
        /// <param name="sdp">Response sdp</param>
        public void SendSessionAccept(string to, string sdp)
        {
            Iq iq = new Iq();

            iq.To   = to;
            iq.Type = Matrix.Xmpp.IqType.Set;
            Matrix.Xmpp.Jingle.Jingle jingle = Jingle.JingleSdp.FromSdp(sdp);
            jingle.Action = Matrix.Xmpp.Jingle.Action.SessionAccept;
            jingle.GenerateSid();
            iq.Add(jingle);
            xmppClient.Send(iq);
            Log.Info(">session-accept " + to);
        }
Exemple #2
0
        /// <summary>
        /// Disconnect VOIP/Video/Audio call.
        /// </summary>
        /// <param name="to">recipient jid</param>
        public void SendSessionTerminate(string to)
        {
            Matrix.Xmpp.Jingle.Jingle jIq = new Matrix.Xmpp.Jingle.Jingle();

            jIq.Action = Matrix.Xmpp.Jingle.Action.SessionTerminate;
            jIq.GenerateSid();
            string defaultNs = "urn:xmpp:jingle:1";

            Matrix.Xml.XmppXElement eX = new Matrix.Xml.XmppXElement(defaultNs, "reason");
            eX.Add(new Matrix.Xml.XmppXElement(defaultNs, "success"));
            jIq.Add(eX);

            Iq denyIq = new Iq();

            denyIq.To   = to;
            denyIq.From = this._jid;
            denyIq.Type = Matrix.Xmpp.IqType.Set;
            denyIq.Add(jIq);

            xmppClient.Send(denyIq);
            Log.Info(">session-terminate");
        }
Exemple #3
0
        public void SendSessionTerminate(string to, string sid)
        {
            Matrix.Xmpp.Jingle.Jingle jIq = new Matrix.Xmpp.Jingle.Jingle();

            jIq.Action = Matrix.Xmpp.Jingle.Action.SessionTerminate;
            jIq.Sid    = sid;
            string defaultNs = "urn:xmpp:jingle:1";

            Matrix.Xml.XmppXElement eX = new Matrix.Xml.XmppXElement(defaultNs, "reason");
            eX.Add(new Matrix.Xml.XmppXElement(defaultNs, "success"));
            jIq.Add(eX);

            Iq denyIq = new Iq();

            denyIq.To   = to;
            denyIq.From = this.jid;
            denyIq.Type = Matrix.Xmpp.IqType.Set;
            denyIq.Add(jIq);

            Console.Write(denyIq.ToString());
            xmppClient.Send(denyIq);
        }
Exemple #4
0
        /// <summary>
        /// Send request for VOIP/Video/Audio call
        /// </summary>
        /// <param name="to">recipient jid</param>
        /// <param name="sdp">SDP string from Icelink</param>
        public void SendSessionInitiate(string to, string sdp)
        {
            try
            {
                Iq iq = new Iq();
                iq.To = to;
                //iq.From = this._jid;
                iq.Type = Matrix.Xmpp.IqType.Set;
                Matrix.Xmpp.Jingle.Jingle jingle = Jingle.JingleSdp.FromSdp(sdp);
                jingle.Action = Matrix.Xmpp.Jingle.Action.SessionInitiate;
                jingle.GenerateSid();
                iq.Add(jingle);

                //iq.Add(new Matrix.Xmpp.Jingle.Jingle());
                //xmppClient.Send(new Matrix.Xmpp.Client.Message(to, Matrix.Xmpp.MessageType.Chat, jingle.ToString()));
                xmppClient.Send(iq);
                Log.Info(">session-initiate " + to);
            }
            catch (Exception e)
            {
                Log.Error("Can't SendSessionInitiate " + e.ToString());
            }
        }