Show / Hide Table of Contents

Class SIPRegistrationUserAgent

Inheritance
System.Object
SIPRegistrationUserAgent
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SIPSorcery.SIP.App
Assembly: SIPSorcery.dll
Syntax
public class SIPRegistrationUserAgent

Constructors

| Improve this Doc View Source

SIPRegistrationUserAgent(SIPTransport, SIPEndPoint, SIPURI, String, String, String, String, SIPURI, Int32, String[], Int32, Int32, Int32, Boolean)

Declaration
public SIPRegistrationUserAgent(SIPTransport sipTransport, SIPEndPoint outboundProxy, SIPURI sipAccountAOR, string authUsername, string password, string realm, string registrarHost, SIPURI contactURI, int expiry, string[] customHeaders, int maxRegistrationAttemptTimeout = 60, int registerFailureRetryInterval = 300, int maxRegisterAttempts = 3, bool exitOnUnequivocalFailure = true)
Parameters
Type Name Description
SIPTransport sipTransport
SIPEndPoint outboundProxy
SIPURI sipAccountAOR
System.String authUsername
System.String password
System.String realm
System.String registrarHost
SIPURI contactURI
System.Int32 expiry
System.String[] customHeaders
System.Int32 maxRegistrationAttemptTimeout
System.Int32 registerFailureRetryInterval
System.Int32 maxRegisterAttempts
System.Boolean exitOnUnequivocalFailure
| Improve this Doc View Source

SIPRegistrationUserAgent(SIPTransport, String, String, String, Int32, Int32, Int32, Int32, Boolean, Boolean)

Creates a new SIP registration agent that will attempt to register with a SIP Registrar server. If the registration fails the agent will retry up to a hard coded maximum number of 3 attempts. If successful the agent will periodically refresh the registration based on the Expiry time returned by the server.

Declaration
public SIPRegistrationUserAgent(SIPTransport sipTransport, string username, string password, string server, int expiry, int maxRegistrationAttemptTimeout = 60, int registerFailureRetryInterval = 300, int maxRegisterAttempts = 3, bool exitOnUnequivocalFailure = true, bool sendUsernameInContactHeader = false)
Parameters
Type Name Description
SIPTransport sipTransport

The SIP transport layer to use to send the register request.

System.String username

The username to use if the server requests authorisation.

System.String password

The password to use if the server requests authorisation.

System.String server

The hostname or socket address for the registration server. Can be in a format of hostname:port or ipaddress:port, e.g. sipsorcery.com or 67.222.131.147:5060. The transport can also be specified using a SIP URI parameter, e.g. sip:sipsorcery.com;transport=tcp or sip:sipsorcery.com;transport=tls although in the latter case it would be better to use sips:sipsorcery.com.

System.Int32 expiry

The expiry value to request for the contact. This value can be rejected or overridden by the server.

System.Int32 maxRegistrationAttemptTimeout

The period in seconds to wait for a server response before classifying the registration request as failed.

System.Int32 registerFailureRetryInterval

Number of seconds between consecutive register requests in the event of failures or timeouts.

System.Int32 maxRegisterAttempts

The maximum number of registration attempts that will be made without a failure condition before incurring a temporary failure.

System.Boolean exitOnUnequivocalFailure

If true the agent will exit on failure conditions that most likely require manual intervention. It is recommended to leave this as true.

System.Boolean sendUsernameInContactHeader

If true the request will add the username to the Contact header.

Fields

| Improve this Doc View Source

AdjustRefreshTime

Declaration
public Func<long, int> AdjustRefreshTime
Field Value
Type Description
System.Func<System.Int64, System.Int32>
| Improve this Doc View Source

AdjustRegister

Declaration
public Func<SIPRequest, SIPRequest> AdjustRegister
Field Value
Type Description
System.Func<SIPRequest, SIPRequest>
| Improve this Doc View Source

UserAgent

Declaration
public string UserAgent
Field Value
Type Description
System.String
| Improve this Doc View Source

UserDisplayName

Declaration
public string UserDisplayName
Field Value
Type Description
System.String

Properties

| Improve this Doc View Source

IsRegistered

True if the last registration attempt was successful or false if not.

Declaration
public bool IsRegistered { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

LastRegisterAttemptAt

The last time at which an attempt was made to register this account.

Declaration
public DateTime LastRegisterAttemptAt { get; }
Property Value
Type Description
System.DateTime
| Improve this Doc View Source

OutboundProxy

If set all requests will be sent via the outbound SIP proxy instead of being sent to the SIP registrar server.

Declaration
public SIPEndPoint OutboundProxy { get; set; }
Property Value
Type Description
SIPEndPoint

Methods

| Improve this Doc View Source

OverrideAllowHeader(String)

Allows to override the Allow header value for REGISTER requests

Declaration
public void OverrideAllowHeader(string newAllowHeaderValue)
Parameters
Type Name Description
System.String newAllowHeaderValue

a new Allow header value; if the null is passed then the default Allow header value will be used

Exceptions
Type Condition
System.ApplicationException

if newAllowHeaderValue contains the methods that are not allowed

| Improve this Doc View Source

SetExpiry(Int32)

Allows the registration expiry setting to be adjusted after the instance has been created.

Declaration
public void SetExpiry(int expiry)
Parameters
Type Name Description
System.Int32 expiry

The new expiry value.

| Improve this Doc View Source

Start()

Declaration
public void Start()
| Improve this Doc View Source

Stop(Boolean)

Stops the registration agent.

Declaration
public void Stop(bool sendZeroExpiryRegister = true)
Parameters
Type Name Description
System.Boolean sendZeroExpiryRegister

If true a final registration with a zero expiry will be sent to remove the binding.

Events

| Improve this Doc View Source

RegistrationFailed

Declaration
public event Action<SIPURI, SIPResponse, string> RegistrationFailed
Event Type
Type Description
System.Action<SIPURI, SIPResponse, System.String>
| Improve this Doc View Source

RegistrationRemoved

Declaration
public event Action<SIPURI, SIPResponse> RegistrationRemoved
Event Type
Type Description
System.Action<SIPURI, SIPResponse>
| Improve this Doc View Source

RegistrationSuccessful

Declaration
public event Action<SIPURI, SIPResponse> RegistrationSuccessful
Event Type
Type Description
System.Action<SIPURI, SIPResponse>
| Improve this Doc View Source

RegistrationTemporaryFailure

Declaration
public event Action<SIPURI, SIPResponse, string> RegistrationTemporaryFailure
Event Type
Type Description
System.Action<SIPURI, SIPResponse, System.String>

Extension Methods

JSONWriter.ToJson(Object)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX