pub struct InviteOption {
pub caller_display_name: Option<String>,
pub caller_params: Vec<Param>,
pub caller: Uri,
pub callee: Uri,
pub destination: Option<SipAddr>,
pub content_type: Option<String>,
pub offer: Option<Vec<u8>>,
pub contact: Uri,
pub credential: Option<Credential>,
pub headers: Option<Vec<Header>>,
pub support_prack: bool,
pub call_id: Option<String>,
}Expand description
INVITE Request Options
InviteOption contains all the parameters needed to create and send
an INVITE request to establish a SIP session. This structure provides
a convenient way to specify all the necessary information for initiating
a call or session.
§Fields
caller- URI of the calling party (From header)callee- URI of the called party (To header and Request-URI)content_type- MIME type of the message body (default: “application/sdp”)offer- Optional message body (typically SDP offer)contact- Contact URI for this user agentcredential- Optional authentication credentialsheaders- Optional additional headers to include
§Examples
§Basic Voice Call
let invite_option = InviteOption {
caller: "sip:alice@example.com".try_into()?,
callee: "sip:bob@example.com".try_into()?,
content_type: Some("application/sdp".to_string()),
offer: Some(sdp_offer_bytes),
contact: "sip:alice@192.168.1.100:5060".try_into()?,
..Default::default()
};let request = dialog_layer.make_invite_request(&invite_option)?;
println!("Created INVITE to: {}", request.uri);§Call with Custom Headers
let custom_headers = vec![
rsip::Header::UserAgent("MyApp/1.0".into()),
rsip::Header::Subject("Important Call".into()),
];
let invite_option = InviteOption {
caller: "sip:alice@example.com".try_into()?,
callee: "sip:bob@example.com".try_into()?,
content_type: Some("application/sdp".to_string()),
offer: Some(sdp_bytes),
contact: "sip:alice@192.168.1.100:5060".try_into()?,
credential: Some(auth_credential),
headers: Some(custom_headers),
..Default::default()
};§Call with Authentication
let credential = Credential {
username: "alice".to_string(),
password: "secret123".to_string(),
realm: Some("example.com".to_string()),
};
let invite_option = InviteOption {
caller: "sip:alice@example.com".try_into()?,
callee: "sip:bob@example.com".try_into()?,
offer: Some(sdp_bytes),
contact: "sip:alice@192.168.1.100:5060".try_into()?,
credential: Some(credential),
..Default::default()
};Fields§
§caller_display_name: Option<String>§caller_params: Vec<Param>§caller: Uri§callee: Uri§destination: Option<SipAddr>§content_type: Option<String>§offer: Option<Vec<u8>>§contact: Uri§credential: Option<Credential>§headers: Option<Vec<Header>>§support_prack: bool§call_id: Option<String>Trait Implementations§
Source§impl Clone for InviteOption
impl Clone for InviteOption
Source§fn clone(&self) -> InviteOption
fn clone(&self) -> InviteOption
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for InviteOption
impl Default for InviteOption
Source§fn default() -> InviteOption
fn default() -> InviteOption
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InviteOption
impl RefUnwindSafe for InviteOption
impl Send for InviteOption
impl Sync for InviteOption
impl Unpin for InviteOption
impl UnwindSafe for InviteOption
Blanket Implementations§
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
Mutably borrows from an owned value. Read more