本文整理汇总了C#中SIPSorcery.SIP.SIPTransport.CreateUACTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# SIPTransport.CreateUACTransaction方法的具体用法?C# SIPTransport.CreateUACTransaction怎么用?C# SIPTransport.CreateUACTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIPSorcery.SIP.SIPTransport
的用法示例。
在下文中一共展示了SIPTransport.CreateUACTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: B2BInviteTransactionUserFoundStatefulProxyTest
public void B2BInviteTransactionUserFoundStatefulProxyTest()
{
SIPTransactionEngine transactionEngine1 = new SIPTransactionEngine();
SIPTransport sipTransport1 = new SIPTransport(SIPDNSManager.Resolve, transactionEngine1, true, false);
IPEndPoint sipTransport1EndPoint = new IPEndPoint(IPAddress.Loopback, 3000);
sipTransport1.AddSIPChannel(new SIPUDPChannel(sipTransport1EndPoint));
SIPAppServerCore statefulProxyCore1 = new SIPAppServerCore(sipTransport1, null, statefulProxyCore1_StatefulProxyLogEvent, null, null, null);
SIPTransactionEngine transactionEngine2 = new SIPTransactionEngine();
SIPTransport sipTransport2 = new SIPTransport(SIPDNSManager.Resolve, transactionEngine2, true, false);
IPEndPoint sipTransport2EndPoint = new IPEndPoint(IPAddress.Loopback, 3001);
sipTransport2.AddSIPChannel(new SIPUDPChannel(sipTransport2EndPoint));
SIPAppServerCore statefulProxyCore2 = new SIPAppServerCore(
sipTransport2,
statefulProxyCore2_GetCanonicalDomain,
statefulProxyCore2_StatefulProxyLogEvent,
null,
null,
null);
//statefulProxyCore2.GetExtensionOwner += new GetExtensionOwnerDelegate(statefulProxyCore2_GetExtensionOwner);
sipTransport1.SIPRequestOutTraceEvent += sipTransport1_SIPRequestOutTraceEvent;
sipTransport1.SIPResponseInTraceEvent += sipTransport1_SIPResponseInTraceEvent;
sipTransport2.SIPRequestInTraceEvent += sipTransport2_SIPRequestInTraceEvent;
sipTransport2.SIPResponseOutTraceEvent += sipTransport2_SIPResponseOutTraceEvent;
//statefulProxyCore2.LoadDialPlan += new LoadDialPlanDelegate(statefulProxyCore2_LoadDialPlan);
SIPRequest inviteRequest = GetInviteRequest(sipTransport1EndPoint, null, sipTransport2EndPoint);
UACInviteTransaction uacInvite = sipTransport1.CreateUACTransaction(inviteRequest, new SIPEndPoint(SIPProtocolsEnum.udp, sipTransport2EndPoint), new SIPEndPoint(SIPProtocolsEnum.udp, sipTransport1EndPoint), null);
uacInvite.SendInviteRequest(new SIPEndPoint(SIPProtocolsEnum.udp, sipTransport2EndPoint), inviteRequest);
Thread.Sleep(1000);
// Check the NUnit Console.Out to make sure there are SIP requests and responses being displayed.
sipTransport1.Shutdown();
sipTransport2.Shutdown();
}
示例2: CreateTransactionUnitTest
public void CreateTransactionUnitTest()
{
Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name);
string sipRequestStr =
"INVITE sip:[email protected];switchtag=902888 SIP/2.0" + m_CRLF +
"Record-Route: <sip:2.3.4.5;ftag=9307C640-33C;lr=on>" + m_CRLF +
"Via: SIP/2.0/UDP 5.6.7.2:5060" + m_CRLF +
"Via: SIP/2.0/UDP 1.2.3.4;branch=z9hG4bKa7ac.2bfad091.0" + m_CRLF +
"From: \"unknown\" <sip:00.000.00.0>;tag=9307C640-33C" + m_CRLF +
"To: <sip:[email protected]>" + m_CRLF +
"Date: Thu, 21 Feb 2008 01:46:30 GMT" + m_CRLF +
"Call-ID: A8706191-DF5511DC-B886ED7B-395C3F7E" + m_CRLF +
"Supported: timer,100rel" + m_CRLF +
"Min-SE: 1800" + m_CRLF +
"Cisco-Guid: 2825897321-3746894300-3095653755-962346878" + m_CRLF +
"User-Agent: Cisco-SIPGateway/IOS-12.x" + m_CRLF +
"Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO" + m_CRLF +
"CSeq: 101 INVITE" + m_CRLF +
"Max-Forwards: 5" + m_CRLF +
"Timestamp: 1203558390" + m_CRLF +
"Contact: <sip:1.2.3.4:5060>" + m_CRLF +
"Expires: 180" + m_CRLF +
"Allow-Events: telephone-event" + m_CRLF +
"Content-Type: application/sdp" + m_CRLF +
"Content-Length: 370" + m_CRLF +
m_CRLF +
"v=0" + m_CRLF +
"o=CiscoSystemsSIP-GW-UserAgent 9312 7567 IN IP4 00.00.00.0" + m_CRLF +
"s=SIP Call" + m_CRLF +
"c=IN IP4 00.000.00.0" + m_CRLF +
"t=0 0" + m_CRLF +
"m=audio 16434 RTP/AVP 8 0 4 18 3 101" + m_CRLF +
"c=IN IP4 00.000.00.0" + m_CRLF +
"a=rtpmap:8 PCMA/8000" + m_CRLF +
"a=rtpmap:0 PCMU/8000" + m_CRLF +
"a=rtpmap:4 G723/8000" + m_CRLF +
"a=fmtp:4 annexa=no" + m_CRLF +
"a=rtpmap:18 G729/8000" + m_CRLF +
"a=fmtp:18 annexb=no" + m_CRLF +
"a=rtpmap:3 GSM/8000" + m_CRLF +
"a=rtpmap:101 telepho";
SIPRequest request = SIPRequest.ParseSIPRequest(sipRequestStr);
SIPTransactionEngine transactionEngine = new SIPTransactionEngine();
SIPTransport sipTransport = new SIPTransport(MockSIPDNSManager.Resolve, transactionEngine);
SIPEndPoint dummySIPEndPoint = new SIPEndPoint(new IPEndPoint(IPAddress.Loopback, 1234));
SIPTransaction transaction = sipTransport.CreateUACTransaction(request, dummySIPEndPoint, dummySIPEndPoint, null);
Assert.IsTrue(transaction.TransactionRequest.URI.ToString() == "sip:[email protected];switchtag=902888", "Transaction request URI was incorrect.");
}