InsertHeader() public method

Inserts a header into the SIP message by either replacing the existing header, appending it at the end of its own header list, or inserting at the front of its own header list depending on the method specified.
public InsertHeader ( SIPLib.SIP.Header header, string method = "replace" ) : void
header SIPLib.SIP.Header The header to insert.
method string The method - "replace", "append" or "insert". "replace" is the default.
return void
Example #1
0
 /// <summary>
 /// Populates the message - inserts the input list of headers into the message
 /// </summary>
 /// <param name="m">The message being populated.</param>
 /// <param name="headers">The headers to insert.</param>
 /// <param name="content">The SIP body content.</param>
 /// <returns>Message.</returns>
 public static Message PopulateMessage(Message m, Dictionary <string, List <Header> > headers = null,
                                       string content = "")
 {
     if (headers != null)
     {
         foreach (List <Header> header in headers.Values)
         {
             foreach (Header h in header)
             {
                 m.InsertHeader(h, "append");
             }
         }
     }
     if (!string.IsNullOrEmpty(content))
     {
         m.Body = content;
     }
     else
     {
         if (m.Headers.ContainsKey("Content-Length"))
         {
             m.Headers["Content-Length"][0] = new Header("0" + "\r\n", "Content-Length");
         }
         else
         {
             List <Header> newheaders = new List <Header> {
                 new Header("0" + "\r\n", "Content-Length")
             };
             m.Headers.Add("Content-Length", newheaders);
         }
     }
     return(m);
 }
Example #2
0
        /// <summary>
        /// Creates a SIP register request.
        /// </summary>
        /// <param name="aor">The address-of-record.</param>
        /// <returns>Message.</returns>
        public virtual Message CreateRegister(SIPURI aor)
        {
            if (aor != null)
            {
                RemoteParty = new Address(aor.ToString());
            }
            if (LocalParty == null)
            {
                LocalParty = new Address(RemoteParty.ToString());
            }
            Message m = CreateRequest("REGISTER");

            m.InsertHeader(new Header("", "Authorization"));
            return(m);
        }
Example #3
0
        /// <summary>
        /// Creates a SIP response, filling in the necessary parameters from the dialog.
        /// </summary>
        /// <param name="response_code">The SIP response_code.</param>
        /// <param name="response_text">The SIP response_text.</param>
        /// <param name="content">The SIP body contents.</param>
        /// <param name="contentType">The type of the SIP body.</param>
        /// <returns>Message.</returns>
        public override Message CreateResponse(int response_code, string response_text, string content = null,
                                               string contentType = null)
        {
            if (Servers.Count == 0)
            {
                Debug.Assert(false, String.Format("No server transaction to create response"));
                return(null);
            }


            // TODO REMOVE THIS LOGIC
            //string branchID = ((Message)response).First("Via").Attributes["branch"];
            //Transaction = null;
            //foreach (Transaction transaction in Servers)
            //{
            //    if (branchID == transaction.Branch)
            //    {
            //        Transaction = transaction;
            //        Request = transaction.Request;
            //    }
            //}
            //if (Transaction == null)
            //{
            //    Debug.Assert(false, String.Format("No transactions in dialog matched"));
            //    return;
            //}
            if (Servers.Count > 1)
            {
                Console.WriteLine("Got some transaction servers");
            }
            Message request  = Servers[Servers.Count - 1].Request;
            Message response = Message.CreateResponse(response_code, response_text, null, content, request);

            if (!string.IsNullOrEmpty(contentType))
            {
                response.InsertHeader(new Header(contentType, "Content-Type"));
            }
            if (response.ResponseCode != 100 && !response.Headers["To"][0].Attributes.ContainsKey("tag"))
            {
                response.Headers["To"][0].Attributes["tag"] = LocalTag;
            }
            return(response);
        }
Example #4
0
        /// <summary>
        /// Creates a SIP response given the response code and responseText
        /// </summary>
        /// <param name="responseCode">The response code.</param>
        /// <param name="responseText">The response text.</param>
        /// <param name="content">The content.</param>
        /// <param name="contentType">Type of the content.</param>
        /// <returns>Message.</returns>
        public virtual Message CreateResponse(int responseCode, string responseText, string content = null,
                                              string contentType = null)
        {
            if (Request == null)
            {
                Debug.Assert(false, String.Format("Invalid request in creating a response"));
                return(null);
            }
            Message responseMessage = Message.CreateResponse(responseCode, responseText, null, content, Request);

            if (contentType != null)
            {
                responseMessage.InsertHeader(new Header(contentType, "Content-Type"));
            }
            if (responseMessage.ResponseCode != 100 && !responseMessage.Headers["To"][0].ToString().Contains("tag"))
            {
                responseMessage.Headers["To"][0].Attributes.Add("tag", LocalTag);
            }
            return(responseMessage);
        }
Example #5
0
        /// <summary>
        /// Handle received request
        /// </summary>
        /// <param name="m">The received message.</param>
        /// <param name="uri">The SIPURI that sent the message.</param>
        private void ReceivedRequest(Message m, SIPURI uri)
        {
            string      branch = m.Headers["Via"][0].Attributes["branch"];
            Transaction t;

            if (m.Method == "ACK")
            {
                if (branch == "0")
                {
                    t = null;
                }
                else
                {
                    t = FindTransaction(branch);
                    if (t == null || (t.LastResponse != null && t.LastResponse.Is2XX()))
                    {
                        t = FindTransaction(Transaction.CreateId(branch, m.Method));
                    }
                }
            }
            else
            {
                t = FindTransaction(Transaction.CreateId(branch, m.Method));
            }
            if (t == null)
            {
                UserAgent app = null; // Huh ?
                if ((m.Method != "CANCEL") && (m.Headers["To"][0].Attributes.ContainsKey("tag")))
                {
                    //In dialog request
                    Dialog d = FindDialog(m);
                    if (d == null)
                    {
                        if (m.Method != "ACK")
                        {
                            //Updated from latest code TODO
                            UserAgent u = CreateServer(m, uri);
                            if (u != null)
                            {
                                app = u;
                            }
                            else
                            {
                                // TODO: FIX NOTIFY ON SUBSCRIBE HANDLING
                                if (m.Method != "NOTIFY")
                                {
                                    Send(Message.CreateResponse(481, "Dialog does not exist", null, null, m));
                                    return;
                                }
                                else
                                {
                                    string branchID = m.Headers["Via"][0].Attributes["branch"];
                                    if (_seenNotifys.ContainsKey(branchID) && _seenNotifys[branchID] > 1)
                                    {
                                        Send(Message.CreateResponse(481, "Dialog does not exist", null, null, m));
                                        return;
                                    }
                                    else
                                    {
                                        if (_seenNotifys.ContainsKey(branchID))
                                        {
                                            _seenNotifys[branchID] = _seenNotifys[branchID] + 1;
                                        }
                                        else
                                        {
                                            _seenNotifys[branchID] = 1;
                                        }
                                    }
                                }
                                return;
                            }
                        }
                        else
                        {
                            _log.Info("No dialog for ACK, finding transaction");
                            if (t == null && branch != "0")
                            {
                                t = FindTransaction(Transaction.CreateId(branch, "INVITE"));
                            }
                            if (t != null && t.State != "terminated")
                            {
                                t.ReceivedRequest(m);
                                return;
                            }
                            else
                            {
                                _log.Info("No existing transaction for ACK \n");
                                UserAgent u = CreateServer(m, uri);
                                if (u != null)
                                {
                                    app = u;
                                }
                                else
                                {
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        app = d;
                    }
                }
                else if (m.Method != "CANCEL")
                {
                    //Out of dialog request
                    UserAgent u = CreateServer(m, uri);
                    if (u != null)
                    {
                        //TODO error.....
                        app = u;
                    }
                    else if (m.Method == "OPTIONS")
                    {
                        //Handle OPTIONS
                        Message reply = Message.CreateResponse(200, "OK", null, null, m);
                        reply.InsertHeader(new Header("INVITE,ACK,CANCEL,BYE,OPTION,MESSAGE,PUBLISH", "Allow"));
                        Send(m);
                        return;
                    }
                    else if (m.Method == "MESSAGE")
                    {
                        //Handle MESSAGE
                        UserAgent ua = new UserAgent(this)
                        {
                            Request = m
                        };

                        /*Message reply = ua.CreateResponse(200, "OK");
                         * Send(reply);*/
                        App.ReceivedRequest(ua, m, this);
                        return;
                    }
                    else if (m.Method == "PUBLISH")
                    {
                        UserAgent ua = new UserAgent(this)
                        {
                            Request = m
                        };
                        App.ReceivedRequest(ua, m, this);
                        return;
                    }
                    else if (m.Method != "ACK")
                    {
                        Send(Message.CreateResponse(405, "Method not allowed", null, null, m));
                        return;
                    }
                }
                else
                {
                    //Cancel Request
                    Transaction o =
                        FindTransaction(Transaction.CreateId(m.Headers["Via"][0].Attributes["branch"], "INVITE"));
                    if (o == null)
                    {
                        Send(Message.CreateResponse(481, "Original transaction does not exist", null, null, m));
                        return;
                    }
                    app = o.App;
                }

                if (app != null)
                {
                    //t = Transaction.CreateServer(app.Stack, app, app.Request, app.Stack.Transport, app.Stack.Tag);
                    // TODO: Check app or this ?
                    t = Transaction.CreateServer(this, app, m, Transport, Tag);
                }
                else if (m.Method != "ACK")
                {
                    Send(Message.CreateResponse(404, "Not found", null, null, m));
                }
            }
            else
            {
                t.ReceivedRequest(m);
            }
        }
Example #6
0
        /// <summary>
        /// Method to send SIP messages. Handles appending of necessary information and routing rules.
        /// </summary>
        /// <param name="data">The data to send (can be a SIPMessage or string representing a SIP message).</param>
        /// <param name="dest">The destination (can be a SIPURI or a string).</param>
        /// <param name="transport">Optional TransportInfo object.</param>
        public void Send(object data, object dest = null, TransportInfo transport = null)
        {
            string destinationHost = "";
            int    destinationPort = 0;
            string finalData;

            if (ProxyHost != null && ProxyPort != 0)
            {
                destinationHost = ProxyHost;
                destinationPort = Convert.ToInt32(ProxyPort);
            }
            else if (dest is SIPURI)
            {
                SIPURI destination = (SIPURI)dest;
                if (destination.Host.Length == 0)
                {
                    Debug.Assert(false, String.Format("No host in destination URI \n{0}\n", destination));
                }
                else
                {
                    destinationHost = destination.Host;
                    destinationPort = destination.Port;
                }
            }
            else if (dest is string)
            {
                string   destination = (string)(dest);
                string[] parts       = destination.Split(':');
                destinationHost = parts[0];
                destinationPort = Convert.ToInt32(parts[1]);
            }

            if (data is Message)
            {
                Message m = (Message)data;
                //TODO: Fix stripping of record-route
                //if (m.Headers.ContainsKey("Record-Route")) m.Headers.Remove("Record-Route");
                //if (!Helpers.IsRequest(m) && m.Is2XX() && m.First("CSeq").Method.Contains("INVITE"))
                //{
                //    m.Headers.Remove("Record-Route");
                //}
                if (Helpers.IsRequest(m) && m.Method == "ACK")
                {
                    _log.Info("Sending ACK");
                }
                m.InsertHeader(new Header(_userAgentName, "User-Agent"));
                if (m.Headers.ContainsKey("Route"))
                {
                }
                else
                {
                    if (ServiceRoute != null)
                    {
                        if (
                            !(Helpers.IsRequest(m) &&
                              ((m.Method.ToLower().Contains("register") ||
                                (m.Method.ToLower().Contains("ack") || (m.Method.ToLower().Contains("bye")))))))
                        {
                            m.Headers["Route"] = ServiceRoute;
                        }
                    }
                    else if (!string.IsNullOrEmpty(ProxyHost))
                    {
                        m.InsertHeader(new Header("<sip:" + ProxyHost + ":" + ProxyPort + ">", "Route"));
                    }
                }
                if (!string.IsNullOrEmpty(m.Method))
                {
                    // TODO: Multicast handling of Maddr
                }
                else if (m.ResponseCode > 0)
                {
                    if (dest == null)
                    {
                        destinationHost = m.Headers["Via"][0].ViaUri.Host;
                        destinationPort = m.Headers["Via"][0].ViaUri.Port;
                    }
                }
                ////TODO FIX HACK
                //string route_list = "";
                //if (m.headers.ContainsKey("Route"))
                //{
                //foreach (Header h in m.headers["Route"])
                //{
                //    route_list = route_list + h.value.ToString() + ",";
                //}
                //route_list = route_list.Remove(route_list.Length - 1);
                //Header temp = new Header(route_list, "Temp");
                //temp.value = route_list;
                //temp.name = "Route";
                //m.headers.Remove("Route");
                //m.insertHeader(temp);
                //}

                finalData = m.ToString();
            }
            else
            {
                finalData = (string)data;
            }
            App.Send(finalData, destinationHost, destinationPort, this);
        }
Example #7
0
        public override void ReceivedRequest(Transaction transaction, Message request)
        {
            //try
            //{
            if ((transaction != null) && Transaction != null && Transaction != transaction &&
                request.Method.ToUpper() != "CANCEL")
            {
                Debug.Assert(false, "Invalid transaction for received request");
            }
            Server = true;
            if (!request.Uri.Scheme.ToLower().Equals("sip"))
            {
                SendResponse(416, "Unsupported URI scheme");
                return;
            }

            if (request.First("Max-Forwards") != null &&
                int.Parse(request.First("Max-Forwards").Value.ToString()) < 0)
            {
                SendResponse(483, "Too many hops");
                return;
            }

            if (!request.Headers["To"][0].Attributes.ContainsKey("tag") && transaction != null)
            {
                if (Stack.FindOtherTransactions(request, transaction) != null)
                {
                    //SendResponse(482, "Loop detected - found another transaction");
                    return;
                }
            }

            if (request.First("Proxy-Require") != null)
            {
                if (!request.Method.ToUpper().Contains("CANCEL") && !request.Method.ToUpper().Contains("ACK"))
                {
                    Message response    = CreateResponse(420, "Bad extension");
                    Header  unsupported = request.First("Proxy-Require");
                    unsupported.Name = "Unsupported";
                    response.InsertHeader(unsupported);
                    SendResponse(unsupported);
                    return;
                }
            }

            if (transaction != null)
            {
                Transaction = transaction;
            }

            if (request.Method.ToUpper() == "CANCEL")
            {
                string branch;
                if (request.First("Via") != null && request.First("Via").Attributes.ContainsKey("branch"))
                {
                    branch = request.First("Via").Attributes["branch"];
                }
                else
                {
                    branch = Transaction.CreateBranch(request, true);
                }
                Transaction original = Stack.FindTransaction(Transaction.CreateId(branch, "INVITE"));
                if (original != null)
                {
                    if (original.State == "proceeding" || original.State == "trying")
                    {
                        original.SendResponse(original.CreateResponse(487, "Request terminated"));
                    }
                    transaction = Transaction.CreateServer(Stack, this, request, Stack.Transport,
                                                           Stack.Tag, false);
                    transaction.SendResponse(transaction.CreateResponse(200, "OK"));
                }
                SendCancel();
                return;
            }

            if (string.IsNullOrEmpty(request.Uri.User) && IsLocal(request.Uri) && request.Uri.Parameters != null &&
                request.First("Route") != null)
            {
                Header lastRoute = request.Headers["Route"].Last();
                request.Headers["Route"].RemoveAt(request.Headers["Route"].Count - 1);
                request.Uri = ((Address)(lastRoute.Value)).Uri;
            }
            if (request.First("Route") != null && IsLocal(((Address)(request.First("Route").Value)).Uri))
            {
                request.Headers["Route"].RemoveAt(0);
                request.had_lr = true;
            }
            Stack.ReceivedRequest(this, request);
            //}
            //catch (Exception)
            //{
            //    throw;
            //}
        }
Example #8
0
        /// <summary>
        /// Creates a SIP request.
        /// </summary>
        /// <param name="method">The SIP method.</param>
        /// <param name="dest">The dest (either Address or string[]).</param>
        /// <param name="stateless">if set to <c>true</c> [act as a stateless proxy].</param>
        /// <param name="recordRoute">if set to <c>true</c> [record the SIP route].</param>
        /// <param name="headers">The SIP headers to use.</param>
        /// <param name="route">The route.</param>
        /// <returns>Message.</returns>
        public Message CreateRequest(string method, object dest, bool stateless  = false, bool recordRoute   = false,
                                     Dictionary <string, List <Header> > headers = null, List <Header> route = null)
        {
            if (method != Request.Method)
            {
                Debug.Assert(false, "method in createRequest must be same as original UAS for proxy");
            }
            Message request = Request.Dup();

            if (!stateless && Transaction == null)
            {
                Transaction = Transaction.CreateServer(Stack, this, Request, Stack.Transport, Stack.Tag,
                                                       false);
            }

            if (dest.GetType() == typeof(Address))
            {
                request.Uri = ((Address)dest).Uri.Dup();
            }
            else if (dest is string[])
            {
                string[] destArray = (string[])dest;
                string   scheme    = request.Uri.Scheme;
                string   user      = request.Uri.User;
                request.Uri = new SIPURI {
                    Scheme = scheme, User = user, Host = destArray[0], Port = int.Parse(destArray[1])
                };
            }
            else
            {
                Debug.Assert(false, "Dest in Proxy Create Request is not a String or Address");
                //else: request.uri = dest.dup()
            }
            if (request.First("Max-Forwards") != null)
            {
                object value        = request.First("Max-Forwards").Value;
                int    currentValue = int.Parse(value.ToString());
                currentValue = currentValue - 1;
                request.InsertHeader(new Header(currentValue.ToString(), "Max-Forwards"));
            }
            else
            {
                request.InsertHeader(new Header("70", "Max-Forwards"));
            }
            if (recordRoute)
            {
                Address rr = new Address(Stack.Uri.ToString());
                rr.Uri.Parameters["lr"] = null;
                rr.MustQuote            = true;
                request.InsertHeader(new Header(rr.ToString(), "Record-Route"));
            }
            if (headers != null)
            {
                request.Headers.Concat(headers).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
            }
            if (route != null)
            {
                route.Reverse();
                foreach (Header header in route)
                {
                    request.InsertHeader(header);
                }
            }

            Header viaHeader = Stack.CreateVia();

            viaHeader.Attributes["branch"] = Transaction.createProxyBranch(request, false);
            request.InsertHeader(viaHeader, "insert");
            return(request);
        }
Example #9
0
        /// <summary>
        /// Authenticates the specified response.
        /// </summary>
        /// <param name="response">The response.</param>
        /// <param name="transaction">The transaction.</param>
        /// <returns><c>true</c> if attempt to authenticate is created, <c>false</c> otherwise</returns>
        public virtual bool Authenticate(Message response, Transaction transaction)
        {
            Header a;

            if (response.Headers.ContainsKey("WWW-Authenticate") || response.Headers.ContainsKey("Proxy-Authenticate"))
            {
                a = response.Headers["WWW-Authenticate"][0];
            }
            else if (response.Headers.ContainsKey("Proxy-Authenticate"))
            {
                a = response.Headers["Proxy-Authenticate"][0];
            }
            else
            {
                return(false);
            }
            Message request = new Message(transaction.Request.ToString());
            bool    resend = false, present = false;

            // foreach (Header h in request.headers["Authorization"].Concat(request.headers["Proxy-Authorization"]))
            foreach (Header h in request.Headers["Authorization"])
            {
                try
                {
                    if (a.Attributes["realm"] == h.Attributes["realm"] &&
                        (a.Name == "WWW-Authenticate" && h.Name == "Authorization" ||
                         a.Name == "Proxy-Authenticate" && h.Name == "Proxy-Authorization"))
                    {
                        present = true;
                        break;
                    }
                }
                catch (Exception e)
                {
                }
            }
            if (!present && a.Attributes.ContainsKey("realm"))
            {
                string[] result = Stack.Authenticate(this, a);
                if (result.Length == 0 || a.Attributes.ContainsKey("password") && a.Attributes.ContainsKey("hashValue"))
                {
                    return(false);
                }
                //string value = createAuthorization(a.value, a.attributes["username"], a.attributes["password"], request.uri.ToString(), this.request.method, this.request.body, this.auth);
                string value = SIP.Authenticate.CreateAuthorization(a.ToString(), result[0], result[1],
                                                                    request.Uri.ToString(), request.Method, request.Body,
                                                                    Auth);
                if (value.Length > 0)
                {
                    request.InsertHeader(
                        a.Name == "WWW-Authenticate"
                            ? new Header(value, "Authorization")
                            : new Header(value, "Proxy-Authorization"));

                    resend = true;
                }
            }
            if (resend)
            {
                LocalSeq = request.First("CSeq").Number + 1;
                request.InsertHeader(new Header(LocalSeq.ToString() + " " + request.Method, "CSeq"));
                //TODO FIX?
                //request.headers["Via"][0].attributes["branch"] = Transaction.createBranch(request, false);
                Request     = request;
                Transaction = Transaction.CreateClient(Stack, this, Request, transaction.Transport, transaction.Remote);
                return(true);
            }
            return(false);
        }
Example #10
0
 /// <summary>
 /// Populates the message - inserts the input list of headers into the message
 /// </summary>
 /// <param name="m">The message being populated.</param>
 /// <param name="headers">The headers to insert.</param>
 /// <param name="content">The SIP body content.</param>
 /// <returns>Message.</returns>
 public static Message PopulateMessage(Message m, Dictionary<string, List<Header>> headers = null,
                                       string content = "")
 {
     if (headers != null)
     {
         foreach (List<Header> header in headers.Values)
         {
             foreach (Header h in header)
             {
                 m.InsertHeader(h, "append");
             }
         }
     }
     if (!string.IsNullOrEmpty(content))
     {
         m.Body = content;
     }
     else
     {
         if (m.Headers.ContainsKey("Content-Length"))
         {
             m.Headers["Content-Length"][0] = new Header("0" + "\r\n", "Content-Length");
         }
         else
         {
             List<Header> newheaders = new List<Header> {new Header("0" + "\r\n", "Content-Length")};
             m.Headers.Add("Content-Length", newheaders);
         }
     }
     return m;
 }
Example #11
0
        /// <summary>
        /// Authenticates the specified response.
        /// </summary>
        /// <param name="response">The response.</param>
        /// <param name="transaction">The transaction.</param>
        /// <returns><c>true</c> if attempt to authenticate is created, <c>false</c> otherwise</returns>
        public virtual bool Authenticate(Message response, Transaction transaction)
        {
            Header a;
            if (response.Headers.ContainsKey("WWW-Authenticate") || response.Headers.ContainsKey("Proxy-Authenticate"))
            {
                a = response.Headers["WWW-Authenticate"][0];
            }
            else if (response.Headers.ContainsKey("Proxy-Authenticate"))
            {
                a = response.Headers["Proxy-Authenticate"][0];
            }
            else return false;
            Message request = new Message(transaction.Request.ToString());
            bool resend = false, present = false;
            // foreach (Header h in request.headers["Authorization"].Concat(request.headers["Proxy-Authorization"]))
            foreach (Header h in request.Headers["Authorization"])
            {
                try
                {
                    if (a.Attributes["realm"] == h.Attributes["realm"] &&
                        (a.Name == "WWW-Authenticate" && h.Name == "Authorization" ||
                         a.Name == "Proxy-Authenticate" && h.Name == "Proxy-Authorization"))
                    {
                        present = true;
                        break;
                    }
                }
                catch (Exception e)
                {
                }
            }
            if (!present && a.Attributes.ContainsKey("realm"))
            {
                string[] result = Stack.Authenticate(this, a);
                if (result.Length == 0 || a.Attributes.ContainsKey("password") && a.Attributes.ContainsKey("hashValue"))
                {
                    return false;
                }
                //string value = createAuthorization(a.value, a.attributes["username"], a.attributes["password"], request.uri.ToString(), this.request.method, this.request.body, this.auth);
                string value = SIP.Authenticate.CreateAuthorization(a.ToString(), result[0], result[1],
                                                                    request.Uri.ToString(), request.Method, request.Body,
                                                                    Auth);
                if (value.Length > 0)
                {
                    request.InsertHeader(
                        a.Name == "WWW-Authenticate"
                            ? new Header(value, "Authorization")
                            : new Header(value, "Proxy-Authorization"));

                    resend = true;
                }
            }
            if (resend)
            {
                LocalSeq = request.First("CSeq").Number + 1;
                request.InsertHeader(new Header(LocalSeq.ToString() + " " + request.Method, "CSeq"));
                //TODO FIX?
                //request.headers["Via"][0].attributes["branch"] = Transaction.createBranch(request, false);
                Request = request;
                Transaction = Transaction.CreateClient(Stack, this, Request, transaction.Transport, transaction.Remote);
                return true;
            }
            return false;
        }