本文整理汇总了C#中SIPSorcery.SIP.SIPTransport.CreateNonInviteTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# SIPTransport.CreateNonInviteTransaction方法的具体用法?C# SIPTransport.CreateNonInviteTransaction怎么用?C# SIPTransport.CreateNonInviteTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIPSorcery.SIP.SIPTransport
的用法示例。
在下文中一共展示了SIPTransport.CreateNonInviteTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDialogueId
/*public static string GetDialogueId(string callId, string localTag, string remoteTag)
{
return Crypto.GetSHAHashAsString(callId + localTag + remoteTag);
}
public static string GetDialogueId(SIPHeader sipHeader)
{
return Crypto.GetSHAHashAsString(sipHeader.CallId + sipHeader.To.ToTag + sipHeader.From.FromTag);
}*/
public void Hangup(SIPTransport sipTransport, SIPEndPoint outboundProxy)
{
try
{
SIPEndPoint byeOutboundProxy = null;
if (outboundProxy != null && IPAddress.IsLoopback(outboundProxy.Address))
{
byeOutboundProxy = outboundProxy;
}
else if (!ProxySendFrom.IsNullOrBlank())
{
byeOutboundProxy = new SIPEndPoint(new IPEndPoint(SIPEndPoint.ParseSIPEndPoint(ProxySendFrom).Address, m_defaultSIPPort));
}
else if (outboundProxy != null)
{
byeOutboundProxy = outboundProxy;
}
SIPEndPoint localEndPoint = (byeOutboundProxy != null) ? sipTransport.GetDefaultSIPEndPoint(byeOutboundProxy.Protocol) : sipTransport.GetDefaultSIPEndPoint(GetRemoteTargetProtocol());
SIPRequest byeRequest = GetByeRequest(localEndPoint);
SIPNonInviteTransaction byeTransaction = sipTransport.CreateNonInviteTransaction(byeRequest, null, localEndPoint, byeOutboundProxy);
byeTransaction.SendReliableRequest();
}
catch (Exception excp)
{
logger.Error("Exception SIPDialogue Hangup. " + excp.Message);
throw;
}
}
示例2: Transfer
public void Transfer(SIPTransport sipTransport, SIPURI referTo, Boolean unattended, SIPEndPoint outboundProxy)
{
if (!unattended)
{
throw new NotImplementedException();
}
else
{
TransferMode = SIPDialogueTransferModesEnum.PassThru;
try
{
SIPEndPoint referOutboundProxy = null;
if (outboundProxy != null && IPAddress.IsLoopback(outboundProxy.Address))
{
referOutboundProxy = outboundProxy;
}
else if (!ProxySendFrom.IsNullOrBlank())
{
referOutboundProxy = new SIPEndPoint(new IPEndPoint(SIPEndPoint.ParseSIPEndPoint(ProxySendFrom).Address, m_defaultSIPPort));
}
else if (outboundProxy != null)
{
referOutboundProxy = outboundProxy;
}
SIPEndPoint localEndPoint = (referOutboundProxy != null) ? sipTransport.GetDefaultSIPEndPoint(referOutboundProxy.Protocol) : sipTransport.GetDefaultSIPEndPoint(GetRemoteTargetProtocol());
SIPRequest referRequest = GetReferRequest(localEndPoint, referTo);
SIPNonInviteTransaction referTransaction = sipTransport.CreateNonInviteTransaction(referRequest, null, localEndPoint, referOutboundProxy);
referTransaction.NonInviteTransactionFinalResponseReceived += referTransaction_NonInviteTransactionFinalResponseReceived;
referTransaction.SendReliableRequest();
}
catch (Exception excp)
{
logger.Error("Exception SIPDialogue Transfer. " + excp.Message);
throw;
}
}
}