Skip to content

Commit 08d4886

Browse files
committed
bump version to 0.2.68 and update InviteOption initialization to use default values
1 parent 81b0e60 commit 08d4886

6 files changed

Lines changed: 12 additions & 19 deletions

File tree

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rsipstack"
3-
version = "0.2.67"
3+
version = "0.2.68"
44
edition = "2021"
55
description = "SIP Stack Rust library for building SIP applications"
66
license = "MIT"

‎examples/client/main.rs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,9 @@ async fn main() -> rsipstack::Result<()> {
249249
let invite_option = InviteOption {
250250
callee: callee.try_into().expect("callee"),
251251
caller: contact.clone(),
252-
content_type: None,
253-
offer: None,
254252
contact: contact.clone(),
255253
credential: Some(credential.clone()),
256-
headers: None,
257-
destination: None,
254+
..Default::default()
258255
};
259256

260257
match make_call(dialog_layer, invite_option, opt, state_sender).await {

‎src/dialog/authenticate.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ use rsip::{Header, Param, Response};
7070
/// let invite_option = InviteOption {
7171
/// caller: rsip::Uri::try_from("sip:alice@example.com")?,
7272
/// callee: rsip::Uri::try_from("sip:bob@example.com")?,
73-
/// destination: None,
7473
/// content_type: Some("application/sdp".to_string()),
7574
/// offer: Some(sdp_bytes),
7675
/// contact: rsip::Uri::try_from("sip:alice@192.168.1.100:5060")?,
7776
/// credential: Some(credential),
78-
/// headers: None,
77+
/// ..Default::default()
7978
/// };
8079
/// # Ok(())
8180
/// # }

‎src/dialog/invitation.rs‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ use tracing::{debug, info, warn};
4747
/// caller: "sip:alice@example.com".try_into()?,
4848
/// callee: "sip:bob@example.com".try_into()?,
4949
/// content_type: Some("application/sdp".to_string()),
50-
/// destination: None,
5150
/// offer: Some(sdp_offer_bytes),
5251
/// contact: "sip:alice@192.168.1.100:5060".try_into()?,
53-
/// credential: None,
54-
/// headers: None,
52+
/// ..Default::default()
5553
/// };
5654
/// # Ok(())
5755
/// # }
@@ -85,11 +83,11 @@ use tracing::{debug, info, warn};
8583
/// caller: "sip:alice@example.com".try_into()?,
8684
/// callee: "sip:bob@example.com".try_into()?,
8785
/// content_type: Some("application/sdp".to_string()),
88-
/// destination: None,
8986
/// offer: Some(sdp_bytes),
9087
/// contact: "sip:alice@192.168.1.100:5060".try_into()?,
9188
/// credential: Some(auth_credential),
9289
/// headers: Some(custom_headers),
90+
/// ..Default::default()
9391
/// };
9492
/// # Ok(())
9593
/// # }
@@ -111,18 +109,18 @@ use tracing::{debug, info, warn};
111109
/// let invite_option = InviteOption {
112110
/// caller: "sip:alice@example.com".try_into()?,
113111
/// callee: "sip:bob@example.com".try_into()?,
114-
/// content_type: None, // Will default to "application/sdp"
115-
/// destination: None,
116112
/// offer: Some(sdp_bytes),
117113
/// contact: "sip:alice@192.168.1.100:5060".try_into()?,
118114
/// credential: Some(credential),
119-
/// headers: None,
115+
/// ..Default::default()
120116
/// };
121117
/// # Ok(())
122118
/// # }
123119
/// ```
124120
#[derive(Default, Clone)]
125121
pub struct InviteOption {
122+
pub caller_display_name: Option<String>,
123+
pub caller_params: Vec<rsip::uri::Param>,
126124
pub caller: rsip::Uri,
127125
pub callee: rsip::Uri,
128126
pub destination: Option<SipAddr>,
@@ -248,9 +246,9 @@ impl DialogLayer {
248246
let recipient = to.uri.clone();
249247

250248
let from = rsip::typed::From {
251-
display_name: None,
249+
display_name: opt.caller_display_name.clone(),
252250
uri: opt.caller.clone(),
253-
params: vec![],
251+
params: opt.caller_params.clone(),
254252
}
255253
.with_tag(make_tag());
256254

‎src/lib.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,8 @@
8888
//! callee: rsip::Uri::try_from("sip:bob@example.com")?,
8989
//! contact: rsip::Uri::try_from("sip:alice@myhost.com:5060")?,
9090
//! content_type: Some("application/sdp".to_string()),
91-
//! destination: None,
9291
//! offer: Some(sdp_body),
93-
//! credential: None,
94-
//! headers: None,
92+
//! ..Default::default()
9593
//! };
9694
//!
9795
//! let (dialog, response) = dialog_layer.do_invite(invite_option, state_sender).await?;

‎src/transport/transport_layer.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ impl TransportLayerInner {
328328
}
329329
}
330330
info!(addr=%transport.get_addr(), "transport serve_loop exited");
331+
transport.close().await.ok();
331332
sender_clone.send(TransportEvent::Closed(transport)).ok();
332333
});
333334
}

0 commit comments

Comments
 (0)