本文整理汇总了C#中SIPSorcery.SIP.SIPURI类的典型用法代码示例。如果您正苦于以下问题:C# SIPURI类的具体用法?C# SIPURI怎么用?C# SIPURI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SIPURI类属于SIPSorcery.SIP命名空间,在下文中一共展示了SIPURI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SIPEndPoint
public SIPEndPoint(SIPURI sipURI)
{
Protocol = sipURI.Protocol;
IPEndPoint endPoint = IPSocket.ParseSocketString(sipURI.Host);
Address = endPoint.Address;
Port = endPoint.Port;
}
示例2: SIPUserField
public SIPUserField(string name, SIPURI uri, string paramsAndHeaders)
{
Name = name;
URI = uri;
Parameters = new SIPParameters(paramsAndHeaders, PARAM_TAG_DELIMITER);
}
示例3: SIPEndPoint
public SIPEndPoint(SIPURI sipURI)
{
Protocol = sipURI.Protocol;
IPEndPoint endPoint = IPSocket.ParseSocketString(sipURI.Host);
Address = endPoint.Address;
Port = (endPoint.Port == 0) ? (Protocol == SIPProtocolsEnum.tls) ? m_defaultSIPTLSPort : m_defaultSIPPort : endPoint.Port;
}
示例4: SIPEventDialogParticipant
public SIPEventDialogParticipant(string displayName, SIPURI uri, SIPURI targetURI, int cseq)
{
DisplayName = displayName;
URI = uri;
TargetURI = targetURI;
CSeq = cseq;
}
示例5: SIPEventPresenceTuple
public SIPEventPresenceTuple(string id, SIPEventPresenceStateEnum status, SIPURI contactURI, decimal contactPriority)
{
ID = id;
Status = status;
ContactURI = contactURI;
ContactPriority = contactPriority;
}
示例6: SetProviderFields
public void SetProviderFields(SIPProvider sipProvider)
{
ProviderID = sipProvider.ID;
Owner = sipProvider.Owner;
AdminMemberID = sipProvider.AdminMemberID;
ProviderName = sipProvider.ProviderName;
ProviderAuthUsername = (!sipProvider.ProviderAuthUsername.IsNullOrBlank()) ? sipProvider.ProviderAuthUsername : sipProvider.ProviderUsername;
ProviderPassword = sipProvider.ProviderPassword;
RegistrarServer = sipProvider.GetRegistrar();
RegistrarRealm = (!sipProvider.RegisterRealm.IsNullOrBlank()) ? sipProvider.RegisterRealm : RegistrarServer.Host;
ProviderOutboundProxy = sipProvider.ProviderOutboundProxy;
if (sipProvider.RegisterEnabled)
{
BindingExpiry = (sipProvider.RegisterExpiry.HasValue) ? sipProvider.RegisterExpiry.Value : 0;
}
else
{
BindingExpiry = 0;
}
string bindingId = null;
SIPURI binding = (!BindingURI.IsNullOrBlank()) ? SIPURI.ParseSIPURIRelaxed(BindingURI) : null;
if (binding != null && binding.Parameters.Has(REGAGENT_CONTACT_ID_KEY))
{
bindingId = binding.Parameters.Get(REGAGENT_CONTACT_ID_KEY);
}
if (!sipProvider.RegisterContact.IsNullOrBlank())
{
binding = SIPURI.ParseSIPURI(sipProvider.RegisterContact);
if (!bindingId.IsNullOrBlank())
{
binding.Parameters.Set(REGAGENT_CONTACT_ID_KEY, bindingId);
}
if (binding != null)
{
BindingURI = binding.ToString();
}
else
{
BindingURI = null;
BindingExpiry = 0;
}
}
else
{
// The register contact field on the SIP Provider is empty.
// This condition needs to be trearted as the binding being disabled and it needs to be removed.
BindingExpiry = 0;
}
}
示例7: SIPParameterlessURI
public SIPParameterlessURI(SIPURI sipURI)
{
m_uri = sipURI;
}
示例8: SIPToHeader
public SIPToHeader(string toName, SIPURI toURI, string toTag)
{
m_userField = new SIPUserField(toName, toURI, null);
ToTag = toTag;
}
示例9: SIPRoute
public SIPRoute(SIPURI uri, bool looseRouter)
{
m_userField = new SIPUserField();
m_userField.URI = uri;
this.IsStrictRouter = !looseRouter;
}
示例10: CreateSIPContactList
public static List<SIPContactHeader> CreateSIPContactList(SIPURI sipURI)
{
List<SIPContactHeader> contactHeaderList = new List<SIPContactHeader>();
contactHeaderList.Add(new SIPContactHeader(null, sipURI));
return contactHeaderList;
}
示例11: GetRequest
public SIPRequest GetRequest(SIPMethodsEnum method, SIPURI uri, SIPToHeader to, SIPEndPoint localSIPEndPoint)
{
if (localSIPEndPoint == null)
{
localSIPEndPoint = GetDefaultSIPEndPoint();
}
SIPRequest request = new SIPRequest(method, uri);
request.LocalSIPEndPoint = localSIPEndPoint;
SIPContactHeader contactHeader = new SIPContactHeader(null, new SIPURI(SIPSchemesEnum.sip, localSIPEndPoint));
SIPFromHeader fromHeader = new SIPFromHeader(null, contactHeader.ContactURI, CallProperties.CreateNewTag());
SIPHeader header = new SIPHeader(contactHeader, fromHeader, to, 1, CallProperties.CreateNewCallId());
request.Header = header;
header.CSeqMethod = method;
header.Allow = ALLOWED_SIP_METHODS;
SIPViaHeader viaHeader = new SIPViaHeader(localSIPEndPoint, CallProperties.CreateBranchId());
header.Vias.PushViaHeader(viaHeader);
return request;
}
示例12: SIPMonitorFilter
//.........这里部分代码省略.........
}
}
else if (filterName == MACHINE_EVENTTYPE_FILTER_KEY)
{
if (!filterValue.IsNullOrBlank())
{
MachineEventTypeIds = new List<int>();
string[] ids = filterValue.Split(',');
foreach (string id in ids)
{
int eventId = 0;
if (Int32.TryParse(id, out eventId))
{
MachineEventTypeIds.Add(eventId);
}
}
}
}
else if (filterName == SERVERADDRESS_FILTER_KEY)
{
ServerIPAddress = filterValue;
}
else if (filterName == IPADDRESS_FILTER_KEY || filterName == IPADDRESSLONG_FILTER_KEY)
{
IPAddress = filterValue;
}
else if (filterName == USERNAME_FILTER_KEY)
{
Username = filterValue;
}
else if (filterName == SIPREQUEST_FILTER_KEY)
{
SIPRequestFilter = filterValue;
}
else if (filterName == SERVERTYPE_FILTER_KEY)
{
if (filterValue != null && Regex.Match(filterValue, @"\d{1,2}").Success)
{
ServerTypeId = Convert.ToInt32(filterValue);
// Help the user out and set a wildcard type on the event if none has been selected.
if (EventFilterDescr == null && EventTypeId == 0)
{
EventFilterDescr = WILDCARD;
}
}
}
else if (filterName == FILELOG_REQUEST_KEY)
{
if (filterValue != null)
{
FileLogname = filterValue;
}
}
else if (filterName == FILELOG_MINUTESDURATION_KEY)
{
if (filterValue != null && Regex.Match(filterValue, @"\d").Success)
{
FileLogDuration = Convert.ToInt32(filterValue);
if (FileLogDuration > MAX_FILEDURATION_MINUTES)
{
FileLogDuration = MAX_FILEDURATION_MINUTES;
}
}
}
else if (filterName == REGEX_FILTER_KEY)
{
if (filterValue != null)
{
RegexFilter = filterValue;
}
}
else if (filterName == SIPEVENT_DIALOG_KEY)
{
BaseType = MACHINE_BASE_TYPE;
SIPEventDialogURI = SIPURI.ParseSIPURI(filterValue);
}
else if (filterName == SIPEVENT_PRESENCE_KEY)
{
BaseType = MACHINE_BASE_TYPE;
SIPEventPresenceURI = SIPURI.ParseSIPURI(filterValue);
}
else
{
throw new ApplicationException("Filter " + filterName + " was not recognised.");
}
}
else
{
throw new ApplicationException("Invalid item in filter: " + filterItem.Trim() + ".");
}
}
}
else
{
throw new ApplicationException("Invalid filter format: " + filter + ".");
}
}
}
示例13: BlindTransfer
/// <summary>
/// Processes an in dialogue REFER request that specifies a new destination for an existing call leg.
/// </summary>
/// <param name="username">The username of the user the transfer is being processed for.</param>
/// <param name="referTo">The Refer-To header URI from the REFER request.</param>
/// <param name="dialplanName">The dialplan to use to process the transfer.</param>
/// <param name="replacesCallID">The call ID that is being replaced by the new dialogue if one is created.</param>
/// <returns>A SIP server user agent.</returns>
public ISIPServerUserAgent BlindTransfer(string username, SIPURI referTo, string dialplanName, SIPDialogue replacesDialogue)
{
if (dialplanName.IsNullOrBlank())
{
throw new ApplicationException("A dial plan name must be provided when processing a blind transfer.");
}
else if (referTo == null)
{
throw new ApplicationException("The refer to URI cannot be empty when processing a blind transfer.");
}
else if (replacesDialogue == null)
{
throw new ApplicationException("The blind transfer could not be initiated, the dialogue to transfer could not be found.");
}
//bool wasExecutionCountIncremented = false;
Customer customer = null;
SIPDialPlan dialPlan = null;
try
{
customer = m_customerPersistor.Get(c => c.CustomerUsername == username);
if (customer == null)
{
Log_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Blind transfer using dialplan " + dialplanName + " rejected for " + username + " and " + referTo.ToString() + ", as no matching user.", username));
throw new ApplicationException("No matching user was found, the blind transfer was not initiated.");
}
else if (customer.Suspended)
{
Log_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Blind transfer using dialplan " + dialplanName + " rejected for " + username + " and " + referTo.ToString() + ", user account is suspended.", username));
throw new ApplicationException("The user's account is suspended, the blind transfer was not initiated.");
}
else
{
dialPlan = GetDialPlan_External(d => d.Owner == username && d.DialPlanName == dialplanName);
if (dialPlan == null)
{
Log_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Blind transfer rejected as no " + dialplanName + " dialplan exists.", username));
throw new ApplicationException("The blind transfer could not be initiated, no dialplan with name " + dialplanName + " could be found.");
}
else
{
if (!IsDialPlanExecutionAllowed(dialPlan, customer))
{
Log_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Execution of blind transfer for dialplan " + dialplanName + " was not processed as maximum execution count has been reached.", username));
throw new ApplicationException("The blind transfer was not initiated, dial plan execution exceeded maximum allowed");
}
else
{
//IncrementCustomerExecutionCount(customer);
Log_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Blind transfer for dialplan " + dialplanName + " starting for " + referTo.ToString() + ".", username));
SIPDialogue oppositeDialogue = m_sipDialogueManager.GetOppositeDialogue(replacesDialogue);
ISIPServerUserAgent uas = new SIPTransferServerUserAgent(Log_External, m_sipDialogueManager.DialogueTransfer, m_sipTransport, m_outboundProxy, replacesDialogue, oppositeDialogue, referTo.ToString(), customer.CustomerUsername, customer.AdminId);
DialPlanScriptContext scriptContext = new DialPlanScriptContext(
Log_External,
m_sipTransport,
CreateDialogueBridge,
m_outboundProxy,
uas,
dialPlan,
GetSIPProviders_External(p => p.Owner == username, null, 0, Int32.MaxValue),
m_traceDirectory,
null,
customer,
null,
GetCanonicalDomain_External);
//scriptContext.DialPlanComplete += () => { DecrementCustomerExecutionCount(customer); };
m_dialPlanEngine.Execute(scriptContext, uas, SIPCallDirection.Out, CreateDialogueBridge, this);
return uas;
}
}
}
}
catch (ApplicationException)
{
throw;
}
catch (Exception excp)
{
logger.Error("Exception SIPCallManager BlindTransfer. " + excp.Message);
//if (wasExecutionCountIncremented)
//{
//DecrementDialPlanExecutionCount(dialPlan, customer.Id, originalExecutionCount);
//DecrementCustomerExecutionCount(customer);
//}
//.........这里部分代码省略.........
示例14: GetByeRequest
private SIPRequest GetByeRequest(SIPResponse inviteResponse, SIPURI byeURI, SIPEndPoint localSIPEndPoint)
{
SIPRequest byeRequest = new SIPRequest(SIPMethodsEnum.BYE, byeURI);
byeRequest.LocalSIPEndPoint = localSIPEndPoint;
SIPFromHeader byeFromHeader = inviteResponse.Header.From;
SIPToHeader byeToHeader = inviteResponse.Header.To;
int cseq = inviteResponse.Header.CSeq + 1;
SIPHeader byeHeader = new SIPHeader(byeFromHeader, byeToHeader, cseq, inviteResponse.Header.CallId);
byeHeader.CSeqMethod = SIPMethodsEnum.BYE;
byeHeader.ProxySendFrom = m_serverTransaction.TransactionRequest.Header.ProxySendFrom;
byeRequest.Header = byeHeader;
byeRequest.Header.Routes = (inviteResponse.Header.RecordRoutes != null) ? inviteResponse.Header.RecordRoutes.Reversed() : null;
SIPViaHeader viaHeader = new SIPViaHeader(localSIPEndPoint, CallProperties.CreateBranchId());
byeRequest.Header.Vias.PushViaHeader(viaHeader);
return byeRequest;
}
示例15: GetInviteRequest
private SIPRequest GetInviteRequest(SIPDialogue dialogue, SIPEndPoint localSIPEndPoint, string body)
{
SIPRequest inviteRequest = new SIPRequest(SIPMethodsEnum.INVITE, dialogue.RemoteTarget);
SIPHeader inviteHeader = new SIPHeader(SIPFromHeader.ParseFromHeader(dialogue.LocalUserField.ToString()), SIPToHeader.ParseToHeader(dialogue.RemoteUserField.ToString()), dialogue.CSeq, dialogue.CallId);
SIPURI contactURI = new SIPURI(dialogue.RemoteTarget.Scheme, localSIPEndPoint);
inviteHeader.Contact = SIPContactHeader.ParseContactHeader("<" + contactURI.ToString() + ">");
inviteHeader.CSeqMethod = SIPMethodsEnum.INVITE;
inviteRequest.Header = inviteHeader;
inviteRequest.Header.Routes = dialogue.RouteSet;
SIPViaHeader viaHeader = new SIPViaHeader(localSIPEndPoint, CallProperties.CreateBranchId());
inviteRequest.Header.Vias.PushViaHeader(viaHeader);
inviteRequest.Body = body;
inviteRequest.Header.ContentLength = body.Length;
inviteRequest.Header.ContentType = "application/sdp";
return inviteRequest;
}