本文整理汇总了C#中SIPSorcery.SIP.SIPTransport.PreProcessRouteInfo方法的典型用法代码示例。如果您正苦于以下问题:C# SIPTransport.PreProcessRouteInfo方法的具体用法?C# SIPTransport.PreProcessRouteInfo怎么用?C# SIPTransport.PreProcessRouteInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIPSorcery.SIP.SIPTransport
的用法示例。
在下文中一共展示了SIPTransport.PreProcessRouteInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StrictRoutePriorToProxyUnitTest
public void StrictRoutePriorToProxyUnitTest()
{
Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
string sipMsg =
"INVITE sip:82.195.148.216:5062;lr SIP/2.0" + m_CRLF +
"Via: SIP/2.0/UDP 192.168.1.2:5065;rport;branch=z9hG4bKFBB7EAC06934405182D13950BD51F001" + m_CRLF +
"Route: <sip:89.100.92.186:45270;lr>,<sip:[email protected]>" + m_CRLF +
"From: SER Test X <sip:[email protected]:5065>;tag=196468136" + m_CRLF +
"To: <sip:[email protected]>" + m_CRLF +
"Contact: <sip:[email protected]:5065>" + m_CRLF +
"Call-ID: [email protected]" + m_CRLF +
"CSeq: 49429 INVITE" + m_CRLF +
"Max-Forwards: 70" + m_CRLF +
"Content-Type: application/sdp" + m_CRLF +
"User-Agent: X-PRO release 1103v" + m_CRLF +
m_CRLF;
SIPMessage sipMessage = SIPMessage.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null);
SIPRequest inviteReq = SIPRequest.ParseSIPRequest(sipMessage);
SIPTransport mockSIPTransport = new SIPTransport(MockSIPDNSManager.Resolve, null, false);
mockSIPTransport.AddSIPChannel(new MockSIPChannel(IPSocket.ParseSocketString("82.195.148.216:5062")));
mockSIPTransport.PreProcessRouteInfo(inviteReq);
Console.WriteLine(inviteReq.ToString());
Console.WriteLine("Next Route=" + inviteReq.Header.Routes.TopRoute.ToString());
Console.WriteLine("Request URI=" + inviteReq.URI.ToString());
Assert.IsTrue(inviteReq.Header.Routes.TopRoute.ToString() == "<sip:89.100.92.186:45270;lr>", "Top route was not correct.");
Assert.IsTrue(inviteReq.URI.ToString() == "sip:[email protected]", "The request URI was incorrectly adjusted.");
Assert.IsTrue(inviteReq.Header.Routes.Length == 1, "The route set was not correct.");
}
示例2: AvayaInviteUnitTest
public void AvayaInviteUnitTest()
{
Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
string sipMsg =
"INVITE sip:194.213.29.100:5060 SIP/2.0" + m_CRLF +
"Via: SIP/2.0/UDP 10.1.1.241;branch=z9hG4bK94fc63626" + m_CRLF +
"To: UNKNOWN <sip:[email protected]>" + m_CRLF +
"From: 'Joe Bloggs' <sip:[email protected]>;tag=cc16d34c122e5fe" + m_CRLF +
"Call-ID: [email protected]" + m_CRLF +
"CSeq: 2009546910 INVITE" + m_CRLF +
"Contact: 'Val Gavin' <sip:[email protected]>" + m_CRLF +
"Max-Forwards: 70" + m_CRLF +
"Route: <sip:[email protected]>" + m_CRLF + // Strict Route header (this header is actually a fault but it ends up being a strict route).
"User-Agent: NeuralX MxSF/v3.2.6.26" + m_CRLF +
"Content-Type: application/sdp" + m_CRLF +
"Content-Length: 318" + m_CRLF +
"P-Asserted-Identity: 'Joe Bloggs' <sip:[email protected]>" + m_CRLF +
"Allow: INVITE" + m_CRLF +
"Allow: CANCEL" + m_CRLF +
"Allow: OPTIONS" + m_CRLF +
"Allow: BYE" + m_CRLF +
"Allow: REFER" + m_CRLF +
"Allow: INFO" + m_CRLF +
"Allow: UPDATE" + m_CRLF +
"Supported: replaces" + m_CRLF +
m_CRLF +
"v=0" + m_CRLF +
"o=xxxxx 1174909600 1174909601 IN IP4 10.1.1.241" + m_CRLF +
"s=-" + m_CRLF +
"c=IN IP4 10.1.1.241" + m_CRLF +
"t=0 0" + m_CRLF +
"a=sendrecv" + m_CRLF +
"m=audio 20026 RTP/AVP 8 0 18 101" + m_CRLF +
"a=rtpmap:8 PCMA/8000" + m_CRLF +
"a=rtpmap:0 PCMU/8000" + m_CRLF +
"a=rtpmap:18 G729/8000" + m_CRLF +
"a=rtpmap:101 telephone-event/8000" + m_CRLF +
"a=fmtp:18 annexb=no" + m_CRLF +
"a=fmtp:101 0-15" + m_CRLF +
"a=ptime:20" + m_CRLF +
"a=rtcp:20027 IN IP4 10.1.1.241";
SIPMessage sipMessage = SIPMessage.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null);
SIPRequest inviteReq = SIPRequest.ParseSIPRequest(sipMessage);
SIPTransport mockSIPTransport = new SIPTransport(MockSIPDNSManager.Resolve, null, false);
mockSIPTransport.AddSIPChannel(new MockSIPChannel(IPSocket.ParseSocketString("194.213.29.100:5060")));
mockSIPTransport.PreProcessRouteInfo(inviteReq);
Console.WriteLine(inviteReq.ToString());
Assert.IsTrue(inviteReq.URI.ToString() == "sip:[email protected]", "The request URI was not updated to the strict route.");
Assert.IsTrue(inviteReq.Header.Routes.TopRoute.URI.ToString() == "sip:194.213.29.100:5060", "The route set was not correctly updated.");
Console.WriteLine("-----------------------------------------");
}