Struct SimpleRequestBuilder

Source
pub struct SimpleRequestBuilder { /* private fields */ }
Expand description

§SIP Request Builder

The SimpleRequestBuilder provides a streamlined approach to creating SIP request messages as defined in RFC 3261.

§SIP Request Overview

SIP (Session Initiation Protocol) requests are messages sent by clients to servers to initiate actions or transactions. Each request contains a method indicating the desired action, a Request-URI identifying the resource, and various headers providing additional information.

A typical SIP request looks like:

INVITE sip:bob@example.com SIP/2.0
Via: SIP/2.0/UDP alice.example.com:5060;branch=z9hG4bK776asdhds
Max-Forwards: 70
To: Bob <sip:bob@example.com>
From: Alice <sip:alice@example.com>;tag=1928301774
Call-ID: a84b4c76e66710
CSeq: 314159 INVITE
Contact: <sip:alice@192.168.1.2:5060>
Content-Type: application/sdp
Content-Length: 142

[SDP message body]

§Common SIP Methods

SIP defines several methods for different purposes:

  • INVITE: Initiates a session (call) between endpoints
  • ACK: Acknowledges receipt of a final response to an INVITE
  • BYE: Terminates an established session
  • CANCEL: Cancels a pending INVITE transaction
  • REGISTER: Registers contact information with a SIP server
  • OPTIONS: Queries a server about its capabilities
  • REFER: Asks recipient to issue a request (typically used for transfers)
  • SUBSCRIBE: Requests notification of an event
  • NOTIFY: Sends a notification of an event
  • MESSAGE: Sends an instant message (RFC 3428)

§Key SIP Request Headers

  • Via: Indicates the transport path taken by the request so far
  • Max-Forwards: Limits the number of hops a request can make
  • From: Identifies the logical initiator of the request
  • To: Identifies the logical recipient of the request
  • Call-ID: Unique identifier for this call or registration
  • CSeq: Sequence number and method for ordering requests
  • Contact: Direct URI at which the sender can be reached
  • Content-Type/Content-Length: Describes the message body, if present

§SIP Dialog Context

Many SIP requests operate within the context of a dialog - a peer-to-peer relationship between two SIP endpoints. Dialogs are established by certain transactions (like INVITE) and provide context for subsequent requests.

Dialog identification requires:

  • Call-ID value
  • Local tag (From header tag)
  • Remote tag (To header tag)

§Transaction Model

SIP uses a transaction model to group requests and responses:

  • INVITE transactions: Used to establish sessions, includes a three-way handshake
  • Non-INVITE transactions: Used for other methods, with a simpler two-way handshake

§Benefits of Using SimpleRequestBuilder

The SimpleRequestBuilder provides several advantages:

  • Ergonomic API: Fluent interface with method chaining
  • Default Handling: Sets reasonable defaults for many optional fields
  • RFC Compliance: Ensures compliance with SIP standards and conventions
  • Header Management: Properly formats and validates SIP headers
  • Method-Specific Builders: Convenience constructors for common requests
  • Type Safety: Leverages Rust’s type system to prevent invalid messages

The examples below demonstrate how to create various types of SIP requests for common scenarios.

Implementations§

Source§

impl SimpleRequestBuilder

Source

pub fn new(method: Method, uri: &str) -> Result<Self>

Create a new SimpleRequestBuilder with the specified method and URI

This is the main entry point for creating a SIP request builder. The URI must be syntactically valid according to RFC 3261 Section 19.1.1.

§Parameters
  • method: The SIP method (INVITE, REGISTER, etc.)
  • uri: The target URI as a string (e.g., “sip:user@example.com”)
§Returns

A Result containing the SimpleRequestBuilder or an error if the URI is invalid

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

// Create a new INVITE request builder
let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap();

// Invalid URI will return an error
let error_builder = SimpleRequestBuilder::new(Method::Invite, "invalid:uri");
assert!(error_builder.is_err());
Source

pub fn from_request(request: Request) -> Self

Create a builder from an existing Request object

This allows you to modify an existing request by using the builder pattern.

§Parameters
  • request: An existing SIP Request object
§Returns

A SimpleRequestBuilder initialized with the provided request

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::{Method, Uri, Request};
use std::str::FromStr;

let uri = Uri::from_str("sip:bob@example.com").unwrap();
let request = Request::new(Method::Invite, uri);

// Create a builder from the existing request
let builder = SimpleRequestBuilder::from_request(request);
Source

pub fn invite(uri: &str) -> Result<Self>

Create an INVITE request builder

This is a convenience constructor for creating an INVITE request as specified in RFC 3261 Section 13. INVITE requests are used to establish media sessions between user agents.

§Parameters
  • uri: The target URI as a string
§Returns

A Result containing the SimpleRequestBuilder or an error if the URI is invalid

§Examples
§Basic INVITE Request
use rvoip_sip_core::builder::SimpleRequestBuilder;

let builder = SimpleRequestBuilder::invite("sip:bob@example.com").unwrap();
§Complete INVITE Request with SDP Body
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::sdp::SdpBuilder;
use rvoip_sip_core::sdp::attributes::MediaDirection;

// Create SDP for a voice call using the SdpBuilder pattern
let sdp_body = SdpBuilder::new("SIP Voice Call")
    .origin("alice", "2890844526", "2890844526", "IN", "IP4", "192.168.1.2")
    .connection("IN", "IP4", "192.168.1.2")
    .time("0", "0")
    .media_audio(49170, "RTP/AVP")
        .formats(&["0", "8"])
        .rtpmap("0", "PCMU/8000")
        .rtpmap("8", "PCMA/8000")
        .direction(MediaDirection::SendRecv)
        .done()
    .build()
    .expect("Valid SDP");

// Create an INVITE request to establish a call
let invite_request = SimpleRequestBuilder::invite("sip:bob@example.com").unwrap()
    // Add required headers for a dialog
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))
    .to("Bob", "sip:bob@example.com", None)
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")
    .cseq(1)
    // Add routing information
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK776asdhds"))
    .max_forwards(70)
    .contact("sip:alice@192.168.1.2:5060", None)
    // Add SDP information
    .content_type("application/sdp")
    .body(sdp_body.to_string())
    .build();
§INVITE Request with Audio and Video
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::sdp::SdpBuilder;
use rvoip_sip_core::sdp::attributes::MediaDirection;
use rvoip_sip_core::types::TypedHeader;
use rvoip_sip_core::types::supported::Supported;

// Create an SDP with audio and video streams using SdpBuilder
let sdp_body = SdpBuilder::new("Audio/Video Call")
    .origin("alice", "2890844526", "2890844526", "IN", "IP4", "192.168.1.2")
    .connection("IN", "IP4", "192.168.1.2")
    .time("0", "0")
    // Add BUNDLE group to use a single transport for both media
    .group("BUNDLE", &["audio", "video"])
    // Audio stream
    .media_audio(49170, "RTP/AVP")
        .formats(&["0", "101"])
        .rtpmap("0", "PCMU/8000")
        .rtpmap("101", "telephone-event/8000")
        .fmtp("101", "0-16")  // DTMF events
        .direction(MediaDirection::SendRecv)
        .mid("audio")  // Media ID for bundling
        .done()
    // Video stream
    .media_video(49172, "RTP/AVP")
        .formats(&["96", "97"])
        .rtpmap("96", "H264/90000")
        .fmtp("96", "profile-level-id=42e01f;packetization-mode=1")
        .rtpmap("97", "VP8/90000")
        .direction(MediaDirection::SendRecv)
        .mid("video")  // Media ID for bundling
        .done()
    .build()
    .expect("Valid SDP");

// Create a complete INVITE request with audio and video
let invite_with_av = SimpleRequestBuilder::invite("sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))
    .to("Bob", "sip:bob@example.com", None)
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")
    .cseq(1)
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK776asdhds"))
    .max_forwards(70)
    .contact("sip:alice@192.168.1.2:5060", None)
    // Support for required extensions
    .header(TypedHeader::Supported(Supported::new(vec![
        "100rel".to_string(),  // Reliable provisional responses
        "ice".to_string(),     // Interactive Connectivity Establishment
        "replaces".to_string() // Call replacement
    ])))
    // Add SDP body with audio and video
    .content_type("application/sdp")
    .body(sdp_body.to_string())
    .build();
Source

pub fn register(uri: &str) -> Result<Self>

Create a REGISTER request builder

This is a convenience constructor for creating a REGISTER request as specified in RFC 3261 Section 10. REGISTER requests are used to add, remove, and query bindings.

§Parameters
  • uri: The registrar URI as a string
§Returns

A Result containing the SimpleRequestBuilder or an error if the URI is invalid

§Examples
§Basic REGISTER Request
use rvoip_sip_core::builder::SimpleRequestBuilder;

let builder = SimpleRequestBuilder::register("sip:registrar.example.com").unwrap();
§Complete Registration with Expiration Time
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::TypedHeader;
use rvoip_sip_core::types::expires::Expires;
 
// Create a REGISTER request with a 1-hour expiration
let register_request = SimpleRequestBuilder::register("sip:registrar.example.com").unwrap()
    // Add required headers for registration
    .from("Alice", "sip:alice@example.com", Some("reg-tag-1"))
    .to("Alice", "sip:alice@example.com", None) // To header matches From without tag
    .call_id("reg-call-1@192.168.1.2")
    .cseq(1)
    // Add routing information
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK776asdhds"))
    .max_forwards(70)
    // Add registration information
    .contact("sip:alice@192.168.1.2:5060", None)
    .header(TypedHeader::Expires(Expires::new(3600))) // 1 hour registration
    .build();
§Registration Refresh with Authentication
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::TypedHeader;
use rvoip_sip_core::types::expires::Expires;
use rvoip_sip_core::types::auth::{Authorization, AuthScheme};
use rvoip_sip_core::types::uri::Uri;
use std::str::FromStr;

// Create a URI for the authorization header
let reg_uri = Uri::from_str("sip:registrar.example.com").unwrap();
 
// Create an Authorization header with digest authentication
let auth = Authorization::new(
    AuthScheme::Digest,
    "alice",                                    // username
    "example.com",                              // realm
    "dcd98b7102dd2f0e8b11d0f600bfb0c093",      // nonce
    reg_uri,                                    // uri
    "a2ea68c230e5fea1ca715740fb14db97"         // response hash
);

// Create a REGISTER refresh with authentication
let register_refresh = SimpleRequestBuilder::register("sip:registrar.example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("reg-tag-1"))
    .to("Alice", "sip:alice@example.com", None)
    .call_id("reg-call-1@192.168.1.2")
    .cseq(2)  // Increment CSeq for refresh
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK887asdhrt"))
    .max_forwards(70)
    .contact("sip:alice@192.168.1.2:5060", None)
    .header(TypedHeader::Expires(Expires::new(3600)))
    .header(TypedHeader::Authorization(auth))
    .build();
Source

pub fn bye(uri: &str) -> Result<Self>

Create a BYE request builder

This is a convenience constructor for creating a BYE request as specified in RFC 3261 Section 15.1. BYE requests are used to terminate a specific dialog.

§Parameters
  • uri: The target URI as a string
§Returns

A Result containing the SimpleRequestBuilder or an error if the URI is invalid

§Examples
§Basic BYE Request
use rvoip_sip_core::builder::SimpleRequestBuilder;

let builder = SimpleRequestBuilder::bye("sip:bob@example.com").unwrap();
§Complete BYE Request for an Established Dialog
use rvoip_sip_core::builder::SimpleRequestBuilder;

// Create a BYE request to terminate an active dialog
let bye_request = SimpleRequestBuilder::bye("sip:bob@example.com").unwrap()
    // For BYE requests, both From and To tags must be present
    // as they identify the dialog being terminated
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))
    .to("Bob", "sip:bob@example.com", Some("b5qt9xl3"))  // To tag is required for BYE
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")
    .cseq(2)  // CSeq increments throughout the dialog
    // Add routing information
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK887jhgfd"))
    .max_forwards(70)
    .contact("sip:alice@192.168.1.2:5060", None)
    .build();
§BYE Request with Custom Reason Header
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::builder::headers::ReasonBuilderExt;

// Create a BYE request with a reason for termination
let bye_request = SimpleRequestBuilder::bye("sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))
    .to("Bob", "sip:bob@example.com", Some("b5qt9xl3"))
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")
    .cseq(3)
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK99alhkgj"))
    .max_forwards(70)
    .reason("SIP", 487, Some("Client call transfer"))  // Add reason for the termination
    .build();
Source

pub fn options(uri: &str) -> Result<Self>

Create an OPTIONS request builder

This is a convenience constructor for creating an OPTIONS request as specified in RFC 3261 Section 11. OPTIONS requests are used to query the capabilities of a server.

§Parameters
  • uri: The target URI as a string
§Returns

A Result containing the SimpleRequestBuilder or an error if the URI is invalid

§Examples
§Basic OPTIONS Request
use rvoip_sip_core::builder::SimpleRequestBuilder;

let builder = SimpleRequestBuilder::options("sip:bob@example.com").unwrap();
§Complete OPTIONS Request to Query Server Capabilities
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::TypedHeader;
use rvoip_sip_core::types::accept::Accept;

// Create a simple empty Accept header - simplified for doc test
let accept = Accept::new();

// Create an OPTIONS request to query a server's capabilities
let options_request = SimpleRequestBuilder::options("sip:server.example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("opt-tag-1"))
    .to("Server", "sip:server.example.com", None)
    .call_id("options-call-1@192.168.1.2")
    .cseq(1)
    // Add routing information
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK776asdhds"))
    .max_forwards(70)
    .contact("sip:alice@192.168.1.2:5060", None)
    // Add Accept header to indicate which body formats we can process
    .header(TypedHeader::Accept(accept))
    .build();
§OPTIONS Request with Supported Extensions
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::TypedHeader;
use rvoip_sip_core::types::supported::Supported;
use rvoip_sip_core::types::allow::Allow;
use rvoip_sip_core::types::Method;

// Create supported extensions header
let supported = Supported::new(vec![
    "100rel".to_string(),
    "path".to_string(),
    "timer".to_string(),
    "replaces".to_string()
]);

// Create Allow header for methods we support
let mut allow = Allow::new();
allow.add_method(Method::Invite);
allow.add_method(Method::Ack);
allow.add_method(Method::Cancel);
allow.add_method(Method::Bye);
allow.add_method(Method::Options);
allow.add_method(Method::Refer);

// Create an OPTIONS request that advertises our capabilities
let options_request = SimpleRequestBuilder::options("sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("opt-tag-2"))
    .to("Bob", "sip:bob@example.com", None)
    .call_id("options-call-2@192.168.1.2")
    .cseq(1)
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK99nnmbhr"))
    .max_forwards(70)
    .contact("sip:alice@192.168.1.2:5060", None)
    // Add headers to advertise our capabilities
    .header(TypedHeader::Supported(supported))
    .header(TypedHeader::Allow(allow))
    .build();
Source

pub fn ack(uri: &str) -> Result<Self>

Create an ACK request builder

This is a convenience constructor for creating an ACK request as specified in RFC 3261 Section 17.1.1.3. ACK requests are used to acknowledge final responses to INVITE requests.

§Parameters
  • uri: The target URI as a string
§Returns

A Result containing the SimpleRequestBuilder or an error if the URI is invalid

§Examples
§Basic ACK Request
use rvoip_sip_core::builder::SimpleRequestBuilder;

let builder = SimpleRequestBuilder::ack("sip:bob@example.com").unwrap();
§Complete ACK for a 200 OK Response
use rvoip_sip_core::builder::SimpleRequestBuilder;

// Create an ACK to acknowledge a 200 OK response
// The tags and Call-ID must match the dialog established by the INVITE
let ack_request = SimpleRequestBuilder::ack("sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))  // Same tag as INVITE
    .to("Bob", "sip:bob@example.com", Some("b5qt9xl3"))  // To tag from the 200 OK response
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")  // Same as INVITE
    .cseq(1)  // Must match the INVITE CSeq number
    // Add routing information
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK887jhgfd"))
    .max_forwards(70)
    .build();
§ACK with Route Headers for Record-Route
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::TypedHeader;
use rvoip_sip_core::types::route::Route;
use rvoip_sip_core::types::uri::Uri;
use std::str::FromStr;

// Create route URIs from Record-Route headers received in the INVITE transaction
let route1 = Uri::from_str("sip:proxy1.example.com;lr").unwrap();
let route2 = Uri::from_str("sip:proxy2.example.com;lr").unwrap();
 
// Create route for proxies - simplified for doc test
let mut route = Route::new(vec![]);
route.add_uri(route2);
route.add_uri(route1);

// Create an ACK with routing information from Record-Routes
let ack_request = SimpleRequestBuilder::ack("sip:bob@192.168.2.3:5060").unwrap()
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))
    .to("Bob", "sip:bob@example.com", Some("b5qt9xl3"))
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")
    .cseq(1)
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK887jhgfd"))
    .max_forwards(70)
    // Add route header to follow the same path as the INVITE
    .header(TypedHeader::Route(route))
    .build();
Source

pub fn cancel(uri: &str) -> Result<Self>

Create a CANCEL request builder

This is a convenience constructor for creating a CANCEL request as specified in RFC 3261 Section 9. CANCEL requests are used to cancel a previous request sent by a client.

§Parameters
  • uri: The target URI as a string
§Returns

A Result containing the SimpleRequestBuilder or an error if the URI is invalid

§Examples
§Basic CANCEL Request
use rvoip_sip_core::builder::SimpleRequestBuilder;

let builder = SimpleRequestBuilder::cancel("sip:bob@example.com").unwrap();
§Complete CANCEL Request for a Pending INVITE
use rvoip_sip_core::builder::SimpleRequestBuilder;

// Create a CANCEL request to terminate a pending INVITE
// CANCEL must have the same request-URI, Call-ID, From, To, and CSeq number as the INVITE
let cancel_request = SimpleRequestBuilder::cancel("sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))  // Same as INVITE
    .to("Bob", "sip:bob@example.com", None)  // Same as INVITE (no To tag yet)
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")  // Same as INVITE
    .cseq(1)  // Must match the INVITE CSeq number
    // Add routing information (branch parameter can be different)
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK776asghyt"))
    .max_forwards(70)
    .build();
§CANCEL Request with Route Headers
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::route::Route;
use rvoip_sip_core::types::uri::Uri;
use rvoip_sip_core::types::TypedHeader;
use std::str::FromStr;

// Route header from the original INVITE
let route_uri = Uri::from_str("sip:proxy.example.com;lr").unwrap();
// Create a simple route - simplified for doc test
let mut route = Route::new(vec![]);
route.add_uri(route_uri);

// Create a CANCEL request for an INVITE
let cancel_request = SimpleRequestBuilder::cancel("sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))
    .to("Bob", "sip:bob@example.com", None)
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")
    .cseq(1)
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK887asdfgh"))
    .max_forwards(70)
    // Use same route as INVITE
    .header(TypedHeader::Route(route))
    .build();
§CANCEL Request with Reason Header
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::builder::headers::ReasonBuilderExt;

// Create a CANCEL request with a reason for termination
let cancel_request = SimpleRequestBuilder::cancel("sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))
    .to("Bob", "sip:bob@example.com", None)
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")
    .cseq(1)
    .via("192.168.1.2:5060", "UDP", Some("z9hG4bK887asdfgh"))
    .max_forwards(70)
    .reason_busy()  // Indicate the call is being canceled because user is busy
    .build();

// Alternatively, use reason_terminated() for standard request termination
let cancel_standard = SimpleRequestBuilder::cancel("sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("a73kszlfl"))
    .to("Bob", "sip:bob@example.com", None)
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.168.1.2")
    .cseq(1)
    .reason_terminated()  // Standard reason for CANCEL (487 Request Terminated)
    .build();
Source

pub fn method(&self) -> &Method

Get the method of the request being built

§Returns

A reference to the Method

Source

pub fn from(self, display_name: &str, uri: &str, tag: Option<&str>) -> Self

Add a From header with optional tag parameter

Creates and adds a From header as specified in RFC 3261 Section 20.20. The From header indicates the logical identity of the initiator of the request.

§Parameters
  • display_name: The display name for the From header (e.g., “Alice”)
  • uri: The URI for the From header (e.g., “sip:alice@example.com”)
  • tag: Optional tag parameter for dialog identification
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("1928301774"));
Source

pub fn to(self, display_name: &str, uri: &str, tag: Option<&str>) -> Self

Add a To header with optional tag parameter

Creates and adds a To header as specified in RFC 3261 Section 20.39. The To header specifies the logical recipient of the request.

§Parameters
  • display_name: The display name for the To header (e.g., “Bob”)
  • uri: The URI for the To header (e.g., “sip:bob@example.com”)
  • tag: Optional tag parameter for dialog identification
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .to("Bob", "sip:bob@example.com", None);
Source

pub fn call_id(self, call_id: &str) -> Self

Add a Call-ID header

Creates and adds a Call-ID header as specified in RFC 3261 Section 20.8. The Call-ID header uniquely identifies a particular invitation or all registrations of a particular client.

§Parameters
  • call_id: The Call-ID value (e.g., “f81d4fae-7dec-11d0-a765-00a0c91e6bf6@example.com”)
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .call_id("f81d4fae-7dec-11d0-a765-00a0c91e6bf6@host.example.com");
Source

pub fn cseq(self, seq: u32) -> Self

Add a CSeq header for requests

Creates and adds a CSeq header as specified in RFC 3261 Section 20.16. The CSeq header serves as a way to identify and order transactions.

§Parameters
  • seq: The sequence number (e.g., 1, 2, 3)
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .cseq(1);
Source

pub fn via(self, host: &str, transport: &str, branch: Option<&str>) -> Self

Add a Via header with optional branch parameter

Creates and adds a Via header as specified in RFC 3261 Section 20.42. The Via header indicates the path taken by the request so far and helps route responses back.

§Parameters
  • host: The host or IP address (e.g., “192.168.1.1” or “example.com:5060”)
  • transport: The transport protocol (UDP, TCP, TLS, etc.)
  • branch: Optional branch parameter (should be prefixed with z9hG4bK per RFC 3261)
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .via("192.168.1.1:5060", "UDP", Some("z9hG4bK776asdhds"));
Source

pub fn max_forwards(self, value: u32) -> Self

Add a Max-Forwards header

Creates and adds a Max-Forwards header as specified in RFC 3261 Section 20.22. The Max-Forwards header limits the number of hops a request can transit.

§Parameters
  • value: The Max-Forwards value (typically 70)
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .max_forwards(70);
Source

pub fn contact(self, uri: &str, display_name: Option<&str>) -> Self

Add a Contact header

Creates and adds a Contact header as specified in RFC 3261 Section 20.10. The Contact header provides a URI that can be used to directly contact the user agent.

§Parameters
  • uri: The contact URI as a string (e.g., “sip:alice@192.168.1.1:5060”)
  • display_name: Optional display name (e.g., “Alice”)
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .contact("sip:alice@192.168.1.1:5060", Some("Alice"));
Source

pub fn content_type(self, content_type: &str) -> Self

Add a Content-Type header

Creates and adds a Content-Type header as specified in RFC 3261 Section 20.15. The Content-Type header indicates the media type of the message body.

§Parameters
  • content_type: The content type (e.g., “application/sdp”)
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .content_type("application/sdp");
Source

pub fn header(self, header: TypedHeader) -> Self

Add a generic header

Allows adding any supported SIP header type using the TypedHeader enum. This is useful for headers that don’t have a dedicated method in the builder.

§Parameters
  • header: The typed header to add
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::{Method, TypedHeader};
use rvoip_sip_core::types::user_agent::UserAgent;

let user_agent = UserAgent::single("RVOIP/1.0");
let products = vec!["RVOIP/1.0".to_string()]; // Convert to Vec<String> for TypedHeader::UserAgent
 
let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .header(TypedHeader::UserAgent(products));
Source

pub fn body(self, body: impl Into<Bytes>) -> Self

Add body content and update Content-Length

Adds a message body to the request and automatically sets the Content-Length header as specified in RFC 3261 Section 20.14.

§Parameters
  • body: The body content (e.g., SDP for session description)
§Returns

Self for method chaining

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let sdp_body = "v=0\r\no=alice 2890844526 2890844526 IN IP4 127.0.0.1\r\ns=Session\r\nt=0 0\r\nm=audio 49170 RTP/AVP 0\r\na=rtpmap:0 PCMU/8000\r\n";

let builder = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .content_type("application/sdp")
    .body(sdp_body);
Source

pub fn build(self) -> Request

Build the final Request

Finalizes the request construction and returns the complete SIP request.

§Returns

The constructed Request

§Example
use rvoip_sip_core::builder::SimpleRequestBuilder;
use rvoip_sip_core::types::Method;

let request = SimpleRequestBuilder::new(Method::Invite, "sip:bob@example.com").unwrap()
    .from("Alice", "sip:alice@example.com", Some("1928301774"))
    .to("Bob", "sip:bob@example.com", None)
    .call_id("a84b4c76e66710")
    .cseq(1)
    .via("alice.example.com", "UDP", Some("z9hG4bK776asdhds"))
    .max_forwards(70)
    .build();

Trait Implementations§

Source§

impl CSeqBuilderExt for SimpleRequestBuilder

Source§

fn cseq(self, seq: u32) -> Self

Add a CSeq header with specified sequence number Read more
Source§

fn cseq_with_method(self, seq: u32, method: Method) -> Self

Add a CSeq header with specified sequence number and method Read more
Source§

impl CallIdBuilderExt for SimpleRequestBuilder

Source§

fn call_id(self, call_id: &str) -> Self

Add a Call-ID header with a specific value Read more
Source§

fn random_call_id(self) -> Self

Add a randomly generated Call-ID header Read more
Source§

fn random_call_id_with_host(self, host: &str) -> Self

Add a randomly generated Call-ID header with a host part Read more
Source§

impl CallInfoBuilderExt for SimpleRequestBuilder

Source§

fn call_info_uri(self, uri: &str, purpose: Option<&str>) -> Self

Add a Call-Info header using a URI string Read more
Source§

fn call_info_value(self, value: CallInfoValue) -> Self

Add a Call-Info header with a pre-constructed CallInfoValue Read more
Source§

fn call_info_values(self, values: Vec<CallInfoValue>) -> Self

Add a Call-Info header with multiple values Read more
Source§

impl ContactBuilderExt for SimpleRequestBuilder

Source§

fn contact(self, uri: &str, display_name: Option<&str>) -> Self

Add a Contact header. Read more
Source§

impl ContentBuilderExt for SimpleRequestBuilder

Implementation for new SimpleRequestBuilder

Source§

fn sdp_body(self, sdp: &SdpSession) -> Self

Add an SDP session as the message body Read more
Source§

impl ContentLengthBuilderExt for SimpleRequestBuilder

Source§

fn content_length(self, length: u32) -> Self

Add a Content-Length header with a specific byte length value Read more
Source§

fn no_content(self) -> Self

Add a Content-Length header with value 0 Read more
Source§

impl ContentTypeBuilderExt for SimpleRequestBuilder

Source§

fn content_type_sdp(self) -> Self

Add a Content-Type header specifying ‘application/sdp’ Read more
Source§

fn content_type_text(self) -> Self

Add a Content-Type header specifying ‘text/plain’ Read more
Source§

fn content_type_xml(self) -> Self

Add a Content-Type header specifying ‘application/xml’ Read more
Source§

fn content_type_json(self) -> Self

Add a Content-Type header specifying ‘application/json’ Read more
Source§

fn content_type_sipfrag(self) -> Self

Add a Content-Type header specifying ‘message/sipfrag’ Read more
Source§

fn content_type_custom(self, media_type: &str, media_subtype: &str) -> Self

Add a Content-Type header with a custom media type Read more
Source§

fn content_type(self, content_type: &str) -> Self

Add a Content-Type header Read more
Source§

impl FromBuilderExt for SimpleRequestBuilder

Source§

fn from(self, display_name: &str, uri: &str, tag: Option<&str>) -> Self

Add a From header with an optional tag parameter. Read more
Source§

impl HeaderSetter for SimpleRequestBuilder

Source§

fn set_header<H: TypedHeaderTrait + 'static>(self, header: H) -> Self

Set a header on the builder
Source§

impl MaxForwardsBuilderExt for SimpleRequestBuilder

Source§

fn max_forwards(self, value: u32) -> Self

Add a Max-Forwards header Read more
Source§

impl MimeVersionBuilderExt for SimpleRequestBuilder

Source§

fn mime_version_1_0(self) -> Self

Add a MIME-Version header with version 1.0 Read more
Source§

fn mime_version(self, major: u32, minor: u32) -> Self

Add a MIME-Version header with custom version numbers Read more
Source§

impl RouteBuilderExt for RequestBuilder

Source§

fn route_uri(self, uri: Uri) -> Self

Add a Route header with a URI Read more
Source§

fn route_address(self, address: Address) -> Self

Add a Route header with an Address Read more
Source§

fn route_entry(self, entry: RouteEntry) -> Self

Add a Route header with a raw RouteEntry Read more
Source§

fn route_entries(self, entries: Vec<RouteEntry>) -> Self

Add a Route header with multiple entries Read more
Source§

impl ToBuilderExt for SimpleRequestBuilder

Source§

fn to(self, display_name: &str, uri: &str, tag: Option<&str>) -> Self

Add a To header with an optional tag parameter. Read more
Source§

impl ViaBuilderExt for SimpleRequestBuilder

Source§

fn via(self, host: &str, transport: &str, branch: Option<&str>) -> Self

Add a Via header with optional branch parameter Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AcceptEncodingExt for T
where T: HeaderSetter,

Source§

fn accept_encoding(self, encoding: &str, q: Option<f32>) -> T

Add an Accept-Encoding header with a single encoding Read more
Source§

fn accept_encodings(self, encodings: Vec<(&str, Option<f32>)>) -> T

Add an Accept-Encoding header with multiple encodings Read more
Source§

impl<T> AcceptExt for T
where T: HeaderSetter,

Source§

fn accept(self, media_type: &str, q: Option<f32>) -> T

Add an Accept header with a single media type Read more
Source§

fn accepts(self, media_types: Vec<(&str, Option<f32>)>) -> T

Add an Accept header with multiple media types Read more
Source§

impl<T> AcceptLanguageExt for T
where T: HeaderSetter,

Source§

fn accept_language(self, language: &str, q: Option<f32>) -> T

Add an Accept-Language header with a single language Read more
Source§

fn accept_languages(self, languages: Vec<(&str, Option<f32>)>) -> T

Add an Accept-Language header with multiple languages Read more
Source§

impl<T> AlertInfoBuilderExt for T
where T: HeaderSetter,

Source§

fn alert_info(self, uri: Uri) -> T

Add an Alert-Info header with the specified URI Read more
Source§

fn alert_info_uri(self, uri_str: &str) -> T

Add an Alert-Info header with a URI parsed from a string Read more
Source§

fn alert_info_with_param( self, uri: Uri, param_name: &str, param_value: &str, ) -> T

Add an Alert-Info header with a URI and a single parameter Read more
Source§

fn alert_info_uri_with_param( self, uri_str: &str, param_name: &str, param_value: &str, ) -> T

Add an Alert-Info header with a URI string and a single parameter Read more
Source§

fn alert_info_with_params(self, uri: Uri, params: Vec<(&str, &str)>) -> T

Add an Alert-Info header with a URI and multiple parameters Read more
Source§

impl<T> AllowBuilderExt for T
where T: HeaderSetter,

Source§

fn allow_method(self, method: Method) -> T

Add an Allow header with a single method Read more
Source§

fn allow_methods(self, methods: Vec<Method>) -> T

Add an Allow header with multiple methods Read more
Source§

fn allow_standard_methods(self) -> T

Add an Allow header with standard methods for UA (User Agent) operations Read more
Source§

fn allow_all_methods(self) -> T

Add an Allow header with all common SIP methods Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AuthenticationInfoExt for T
where T: HeaderSetter,

Source§

fn authentication_info( self, nextnonce: Option<&str>, qop: Option<&str>, rspauth: Option<&str>, cnonce: Option<&str>, nc: Option<&str>, ) -> T

Add an Authentication-Info header to the response Read more
Source§

impl<T> AuthorizationExt for T
where T: HeaderSetter,

Source§

fn authorization_digest( self, username: &str, realm: &str, nonce: &str, response: &str, cnonce: Option<&str>, qop: Option<&str>, nc: Option<&str>, method: Option<&str>, uri: Option<&str>, algorithm: Option<&str>, opaque: Option<&str>, ) -> T

Add a Digest Authorization header to the request Read more
Source§

fn authorization_basic(self, username: &str, password: &str) -> T

Add a Basic Authorization header to the request Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ContentDispositionExt for T
where T: HeaderSetter,

Source§

fn content_disposition_session(self, handling: &str) -> T

Add a Content-Disposition header with session disposition type Read more
Source§

fn content_disposition_render(self, handling: &str) -> T

Add a Content-Disposition header with render disposition type Read more
Source§

fn content_disposition_icon(self, size: &str) -> T

Add a Content-Disposition header with icon disposition type Read more
Source§

fn content_disposition_alert(self, handling: Option<&str>) -> T

Add a Content-Disposition header with alert disposition type Read more
Source§

fn content_disposition( self, disposition_type: &str, params: HashMap<String, String>, ) -> T

Add a Content-Disposition header with a custom disposition type Read more
Source§

impl<T> ContentEncodingExt for T
where T: HeaderSetter,

Source§

fn content_encoding(self, encoding: &str) -> T

Add a Content-Encoding header with a single encoding Read more
Source§

fn content_encodings<S>(self, encodings: &[S]) -> T
where S: AsRef<str>,

Add a Content-Encoding header with multiple encodings Read more
Source§

impl<T> ContentLanguageExt for T
where T: HeaderSetter,

Source§

fn content_language(self, language: &str) -> T

Add a Content-Language header with a single language Read more
Source§

fn content_languages<S>(self, languages: &[S]) -> T
where S: AsRef<str>,

Add a Content-Language header with multiple languages Read more
Source§

impl<T> ErrorInfoBuilderExt for T
where T: HeaderSetter,

Source§

fn error_info_uri(self, uri: &str) -> T

Add an Error-Info header with a URI Read more
Source§

fn error_info_uri_with_param( self, uri: &str, param_name: &str, param_value: &str, ) -> T

Add an Error-Info header with a URI and a parameter Read more
Source§

fn error_info_uri_with_params(self, uri: &str, params: Vec<(&str, &str)>) -> T

Add an Error-Info header with a URI and multiple parameters Read more
Source§

fn error_info_uri_with_comment(self, uri: &str, comment: &str) -> T

Add an Error-Info header with a URI and a comment Read more
Source§

fn error_info_uris(self, uris: Vec<&str>) -> T

Add multiple Error-Info headers to a response Read more
Source§

impl<T> EventBuilderExt for T
where T: HeaderSetter,

Source§

fn event(self, event_data: Event) -> T

Sets the Event header using a pre-constructed Event object. Read more
Source§

fn event_type(self, event_type: EventType) -> T

Sets the Event header with a specific event type and no id or other parameters. Read more
Source§

fn event_id(self, event_type: EventType, id: impl Into<String>) -> T

Sets the Event header with an event type and an id parameter. Read more
Source§

fn event_full( self, event_type: EventType, id: Option<impl Into<String>>, params_vec: Vec<(impl Into<String>, Option<impl Into<String>>)>, ) -> T

Sets the Event header with an event type, an optional id, and generic parameters. Read more
Source§

fn event_presence(self, id: Option<impl Into<String>>) -> T

Convenience method to set a “presence” event. Read more
Source§

fn event_conference(self, id: Option<impl Into<String>>) -> T

Convenience method to set a “conference” event (as a package). Read more
Source§

fn event_dialog(self, id: Option<impl Into<String>>) -> T

Convenience method to set a “dialog” event. Read more
Source§

fn event_message_summary(self, id: Option<impl Into<String>>) -> T

Convenience method to set a “message-summary” event. Read more
Source§

impl<T> ExpiresBuilderExt for T
where T: HeaderSetter,

Source§

fn expires_seconds(self, seconds: u32) -> T

Add an Expires header with a specified number of seconds Read more
Source§

fn expires_duration(self, duration: Duration) -> T

Add an Expires header with a specified Duration Read more
Source§

fn expires_zero(self) -> T

Add an Expires header with zero value for immediate expiration Read more
Source§

fn expires_one_hour(self) -> T

Add an Expires header with a standard one-hour expiration Read more
Source§

fn expires_one_day(self) -> T

Add an Expires header with a standard one-day expiration Read more
Source§

impl<T> ExpiresExt for T
where T: HeaderSetter,

Source§

fn expires(self, delta_seconds: u32) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InReplyToBuilderExt for T
where T: HeaderSetter,

Source§

fn in_reply_to(self, call_id: &str) -> T

Add an In-Reply-To header with a single Call-ID Read more
Source§

fn in_reply_to_multiple(self, call_ids: Vec<&str>) -> T

Add an In-Reply-To header with multiple Call-IDs Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MinSEBuilderExt for T
where T: HeaderSetter,

Source§

fn min_se(self, delta_seconds: u32) -> T

Sets the Min-SE header with the specified delta-seconds value. Read more
Source§

impl<T> OrganizationBuilderExt for T
where T: HeaderSetter,

Source§

fn organization<S>(self, name: S) -> T
where S: Into<String>,

Add an Organization header with the specified organization name Read more
Source§

impl<T> PathBuilderExt for T
where T: HeaderSetter,

Source§

fn path(self, uri: impl AsRef<str>) -> Result<T, Error>

Add a Path header with a single URI Read more
Source§

fn path_addresses(self, uris: Vec<impl AsRef<str>>) -> Result<T, Error>

Add a Path header with multiple URIs Read more
Source§

impl<T> PriorityBuilderExt for T
where T: HeaderSetter,

Source§

fn priority(self, priority: Priority) -> T

Add a Priority header with the specified priority value Read more
Source§

fn priority_emergency(self) -> T

Add a Priority header with emergency priority Read more
Source§

fn priority_urgent(self) -> T

Add a Priority header with urgent priority Read more
Source§

fn priority_normal(self) -> T

Add a Priority header with normal priority Read more
Source§

fn priority_non_urgent(self) -> T

Add a Priority header with non-urgent priority Read more
Source§

fn priority_numeric(self, value: u8) -> T

Add a Priority header with a numeric priority value Read more
Source§

fn priority_token(self, token: impl Into<String>) -> T

Add a Priority header with a custom token value Read more
Source§

impl<T> ProxyAuthenticateExt for T
where T: HeaderSetter,

Source§

fn proxy_authenticate_digest( self, realm: &str, nonce: &str, opaque: Option<&str>, algorithm: Option<&str>, qop: Option<Vec<&str>>, stale: Option<bool>, domain: Option<Vec<&str>>, ) -> T

Add a Digest Proxy-Authenticate header to the response Read more
Source§

fn proxy_authenticate_basic(self, realm: &str) -> T

Add a Basic Proxy-Authenticate header to the response Read more
Source§

impl<T> ProxyAuthorizationExt for T
where T: HeaderSetter,

Source§

fn proxy_authorization_digest( self, username: &str, realm: &str, nonce: &str, uri_str: &str, response: &str, algorithm: Option<&str>, cnonce: Option<&str>, opaque: Option<&str>, qop: Option<&str>, nc: Option<&str>, ) -> T

Add a Digest Proxy-Authorization header to the request Read more
Source§

fn proxy_authorization_basic(self, username: &str, password: &str) -> T

Add a Basic Proxy-Authorization header to the request Read more
Source§

impl<T> ProxyRequireBuilderExt for T
where T: HeaderSetter,

Source§

fn proxy_require_tag(self, option_tag: impl Into<String>) -> T

Add a Proxy-Require header with a single option tag Read more
Source§

fn proxy_require_tags(self, option_tags: Vec<impl Into<String>>) -> T

Add a Proxy-Require header with multiple option tags Read more
Source§

fn proxy_require_sec_agree(self) -> T

Add a Proxy-Require header for sec-agree (security agreement) Read more
Source§

fn proxy_require_precondition(self) -> T

Add a Proxy-Require header for precondition Read more
Source§

fn proxy_require_path(self) -> T

Add a Proxy-Require header for path Read more
Source§

fn proxy_require_resource_priority(self) -> T

Add a Proxy-Require header for resource priority Read more
Source§

impl<T> RSeqBuilderExt for T
where T: HeaderSetter,

Source§

fn rseq(self, seq: u32) -> T

Add an RSeq header with a sequence number Read more
Source§

fn rseq_next(self, previous_seq: u32) -> T

Add an RSeq header with a sequence number incremented from a previous value Read more
Source§

impl<T> ReasonBuilderExt for T
where T: HeaderSetter,

Source§

fn reason( self, protocol: impl Into<String>, cause: u16, text: Option<impl Into<String>>, ) -> T

Add a Reason header with the specified protocol, cause code, and optional text Read more
Source§

fn reason_sip(self, cause: u16, text: Option<impl Into<String>>) -> T

Add a Reason header with SIP protocol and the specified cause code and text Read more
Source§

fn reason_q850(self, cause: u16, text: Option<impl Into<String>>) -> T

Add a Reason header with Q.850 protocol and the specified cause code and text Read more
Source§

fn reason_terminated(self) -> T

Add a Reason header for SIP request termination Read more
Source§

fn reason_busy(self) -> T

Add a Reason header for busy indication Read more
Source§

fn reason_normal_clearing(self) -> T

Add a Reason header for normal call clearing Read more
Source§

fn reason_declined(self) -> T

Add a Reason header for call rejected/declined Read more
Source§

impl<T> RecordRouteBuilderExt for T
where T: HeaderSetter,

Source§

fn record_route_uri(self, uri: Uri) -> T

Add a Record-Route header with URI Read more
Source§

fn record_route_address(self, address: Address) -> T

Add a Record-Route header with Address Read more
Source§

fn record_route_entry(self, entry: RecordRouteEntry) -> T

Add a Record-Route header with a raw entry Read more
Source§

fn record_route_entries(self, entries: Vec<RecordRouteEntry>) -> T

Add a Record-Route header with multiple entries Read more
Source§

impl<T> ReferToExt for T
where T: HeaderSetter,

Source§

fn refer_to_uri(self, uri: impl Into<String>) -> T

Add a Refer-To header with a URI Read more
Source§

fn refer_to_address( self, display_name: impl Into<String>, uri: impl Into<String>, ) -> T

Add a Refer-To header with a URI and display name Read more
Source§

fn refer_to_with_address(self, address: Address) -> T

Add a Refer-To header with a prebuilt Address object Read more
Source§

fn refer_to_blind_transfer(self, target_uri: impl Into<String>) -> T

Add a Refer-To header for a blind transfer Read more
Source§

fn refer_to_attended_transfer( self, target_uri: impl Into<String>, call_id: impl Into<String>, to_tag: impl Into<String>, from_tag: impl Into<String>, ) -> T

Add a Refer-To header for an attended transfer with Replaces Read more
Source§

impl<T> ReferredByExt for T
where T: HeaderSetter,

Source§

fn referred_by(self, address: Address) -> T

Add a Referred-By header with the given Address. Read more
Source§

fn referred_by_uri(self, uri: Uri) -> T

Add a Referred-By header with the given URI. Read more
Source§

fn referred_by_str(self, value: &str) -> Result<T, Error>

Add a Referred-By header parsed from a string. Read more
Source§

fn referred_by_uri_with_cid(self, uri: Uri, cid: Option<&str>) -> T

Add a Referred-By header with URI and optional cid parameter. Read more
Source§

fn referred_by_with_cid(self, address: Address, cid: Option<&str>) -> T

Add a Referred-By header with Address and optional cid parameter. Read more
Source§

impl<T> ReplyToBuilderExt for T
where T: HeaderSetter,

Source§

fn reply_to(self, uri_str: &str) -> Result<T, Error>

Set a Reply-To header using a URI string Read more
Source§

fn reply_to_with_display_name( self, display_name: &str, uri_str: &str, ) -> Result<T, Error>

Set a Reply-To header using a URI string and display name Read more
Source§

fn reply_to_address(self, address: Address) -> T

Set a Reply-To header using a pre-constructed Address Read more
Source§

impl<T> RequireBuilderExt for T
where T: HeaderSetter,

Source§

fn require_tag(self, option_tag: impl Into<String>) -> T

Add a Require header with a single option tag Read more
Source§

fn require_tags(self, option_tags: Vec<impl Into<String>>) -> T

Add a Require header with multiple option tags Read more
Source§

fn require_100rel(self) -> T

Add a Require header for 100rel (reliable provisional responses) Read more
Source§

fn require_timer(self) -> T

Add a Require header for timer (session timers) Read more
Source§

fn require_path(self) -> T

Add a Require header for path Read more
Source§

fn require_ice(self) -> T

Add a Require header for ICE negotiation Read more
Source§

fn require_webrtc(self) -> T

Add a Require header with common WebRTC-related option tags Read more
Source§

impl<T> RetryAfterBuilderExt for T
where T: HeaderSetter,

Source§

fn retry_after(self, seconds: u32) -> T

Add a Retry-After header with a delay in seconds Read more
Source§

fn retry_after_from_duration(self, duration: Duration) -> T

Add a Retry-After header with a delay specified as a Duration Read more
Source§

fn retry_after_with_comment(self, seconds: u32, comment: &str) -> T

Add a Retry-After header with a delay and a comment Read more
Source§

fn retry_after_duration( self, seconds: u32, duration: u32, comment: Option<&str>, ) -> T

Add a Retry-After header with a delay, duration parameter, and optional comment Read more
Source§

fn retry_after_duration_with_comment( self, duration: Duration, comment: &str, ) -> T

Add a Retry-After header with a Duration and a comment Read more
Source§

impl<T> ServerBuilderExt for T
where T: HeaderSetter,

Source§

fn server(self, product: impl Into<String>) -> T

Add a Server header with a single product token Read more
Source§

fn server_products(self, products: Vec<impl Into<String>>) -> T

Add a Server header with multiple product tokens Read more
Source§

impl<T> SessionExpiresExt for T
where T: HeaderSetter,

Source§

fn session_expires(self, delta_seconds: u32, refresher: Option<Refresher>) -> T

Sets the Session-Expires header with the given interval and optional refresher. Read more
Source§

fn session_expires_with_params( self, delta_seconds: u32, refresher: Option<Refresher>, params: Vec<Param>, ) -> T

Sets the Session-Expires header with interval, optional refresher, and additional generic parameters. Read more
Source§

fn session_expires_uac(self, delta_seconds: u32) -> T

Convenience method to set Session-Expires with UAC (User Agent Client) as the refresher. Read more
Source§

fn session_expires_uas(self, delta_seconds: u32) -> T

Convenience method to set Session-Expires with UAS (User Agent Server) as the refresher. Read more
Source§

impl<T> SupportedBuilderExt for T
where T: HeaderSetter,

Source§

fn supported_tag(self, option_tag: impl Into<String>) -> T

Add a Supported header with a single option tag Read more
Source§

fn supported_tags(self, option_tags: Vec<impl Into<String>>) -> T

Add a Supported header with multiple option tags Read more
Source§

fn supported_100rel(self) -> T

Add a Supported header for 100rel (reliable provisional responses) Read more
Source§

fn supported_path(self) -> T

Add a Supported header for path Read more
Source§

fn supported_timer(self) -> T

Add a Supported header for timer Read more
Source§

fn supported_webrtc(self) -> T

Add a Supported header with common WebRTC-related option tags Read more
Source§

fn supported_standard(self) -> T

Add a Supported header with standard option tags used by UAs Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnsupportedBuilderExt for T
where T: HeaderSetter,

Source§

fn unsupported_tag(self, option_tag: impl Into<String>) -> T

Add an Unsupported header with a single option tag Read more
Source§

fn unsupported_tags(self, option_tags: Vec<impl Into<String>>) -> T

Add an Unsupported header with multiple option tags Read more
Source§

fn unsupported_100rel(self) -> T

Add an Unsupported header for 100rel (reliable provisional responses) Read more
Source§

fn unsupported_timer(self) -> T

Add an Unsupported header for timer Read more
Source§

fn unsupported_path(self) -> T

Add an Unsupported header for path Read more
Source§

impl<T> UserAgentBuilderExt for T
where T: HeaderSetter,

Source§

fn user_agent(self, product: impl Into<String>) -> T

Add a User-Agent header with a single product token Read more
Source§

fn user_agent_products(self, products: Vec<impl Into<String>>) -> T

Add a User-Agent header with multiple product tokens Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WarningBuilderExt for T
where T: HeaderSetter,

Source§

fn warning(self, code: u16, agent: Uri, text: impl Into<String>) -> T

Add a Warning header with the specified warning code, agent, and text Read more
Source§

fn warnings(self, warnings: Vec<Warning>) -> T

Add multiple warnings to a message Read more
Source§

fn warning_incompatible_protocol(self, text: impl Into<String>) -> T

Add a Warning header for incompatible network protocol (300) Read more
Source§

fn warning_incompatible_address_format(self, text: impl Into<String>) -> T

Add a Warning header for incompatible network address formats (301) Read more
Source§

fn warning_incompatible_transport(self, text: impl Into<String>) -> T

Add a Warning header for incompatible transport protocol (302) Read more
Source§

fn warning_incompatible_media_format(self, text: impl Into<String>) -> T

Add a Warning header for incompatible media format (305) Read more
Source§

fn warning_insufficient_bandwidth(self, text: impl Into<String>) -> T

Add a Warning header for insufficient bandwidth (370) Read more
Source§

fn warning_miscellaneous(self, text: impl Into<String>) -> T

Add a Warning header for miscellaneous warning (399) Read more
Source§

impl<T> WwwAuthenticateExt for T
where T: HeaderSetter,

Source§

fn www_authenticate_digest( self, realm: &str, nonce: &str, opaque: Option<&str>, algorithm: Option<&str>, qop: Option<Vec<&str>>, stale: Option<bool>, domain: Option<Vec<&str>>, ) -> T

Add a Digest WWW-Authenticate header to the response Read more
Source§

fn www_authenticate_basic(self, realm: &str) -> T

Add a Basic WWW-Authenticate header to the response Read more