public void ParseRouteWithDoubleQuotedDisplayNameTest() { Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); SIPRoute route = SIPRoute.ParseSIPRoute("\"Joe Bloggs\" <sip:127.0.0.1:5060;lr>"); Console.WriteLine("SIP Route=" + route.ToString() + "."); Assert.AreEqual(route.Host, "127.0.0.1:5060", "The SIP route host was not parsed correctly."); Assert.AreEqual(route.ToString(), "\"Joe Bloggs\" <sip:127.0.0.1:5060;lr>", "The SIP route string was not correct."); Assert.IsFalse(route.IsStrictRouter, "Route was not correctly passed as a loose router."); }
public void ParseRouteTest() { Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); SIPRoute route = SIPRoute.ParseSIPRoute("<sip:127.0.0.1:5060;lr>"); Console.WriteLine("SIP Route=" + route.ToString() + "."); Assert.True(route.Host == "127.0.0.1:5060", "The SIP route host was not parsed correctly."); Assert.True(route.ToString() == "<sip:127.0.0.1:5060;lr>", "The SIP route string was not correct."); Assert.False(route.IsStrictRouter, "Route was not correctly passed as a loose router."); }
public void ParseRouteWithDoubleQuotedDisplayNameTest() { logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name); SIPRoute route = SIPRoute.ParseSIPRoute("\"Joe Bloggs\" <sip:127.0.0.1:5060;lr>"); logger.LogDebug("SIP Route=" + route.ToString() + "."); Assert.True(route.Host == "127.0.0.1:5060", "The SIP route host was not parsed correctly."); Assert.True(route.ToString() == "\"Joe Bloggs\" <sip:127.0.0.1:5060;lr>", "The SIP route string was not correct."); Assert.False(route.IsStrictRouter, "Route was not correctly passed as a loose router."); }
public void ParseRouteWithDisplayNameTest() { Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); SIPRoute route = SIPRoute.ParseSIPRoute("12345656 <sip:127.0.0.1:5060;lr>"); Console.WriteLine("SIP Route=" + route.ToString() + "."); Console.WriteLine("Route to SIPEndPoint=" + route.ToSIPEndPoint().ToString() + "."); Assert.AreEqual(route.Host, "127.0.0.1:5060", "The SIP route host was not parsed correctly."); Assert.AreEqual(route.ToString(), "\"12345656\" <sip:127.0.0.1:5060;lr>", "The SIP route string was not correct."); Assert.IsFalse(route.IsStrictRouter, "Route was not correctly passed as a loose router."); Assert.AreEqual(route.ToSIPEndPoint().ToString(), "udp:127.0.0.1:5060", "The SIP route did not produce the correct SIP End Point."); }
public void RemoveLooseRouterTest() { Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); SIPRoute route = SIPRoute.ParseSIPRoute("<sip:127.0.0.1:5060;lr>"); route.IsStrictRouter = true; Console.WriteLine("SIP Route=" + route.ToString() + "."); Assert.AreEqual(route.Host, "127.0.0.1:5060", "The SIP route host was not parsed correctly."); Assert.AreEqual(route.ToString(), "<sip:127.0.0.1:5060>", "The SIP route string was not correct."); Assert.IsTrue(route.IsStrictRouter, "Route was not correctly settable as a strict router."); }
public void RemoveLooseRouterTest() { logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name); SIPRoute route = SIPRoute.ParseSIPRoute("<sip:127.0.0.1:5060;lr>"); route.IsStrictRouter = true; logger.LogDebug("SIP Route=" + route.ToString() + "."); Assert.True(route.Host == "127.0.0.1:5060", "The SIP route host was not parsed correctly."); Assert.True(route.ToString() == "<sip:127.0.0.1:5060>", "The SIP route string was not correct."); Assert.True(route.IsStrictRouter, "Route was not correctly settable as a strict router."); }
public void ParseRouteWithUserPortionTest() { Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); string routeStr = "<sip:[email protected]:5060;lr;transport=udp>"; SIPRoute route = SIPRoute.ParseSIPRoute(routeStr); Console.WriteLine("SIP Route=" + route.ToString() + "."); Console.WriteLine("Route to SIPEndPoint=" + route.ToSIPEndPoint().ToString() + "."); Assert.AreEqual(route.Host, "127.0.0.1:5060", "The SIP route host was not parsed correctly."); Assert.AreEqual(route.ToString(), routeStr, "The SIP route string was not correct."); Assert.IsFalse(route.IsStrictRouter, "Route was not correctly passed as a loose router."); Assert.AreEqual(route.ToSIPEndPoint().ToString(), "udp:127.0.0.1:5060", "The SIP route did not produce the correct SIP End Point."); }
public void ParseRouteWithUserPortionTest() { logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name); string routeStr = "<sip:[email protected]:5060;lr;transport=udp>"; SIPRoute route = SIPRoute.ParseSIPRoute(routeStr); logger.LogDebug("SIP Route=" + route.ToString() + "."); logger.LogDebug("Route to SIPEndPoint=" + route.ToSIPEndPoint().ToString() + "."); Assert.True(route.Host == "127.0.0.1:5060", "The SIP route host was not parsed correctly."); Assert.True(route.ToString() == routeStr, "The SIP route string was not correct."); Assert.False(route.IsStrictRouter, "Route was not correctly passed as a loose router."); Assert.True(route.ToSIPEndPoint().ToString() == "udp:127.0.0.1:5060", "The SIP route did not produce the correct SIP End Point."); }
public void MissingBracketsRouteTest() { Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); SIPRoute newRoute = new SIPRoute("sip:127.0.0.1:5060"); Console.WriteLine(newRoute.ToString()); Assert.IsTrue(newRoute.URI.ToString() == "sip:127.0.0.1:5060", "The Route header URI was not correctly parsed."); }
public void MissingBracketsRouteTest() { logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name); SIPRoute newRoute = new SIPRoute("sip:127.0.0.1:5060"); logger.LogDebug(newRoute.ToString()); Assert.True(newRoute.URI.ToString() == "sip:127.0.0.1:5060", "The Route header URI was not correctly parsed."); }
public void ParseMultiLineRecordRouteResponse() { logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name); string sipMsg = "SIP/2.0 200 OK" + m_CRLF + "Via: SIP/2.0/UDP 10.0.0.100:5060;rport=61540;branch=z9hG4bK40661a8b4a2d4973ae75fa52f1940383" + m_CRLF + "From: <sip:[email protected]>;tag=1014391101" + m_CRLF + "To: <sip:[email protected]>;tag=gj-2k5-490f768a-00005cf1-00002e1aR2f0f2383.b" + m_CRLF + "Call-ID: 1960514b216a465fb900e2966d30e9bb" + m_CRLF + "CSeq: 2 INVITE" + m_CRLF + "Record-Route: <sip:77.75.25.44:5060;lr=on>" + m_CRLF + "Record-Route: <sip:77.75.25.45:5060;lr=on;ftag=1014391101>" + m_CRLF + "Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay, multipart/mixed" + m_CRLF + "Contact: <sip:[email protected]:5060>" + m_CRLF + "Allow: INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS" + m_CRLF + "Supported: timer" + m_CRLF + "Session-Expires: 600;refresher=uas" + m_CRLF + "Content-Length: 232" + m_CRLF + "Content-Disposition: session; handling=required" + m_CRLF + "Content-Type: application/sdp" + m_CRLF + m_CRLF + "v=0" + m_CRLF + "o=Sonus_UAC 4125 3983 IN IP4 64.152.60.78" + m_CRLF + "s=SIP Media Capabilities" + m_CRLF + "c=IN IP4 64.152.60.164" + m_CRLF + "t=0 0" + m_CRLF + "m=audio 19144 RTP/AVP 0 101" + m_CRLF + "a=rtpmap:0 PCMU/8000" + m_CRLF + "a=rtpmap:101 telephone-event/8000" + m_CRLF + "a=fmtp:101 0-15" + m_CRLF + "a=sendrecv" + m_CRLF + "a=ptime:20" + m_CRLF; SIPMessageBuffer sipMessageBuffer = SIPMessageBuffer.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null); SIPResponse okResp = SIPResponse.ParseSIPResponse(sipMessageBuffer); Assert.True(okResp.Header.RecordRoutes.Length == 2, "The wrong number of Record-Route headers were present in the parsed response."); Assert.True(okResp.Header.RecordRoutes.PopRoute().ToString() == "<sip:77.75.25.44:5060;lr=on>", "The top Record-Route header was incorrect."); SIPRoute nextRoute = okResp.Header.RecordRoutes.PopRoute(); Assert.True(nextRoute.ToString() == "<sip:77.75.25.45:5060;lr=on;ftag=1014391101>", "The second Record-Route header was incorrect, " + nextRoute.ToString() + "."); logger.LogDebug("-----------------------------------------"); }