Exemplo n.º 1
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.º 2
0
        private string CreateForwardedRequest(string message, string content)
        {
            var reader       = Parse(message);
            var contentBytes = Encoding.UTF8.GetBytes(content);

            using (var writer = new SipMessageWriter())
            {
                proxie.GenerateForwardedRequest(writer, reader, new ArraySegment <byte>(contentBytes), destAddr, 0x1000);
                return(Encoding.UTF8.GetString(writer.Buffer, writer.Offset, writer.Count));
            }
        }