Class SIPRegistrationUserAgent
Inheritance
Inherited Members
Namespace: SIPSorcery.SIP.App
Assembly: SIPSorcery.dll
Syntax
public class SIPRegistrationUserAgent
Constructors
| Improve this Doc View SourceSIPRegistrationUserAgent(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 |
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 SourceAdjustRefreshTime
Declaration
public Func<long, int> AdjustRefreshTime
Field Value
| Type | Description |
|---|---|
| System.Func<System.Int64, System.Int32> |
AdjustRegister
Declaration
public Func<SIPRequest, SIPRequest> AdjustRegister
Field Value
| Type | Description |
|---|---|
| System.Func<SIPRequest, SIPRequest> |
UserAgent
Declaration
public string UserAgent
Field Value
| Type | Description |
|---|---|
| System.String |
UserDisplayName
Declaration
public string UserDisplayName
Field Value
| Type | Description |
|---|---|
| System.String |
Properties
| Improve this Doc View SourceIsRegistered
True if the last registration attempt was successful or false if not.
Declaration
public bool IsRegistered { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
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 |
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 SourceOverrideAllowHeader(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 |
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. |
Start()
Declaration
public void Start()
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 SourceRegistrationFailed
Declaration
public event Action<SIPURI, SIPResponse, string> RegistrationFailed
Event Type
| Type | Description |
|---|---|
| System.Action<SIPURI, SIPResponse, System.String> |
RegistrationRemoved
Declaration
public event Action<SIPURI, SIPResponse> RegistrationRemoved
Event Type
| Type | Description |
|---|---|
| System.Action<SIPURI, SIPResponse> |
RegistrationSuccessful
Declaration
public event Action<SIPURI, SIPResponse> RegistrationSuccessful
Event Type
| Type | Description |
|---|---|
| System.Action<SIPURI, SIPResponse> |
RegistrationTemporaryFailure
Declaration
public event Action<SIPURI, SIPResponse, string> RegistrationTemporaryFailure
Event Type
| Type | Description |
|---|---|
| System.Action<SIPURI, SIPResponse, System.String> |