pub struct RegistrationConfig {
pub server_uri: String,
pub from_uri: String,
pub contact_uri: String,
pub expires: u32,
pub username: Option<String>,
pub password: Option<String>,
pub realm: Option<String>,
}Expand description
Registration configuration for SIP server registration
Contains all necessary parameters to register with a SIP registrar server, including server details, user identity, authentication credentials, and registration timing parameters.
§Examples
use rvoip_client_core::registration::RegistrationConfig;
let config = RegistrationConfig::new(
"sip:registrar.example.com".to_string(),
"sip:alice@example.com".to_string(),
"sip:alice@192.168.1.100:5060".to_string(),
)
.with_credentials("alice".to_string(), "password123".to_string())
.with_expires(1800);
assert_eq!(config.server_uri, "sip:registrar.example.com");
assert_eq!(config.username, Some("alice".to_string()));
assert_eq!(config.expires, 1800);Fields§
§server_uri: StringSIP registrar server URI (e.g., “sip:registrar.example.com”)
The URI of the SIP registrar server where this client will register. This should include the scheme (sip: or sips:) and may include port.
from_uri: StringFrom URI representing the user identity (e.g., “sip:alice@example.com”)
The SIP address that identifies this user. This appears in the From header of REGISTER requests and represents the user’s public identity.
contact_uri: StringContact URI for this client (e.g., “sip:alice@192.168.1.100:5060”)
The SIP URI where this client can be reached for incoming calls. Typically includes the client’s current IP address and port.
expires: u32Registration expiration time in seconds
How long the registration should remain valid. The client will automatically refresh the registration before this time expires. Common values: 3600 (1 hour), 1800 (30 minutes), 300 (5 minutes).
username: Option<String>Authentication username (optional)
Username for SIP digest authentication. Required if the registrar server requires authentication (most production servers do).
password: Option<String>Authentication password (optional)
Password for SIP digest authentication. Should be kept secure and not logged or displayed in plain text.
realm: Option<String>Authentication realm (optional)
Authentication realm provided by the server. Often the same as the domain portion of the server URI. Usually provided by the server in authentication challenges.
Implementations§
Source§impl RegistrationConfig
impl RegistrationConfig
Sourcepub fn new(server_uri: String, from_uri: String, contact_uri: String) -> Self
pub fn new(server_uri: String, from_uri: String, contact_uri: String) -> Self
Create a new registration configuration with default settings
Creates a basic registration configuration with a default expiration of 3600 seconds (1 hour) and no authentication credentials.
§Arguments
server_uri- URI of the SIP registrar serverfrom_uri- SIP URI representing the user identitycontact_uri- SIP URI where this client can be reached
§Examples
use rvoip_client_core::registration::RegistrationConfig;
let config = RegistrationConfig::new(
"sip:registrar.example.com".to_string(),
"sip:alice@example.com".to_string(),
"sip:alice@192.168.1.100:5060".to_string(),
);
assert_eq!(config.expires, 3600); // Default 1 hour
assert_eq!(config.username, None); // No auth by defaultSourcepub fn with_credentials(self, username: String, password: String) -> Self
pub fn with_credentials(self, username: String, password: String) -> Self
Set authentication credentials for the registration
Configures username and password for SIP digest authentication. Most production SIP servers require authentication.
§Arguments
username- Authentication usernamepassword- Authentication password
§Examples
use rvoip_client_core::registration::RegistrationConfig;
let config = RegistrationConfig::new(
"sip:registrar.example.com".to_string(),
"sip:alice@example.com".to_string(),
"sip:alice@192.168.1.100:5060".to_string(),
)
.with_credentials("alice".to_string(), "secret123".to_string());
assert_eq!(config.username, Some("alice".to_string()));
assert_eq!(config.password, Some("secret123".to_string()));Sourcepub fn with_realm(self, realm: String) -> Self
pub fn with_realm(self, realm: String) -> Self
Set the authentication realm for the registration
The realm is usually provided by the server during authentication challenges, but can be set in advance if known.
§Arguments
realm- Authentication realm (often the server domain)
§Examples
use rvoip_client_core::registration::RegistrationConfig;
let config = RegistrationConfig::new(
"sip:registrar.example.com".to_string(),
"sip:alice@example.com".to_string(),
"sip:alice@192.168.1.100:5060".to_string(),
)
.with_realm("example.com".to_string());
assert_eq!(config.realm, Some("example.com".to_string()));Sourcepub fn with_expires(self, expires: u32) -> Self
pub fn with_expires(self, expires: u32) -> Self
Set the registration expiration time
Controls how long the registration remains valid before requiring a refresh. Shorter times provide faster failover detection but increase network traffic.
§Arguments
expires- Expiration time in seconds
§Examples
use rvoip_client_core::registration::RegistrationConfig;
let config = RegistrationConfig::new(
"sip:registrar.example.com".to_string(),
"sip:alice@example.com".to_string(),
"sip:alice@192.168.1.100:5060".to_string(),
)
.with_expires(1800); // 30 minutes
assert_eq!(config.expires, 1800);Trait Implementations§
Source§impl Clone for RegistrationConfig
impl Clone for RegistrationConfig
Source§fn clone(&self) -> RegistrationConfig
fn clone(&self) -> RegistrationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegistrationConfig
impl Debug for RegistrationConfig
Source§impl<'de> Deserialize<'de> for RegistrationConfig
impl<'de> Deserialize<'de> for RegistrationConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RegistrationConfig
impl RefUnwindSafe for RegistrationConfig
impl Send for RegistrationConfig
impl Sync for RegistrationConfig
impl Unpin for RegistrationConfig
impl UnwindSafe for RegistrationConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> SipJson for Twhere
T: Serialize + DeserializeOwned,
impl<T> SipJson for Twhere
T: Serialize + DeserializeOwned,
Source§fn to_sip_value(&self) -> Result<SipValue, SipJsonError>
fn to_sip_value(&self) -> Result<SipValue, SipJsonError>
Source§fn from_sip_value(value: &SipValue) -> Result<T, SipJsonError>
fn from_sip_value(value: &SipValue) -> Result<T, SipJsonError>
Source§impl<T> SipJsonExt for T
impl<T> SipJsonExt for T
Source§fn path(&self, path: impl AsRef<str>) -> Option<SipValue>
fn path(&self, path: impl AsRef<str>) -> Option<SipValue>
Simple path accessor that returns an Option directly
Source§fn path_str(&self, path: impl AsRef<str>) -> Option<String>
fn path_str(&self, path: impl AsRef<str>) -> Option<String>
Get a string value at the given path
Source§fn path_str_or(&self, path: impl AsRef<str>, default: &str) -> String
fn path_str_or(&self, path: impl AsRef<str>, default: &str) -> String
Get a string value at the given path, or return the default value if not found