Exemplo n.º 1
0
            public RequestProxyFactory(ProxyServerTU parent, IncomingMessageEx request)
            {
                this.parent  = parent;
                this.request = request;

                this.requestProxy = null;
            }
Exemplo n.º 2
0
        private void CancelClients(RequestProxy requestProxy, SipMessageReader message)
        {
            lock (requestProxy)
            {
                var proxies = requestProxy.GetAllProxie();

                for (int i = 0; i < proxies.Count; i++)
                {
                    if (proxies[i].IsFinalReceived == false && proxies[i].IsCancelSent == false)
                    {
                        proxies[i].IsCancelSent = true;

                        if (Transaction.GetTransactionKind(proxies[i].TransactionId) == Transaction.Kind.InviteClient)
                        {
                            var writer = GetWriter();
                            proxies[i].GenerateCancel(writer, message);

                            int transactionKId = Transaction.GetRelaytedCancelClientKId(proxies[i].TransactionId);

                            requestProducer.SendRequest(proxies[i].ToConnectionAddresses, writer, transactionKId);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void ForwardRequest(IProxie proxie, RequestProxy requestProxy, SipMessageReader reader)
        {
            #region vars...
            var serverConnectionAddresses = requestProxy.ConnectionAddresses;
            var clientConnectionAddresses = proxie.ToConnectionAddresses;
            int serverTransactionId       = requestProxy.ServerTransactionId;
            int clientTransactionId       = proxie.TransactionId;
            var method  = reader.Method;
            var content = requestProxy.Content;
            #endregion

            clientTransactionIds.Add(clientTransactionId, serverTransactionId);

            if (method == Methods.Ackm)
            {
                proxie.IsFinalReceived = true;
            }

            requestProxy.AddProxie(proxie);

            var writer = GetWriter();
            proxie.GenerateForwardedRequest(writer, reader, content, serverConnectionAddresses, serverTransactionId);
            requestProducer.SendRequest(clientConnectionAddresses, writer, clientTransactionId, serverTransactionId);

            proxie.TimerC = (method == Methods.Invitem) ?
                            timerC.Add(new ServerClientId(serverTransactionId, clientTransactionId)) : timerC.InvalidTimerIndex;
        }
Exemplo n.º 4
0
			public RequestProxyFactory(ProxyServerTU parent, IncomingMessageEx request)
			{
				this.parent = parent;
				this.request = request;

				this.requestProxy = null;
			}
Exemplo n.º 5
0
        private SipMessageReader ParseHeaders(RequestProxy requestProxy)
        {
            if (readerInternal == null)
            {
                readerInternal = new SipMessageReader();
            }

            readerInternal.SetDefaultValue();
            readerInternal.Parse(requestProxy.Headers.Array, requestProxy.Headers.Offset, requestProxy.Headers.Count);
            readerInternal.SetArray(requestProxy.Headers.Array);

            return(readerInternal);
        }
Exemplo n.º 6
0
 private void SendBestIfAllFinalRecived(RequestProxy requestProxy)
 {
     if (requestProxy != null)
     {
         if (requestProxy.IsAllRequestsSent && requestProxy.IsAllResponsesReceived)
         {
             var bestResponse = requestProxy.DetachBestResponse();
             if (bestResponse != null)
             {
                 SendResponse(requestProxy.ConnectionAddresses, requestProxy.ServerTransactionId, bestResponse);
             }
         }
     }
 }
Exemplo n.º 7
0
        private void RemoveIfFinished(RequestProxy requestProxy)
        {
            if (requestProxy != null)
            {
                if (requestProxy.IsAllRequestsSent && requestProxy.IsAllResponsesReceived)
                {
                    var proxies = requestProxy.GetAllProxie();
                    for (int i = 0; i < proxies.Count; i++)
                    {
                        clientTransactionIds.Remove(proxies[i].TransactionId);
                    }

                    requestProxy.Dispose();
                    requestProxyes.Remove(requestProxy.ServerTransactionId);
                }
            }
        }
Exemplo n.º 8
0
			private void CreateLockedRequestProxy()
			{
				if (requestProxy == null)
				{
					requestProxy = new RequestProxy(request);
					Monitor.Enter(requestProxy);

					if (request.Reader.Method != Methods.Ackm)
						parent.requestProxyes.Add(requestProxy.ServerTransactionId, requestProxy);

					if (request.Reader.Method == Methods.Invitem)
					{
						var writer = parent.GetWriter();
						writer.WriteResponse(request.Reader, StatusCodes.Trying);
						parent.SendResponse(request, writer);
					}
				}
			}
Exemplo n.º 9
0
            private void CreateLockedRequestProxy()
            {
                if (requestProxy == null)
                {
                    requestProxy = new RequestProxy(request);
                    Monitor.Enter(requestProxy);

                    if (request.Reader.Method != Methods.Ackm)
                    {
                        parent.requestProxyes.Add(requestProxy.ServerTransactionId, requestProxy);
                    }

                    if (request.Reader.Method == Methods.Invitem)
                    {
                        var writer = parent.GetWriter();
                        writer.WriteResponse(request.Reader, StatusCodes.Trying);
                        parent.SendResponse(request, writer);
                    }
                }
            }