示例#1
0
        public void ParseViaHeaderValueTest()
        {
            var testee = ViaSipHeaderValue.ParseViaHeaderValue(@"   SIP / 2.0	/ UDP first.example.com: 4000;ttl=16 ;maddr=224.2.0.1 ;branch=z9hG4bKa7c6a8dlze.1   ");

            Assert.Equal("SIP/2.0/UDP", testee.TransportProtocol);
            Assert.Equal("first.example.com:4000", testee.ClientHost);
            Assert.Equal("16", testee.Ttl);
            Assert.Equal("224.2.0.1", testee.Maddr);
            Assert.Equal("z9hG4bKa7c6a8dlze.1", testee.Branch);
        }
示例#2
0
        private void ProcessHeader(string headerName, string headerValue)
        {
            //Save the "RAW" header value text
            if (!Headers.ContainsKey(headerName))
            {
                Headers[headerName] = new List <string>();
            }
            Headers[headerName].Add(headerValue);

            if (HeaderHelpers.LookupComapactHeader(headerName).Equals("Via"))
            {
                ViaSipHeaderValue viaHeaderValue = ViaSipHeaderValue.ParseViaHeaderValue(headerValue);
                ViaHeaders.Add(viaHeaderValue);
            }
        }