예제 #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;
        }
예제 #2
0
 public void Forward(IProxie proxie)
 {
     if (proxie != null)
     {
         CreateLockedRequestProxy();
         parent.ForwardRequest(proxie, requestProxy, request.Reader);
     }
 }
예제 #3
0
			public void Forward(IProxie proxie)
			{
				if (proxie != null)
				{
					CreateLockedRequestProxy();
					parent.ForwardRequest(proxie, requestProxy, request.Reader);
				}
			}
예제 #4
0
		public LocalTrunkProxieTest()
		{
			trunk = new Trunk("Display Name", "trunk.domain", "user", Transports.Udp,
				new IPEndPoint(IPAddress.Parse("1.2.3.4"), 1234), "server.url", "username", "password", "*****@*****.**", 0)
			{
				//Nonce = new ByteArrayPart("NONCEVALUE"),
				//Opaque = new ByteArrayPart("OPAQUEVALUE"),
				AuthHeader = HeaderNames.Authorization,
			};
			trunk.UpdateChallenge(new ByteArrayPart("NONCEVALUE"), new ByteArrayPart("OPAQUEVALUE"), new ByteArrayPart("auth"));

			proxie = new LocalTrunkProxie(0x12345678, trunk);

			destAddr = new ConnectionAddresses(Transports.Udp, new IPEndPoint(IPAddress.Parse("1.2.3.4"), 1234), new IPEndPoint(IPAddress.Parse("9.0.0.0"), 9000), 99);
			srcAddr = new ConnectionAddresses(Transports.Tcp, new IPEndPoint(IPAddress.Parse("5.6.7.8"), 5678), new IPEndPoint(IPAddress.Parse("8.0.0.0"), 8000), 88);

			request = CreateForwardedRequest(
				"INVITE sip:[email protected] SIP/2.0\r\n" +
				"Via: SIP/2.0/TCP 127.0.0.1:11371\r\n" +
				"Max-Forwards: 70\r\n" +
				"From: <sip:[email protected]>;tag=123;epid=456\r\n" +
				"To: <sip:[email protected]>\r\n" +
				"Call-ID: 403d20dd4ff84d178cd187b5710cb9a8\r\n" +
				"CSeq: 25 INVITE\r\n" +
				"Contact: <sip:[email protected]:11371;maddr=127.0.0.1;transport=tcp>;proxy=replace;+sip.instance=\"<urn:uuid:6984F470-4B9A-5F59-90C1-C9CA88CF214A>\"\r\n" +
				"Authorization: Digest username=\"jdoe2\", realm=\"officesip.local\", qop=auth, algorithm=MD5, uri=\"sip:[email protected]\", nonce=\"c01ba269fbd8eb84d29a52bd8ba7ba7e\", nc=6, cnonce=\"85550150622448769693330628644602\", opaque=\"00000001\", response=\"feed390d2fcaa5e65f0ce57eaa64756c\"\r\n" +
				"Content-Type: application/sdp\r\n" +
				"Content-Length: 135\r\n" +
				"\r\n",
				content);

			response = CreateForwardedResponse(
				"SIP/2.0 200 OK\r\n" +
				"Via: SIP/2.0/UDP 1.2.3.4:1234;branch=z9hG4bK12345678\r\n" +
				"Record-Route: <sip:1.2.3.4:1234;lr>\r\n" +
				"Via: SIP/2.0/TCP 127.0.0.1:11371\r\n" +
				"Max-Forwards: 69\r\n" +
				"From: \"Display Name\" <sip:[email protected]>;tag=123;epid=456\r\n" +
				"To: <sip:[email protected]>;tag=321\r\n" +
				"Call-ID: callid\r\n" +
				"CSeq: 1 INVITE\r\n" +
				"Contact: <sip:55.55.55.55:5555;transport=udp>;+sip.instance=\"<urn:uuid:123>\"\r\n" +
				"Content-Type: application/sdp\r\n" +
				"WWW-Authenticate: Digest realm=\"xxx\",nonce=\"0d0f70e6aa82aac734235c10f150271f\",qop=\"auth\",algorithm=MD5,stale=false,opaque=\"00000001\"\r\n" +
				"Content-Length: 135\r\n",
				content);
		}
예제 #5
0
        public LocalTrunkProxieTest()
        {
            trunk = new Trunk("Display Name", "trunk.domain", "user", Transports.Udp,
                              new IPEndPoint(IPAddress.Parse("1.2.3.4"), 1234), "server.url", "username", "password", "*****@*****.**", 0)
            {
                //Nonce = new ByteArrayPart("NONCEVALUE"),
                //Opaque = new ByteArrayPart("OPAQUEVALUE"),
                AuthHeader = HeaderNames.Authorization,
            };
            trunk.UpdateChallenge(new ByteArrayPart("NONCEVALUE"), new ByteArrayPart("OPAQUEVALUE"), new ByteArrayPart("auth"));

            proxie = new LocalTrunkProxie(0x12345678, trunk);

            destAddr = new ConnectionAddresses(Transports.Udp, new IPEndPoint(IPAddress.Parse("1.2.3.4"), 1234), new IPEndPoint(IPAddress.Parse("9.0.0.0"), 9000), 99);
            srcAddr  = new ConnectionAddresses(Transports.Tcp, new IPEndPoint(IPAddress.Parse("5.6.7.8"), 5678), new IPEndPoint(IPAddress.Parse("8.0.0.0"), 8000), 88);

            request = CreateForwardedRequest(
                "INVITE sip:[email protected] SIP/2.0\r\n" +
                "Via: SIP/2.0/TCP 127.0.0.1:11371\r\n" +
                "Max-Forwards: 70\r\n" +
                "From: <sip:[email protected]>;tag=123;epid=456\r\n" +
                "To: <sip:[email protected]>\r\n" +
                "Call-ID: 403d20dd4ff84d178cd187b5710cb9a8\r\n" +
                "CSeq: 25 INVITE\r\n" +
                "Contact: <sip:[email protected]:11371;maddr=127.0.0.1;transport=tcp>;proxy=replace;+sip.instance=\"<urn:uuid:6984F470-4B9A-5F59-90C1-C9CA88CF214A>\"\r\n" +
                "Authorization: Digest username=\"jdoe2\", realm=\"officesip.local\", qop=auth, algorithm=MD5, uri=\"sip:[email protected]\", nonce=\"c01ba269fbd8eb84d29a52bd8ba7ba7e\", nc=6, cnonce=\"85550150622448769693330628644602\", opaque=\"00000001\", response=\"feed390d2fcaa5e65f0ce57eaa64756c\"\r\n" +
                "Content-Type: application/sdp\r\n" +
                "Content-Length: 135\r\n" +
                "\r\n",
                content);

            response = CreateForwardedResponse(
                "SIP/2.0 200 OK\r\n" +
                "Via: SIP/2.0/UDP 1.2.3.4:1234;branch=z9hG4bK12345678\r\n" +
                "Record-Route: <sip:1.2.3.4:1234;lr>\r\n" +
                "Via: SIP/2.0/TCP 127.0.0.1:11371\r\n" +
                "Max-Forwards: 69\r\n" +
                "From: \"Display Name\" <sip:[email protected]>;tag=123;epid=456\r\n" +
                "To: <sip:[email protected]>;tag=321\r\n" +
                "Call-ID: callid\r\n" +
                "CSeq: 1 INVITE\r\n" +
                "Contact: <sip:55.55.55.55:5555;transport=udp>;+sip.instance=\"<urn:uuid:123>\"\r\n" +
                "Content-Type: application/sdp\r\n" +
                "WWW-Authenticate: Digest realm=\"xxx\",nonce=\"0d0f70e6aa82aac734235c10f150271f\",qop=\"auth\",algorithm=MD5,stale=false,opaque=\"00000001\"\r\n" +
                "Content-Length: 135\r\n",
                content);
        }
예제 #6
0
 public void AddProxie(IProxie proxie)
 {
     proxies.Add(proxie);
 }
예제 #7
0
		public void AddProxie(IProxie proxie)
		{
			proxies.Add(proxie);
		}