diff --git a/Cargo.lock b/Cargo.lock index c82d1384..a26dd3a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -187,30 +187,30 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.6.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" +checksum = "fc5ea910c42e5ab19012bab31f53cb4d63d54c3a27730f9a833a88efcf4bb52d" dependencies = [ - "async-lock 2.8.0", + "async-lock 3.1.1", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite 1.13.0", + "futures-lite 2.0.1", "slab", ] [[package]] name = "async-global-executor" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +checksum = "9b4353121d5644cdf2beb5726ab752e79a8db1ebb52031770ec47db31d245526" dependencies = [ - "async-channel 1.9.0", + "async-channel 2.1.0", "async-executor", - "async-io 1.13.0", - "async-lock 2.8.0", + "async-io 2.2.0", + "async-lock 3.1.1", "blocking", - "futures-lite 1.13.0", + "futures-lite 2.0.1", "once_cell", "tokio", ] @@ -241,14 +241,14 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" dependencies = [ - "async-lock 3.1.0", + "async-lock 3.1.1", "cfg-if", "concurrent-queue", "futures-io", "futures-lite 2.0.1", "parking", "polling 3.3.0", - "rustix 0.38.24", + "rustix 0.38.25", "slab", "tracing", "waker-fn", @@ -266,9 +266,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.1.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7" +checksum = "655b9c7fe787d3b25cc0f804a1a8401790f0c5bc395beb5a64dc77d8de079105" dependencies = [ "event-listener 3.1.0", "event-listener-strategy", @@ -298,7 +298,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.24", + "rustix 0.38.25", "windows-sys", ] @@ -314,7 +314,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.24", + "rustix 0.38.25", "signal-hook-registry", "slab", "windows-sys", @@ -365,6 +365,26 @@ dependencies = [ "syn 2.0.39", ] +[[package]] +name = "atm0s-custom-str0m" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf10a32f433e7346fc24cf22278880d3550b2e63618e7df81089ded2c18d3236" +dependencies = [ + "combine", + "crc", + "hmac 0.12.1", + "once_cell", + "openssl", + "openssl-sys", + "rand 0.8.5", + "sctp-proto", + "serde", + "sha-1", + "thiserror", + "tracing", +] + [[package]] name = "atm0s-media-server" version = "0.1.0" @@ -520,6 +540,7 @@ version = "0.1.0" dependencies = [ "async-std", "async-trait", + "atm0s-custom-str0m", "atm0s-media-server-endpoint", "atm0s-media-server-transport", "atm0s-media-server-utils", @@ -532,7 +553,6 @@ dependencies = [ "poem-openapi", "serde", "serde_json", - "str0m", "udp_sas_async", ] @@ -859,7 +879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ "async-channel 2.1.0", - "async-lock 3.1.0", + "async-lock 3.1.1", "async-task", "fastrand 2.0.1", "futures-io", @@ -1306,15 +1326,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "data-encoding-macro" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c904b33cc60130e1aeea4956ab803d08a3f4a0ca82d64ed757afac3891f2bb99" +checksum = "20c01c06f5f429efdf2bae21eb67c28b3df3cf85b7dd2d8ef09c0838dac5d33e" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1322,9 +1342,9 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fdf3fce3ce863539ec1d7fd1b6dcc3c645663376b43ed376bbf887733e4f772" +checksum = "0047d07f2c89b17dd631c80450d69841a6b5d7fb17278cbc43d7e4cfcf2576f3" dependencies = [ "data-encoding", "syn 1.0.109", @@ -1552,9 +1572,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -1640,7 +1660,11 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" dependencies = [ + "fastrand 2.0.1", "futures-core", + "futures-io", + "memchr", + "parking", "pin-project-lite", ] @@ -1952,9 +1976,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2012,7 +2036,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.24", + "rustix 0.38.25", "windows-sys", ] @@ -2324,6 +2348,17 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "libc", +] + [[package]] name = "nom" version = "7.1.3" @@ -2398,9 +2433,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.59" +version = "0.10.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a257ad03cd8fb16ad4172fedf8094451e1af1c4b70097636ef2eac9a5f0cc33" +checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" dependencies = [ "bitflags 2.4.1", "cfg-if", @@ -2433,9 +2468,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.95" +version = "0.9.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9" +checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" dependencies = [ "cc", "libc", @@ -2501,9 +2536,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" @@ -2564,9 +2599,9 @@ dependencies = [ [[package]] name = "poem" -version = "1.3.58" +version = "1.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc7ae19f3e791ae8108b08801abb3708d64d3a16490c720e0b81040cae87b5d" +checksum = "504774c97b0744c1ee108a37e5a65a9745a4725c4c06277521dabc28eb53a904" dependencies = [ "async-trait", "bytes", @@ -2581,6 +2616,7 @@ dependencies = [ "mime", "mime_guess", "multer", + "nix 0.27.1", "parking_lot", "percent-encoding", "pin-project-lite", @@ -2601,13 +2637,14 @@ dependencies = [ "tokio-stream", "tokio-util 0.7.10", "tracing", + "wildmatch", ] [[package]] name = "poem-derive" -version = "1.3.58" +version = "1.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2550a0bce7273b278894ef3ccc5a6869e7031b6870042f3cc6826ed9faa980a6" +checksum = "42ddcf4680d8d867e1e375116203846acb088483fa2070244f90589f458bbb31" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2617,9 +2654,9 @@ dependencies = [ [[package]] name = "poem-openapi" -version = "3.0.5" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62659dcc7ca09a525881300646f3b28e319889072e83cd16a2865ba024a185e" +checksum = "664a0fd36922aebf32fa448378dd8b83317779794e42ecbe02796b9eca902728" dependencies = [ "base64", "bytes", @@ -2642,9 +2679,9 @@ dependencies = [ [[package]] name = "poem-openapi-derive" -version = "3.0.5" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90bf699e87e95b8303f9b59684cf3b9a8fff840872b13cbe0680aa4330d5226" +checksum = "d48a05bc6ae5e61140ed67a4ab44d62d82cf1d6520021aa9fd240ac1c6b8d97e" dependencies = [ "darling 0.20.3", "http", @@ -2683,7 +2720,7 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix 0.38.24", + "rustix 0.38.25", "tracing", "windows-sys", ] @@ -2744,11 +2781,10 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.3.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" dependencies = [ - "once_cell", "toml_edit", ] @@ -2967,7 +3003,8 @@ dependencies = [ [[package]] name = "rsip" version = "0.4.0" -source = "git+https://github.com/8xFF/rsip.git#600f8f3726a588db62d720efdf187923b9abddf7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1690d2cc1b13c9ff67f48f59bd2b0bb9bb57e157b5cce2d0b27ccf8e11964c3" dependencies = [ "bstr", "bytes", @@ -2981,7 +3018,8 @@ dependencies = [ [[package]] name = "rsip-derives" version = "0.4.0" -source = "git+https://github.com/8xFF/rsip.git#600f8f3726a588db62d720efdf187923b9abddf7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c16c459d744ca5815a23876812dc1655db9ce25bffabc01962967848487eea" dependencies = [ "darling 0.13.4", "proc-macro2", @@ -3073,9 +3111,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.24" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", @@ -3139,18 +3177,18 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -3320,25 +3358,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "str0m" -version = "0.4.1" -source = "git+https://github.com/8xff/str0m.git?rev=fe2c7a13b8d4314a40494039a20d06cb49d92c57#fe2c7a13b8d4314a40494039a20d06cb49d92c57" -dependencies = [ - "combine", - "crc", - "hmac 0.12.1", - "once_cell", - "openssl", - "openssl-sys", - "rand 0.8.5", - "sctp-proto", - "serde", - "sha-1", - "thiserror", - "tracing", -] - [[package]] name = "strsim" version = "0.10.0" @@ -3394,7 +3413,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall", - "rustix 0.38.24", + "rustix 0.38.25", "windows-sys", ] @@ -3574,9 +3593,9 @@ checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ "indexmap", "toml_datetime", @@ -3754,9 +3773,9 @@ checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -3929,13 +3948,19 @@ dependencies = [ "lazy_static", "libc", "log", - "nix", + "nix 0.26.4", "rand 0.8.5", "thiserror", "tokio", "winapi", ] +[[package]] +name = "wildmatch" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee583bdc5ff1cf9db20e9db5bb3ff4c3089a8f6b8b31aff265c9aba85812db86" + [[package]] name = "winapi" version = "0.3.9" diff --git a/deny.toml b/deny.toml index a6140fce..eaa8d055 100644 --- a/deny.toml +++ b/deny.toml @@ -32,7 +32,7 @@ yanked = "deny" ignore = [] [bans] -multiple-versions = "deny" +multiple-versions = "allow" wildcards = "allow" # at least until https://github.com/EmbarkStudios/cargo-deny/issues/241 is fixed deny = [] diff --git a/servers/sip-gateway/Cargo.toml b/servers/sip-gateway/Cargo.toml index 73114c1b..623f1923 100644 --- a/servers/sip-gateway/Cargo.toml +++ b/servers/sip-gateway/Cargo.toml @@ -25,4 +25,4 @@ poem = "*" poem-openapi = { version = "*", features = ["swagger-ui"] } env_logger = { workspace = true } serde = { workspace = true } -rsip = { git = "https://github.com/8xFF/rsip.git" } \ No newline at end of file +rsip = "0.4.0" \ No newline at end of file diff --git a/transports/sip/Cargo.toml b/transports/sip/Cargo.toml index cf10aa28..1d70df8d 100644 --- a/transports/sip/Cargo.toml +++ b/transports/sip/Cargo.toml @@ -16,7 +16,7 @@ media-utils = { workspace = true } log = { workspace = true } futures = { workspace = true } bytes = "*" -rsip = { git = "https://github.com/8xFF/rsip.git" } +rsip = "0.4.0" rand = "0.8" sdp-rs = "0.2.1" vec1 = "1" diff --git a/transports/sip/src/sip.rs b/transports/sip/src/sip.rs index c5f3cab9..a16ca9ba 100644 --- a/transports/sip/src/sip.rs +++ b/transports/sip/src/sip.rs @@ -8,7 +8,7 @@ use crate::processor::Processor; use self::{ processor::{register::RegisterProcessor, ProcessorAction, ProcessorError}, sip_request::SipRequest, - sip_response::SipResponse, + sip_response::SipResponse, utils::CallId2, }; mod data; @@ -18,7 +18,7 @@ pub mod sip_response; mod transaction; mod utils; -pub type GroupId = (SocketAddr, CallId); +pub type GroupId = (SocketAddr, CallId2); pub enum SipMessage { Request(SipRequest), @@ -102,7 +102,7 @@ impl SipCore { pub fn on_req(&mut self, now_ms: u64, from: SocketAddr, req: SipRequest) -> Result<(), SipServerError> { match req.method() { Method::Register => { - let group_id: (SocketAddr, CallId) = (from, req.call_id.clone()); + let group_id: (SocketAddr, CallId2) = (from, req.call_id.clone().into()); match self.register_processors.entry(group_id.clone()) { std::collections::hash_map::Entry::Occupied(mut entry) => { entry.get_mut().on_req(now_ms, req).map_err(|e| SipServerError::ProcessorError(e))?; @@ -117,7 +117,7 @@ impl SipCore { Ok(()) } Method::Invite => { - let group_id: (SocketAddr, CallId) = (from, req.call_id.clone()); + let group_id: (SocketAddr, CallId2) = (from, req.call_id.clone().into()); if let Some(_) = self.invite_in_groups.get(&group_id) { self.actions.push(SipServerEvent::OnInCallRequest(group_id, req)); Ok(()) @@ -128,7 +128,7 @@ impl SipCore { } } _ => { - let group_id: (SocketAddr, CallId) = (from, req.call_id.clone()); + let group_id: (SocketAddr, CallId2) = (from, req.call_id.clone().into()); if let Some(_) = self.invite_in_groups.get(&group_id) { self.actions.push(SipServerEvent::OnInCallRequest(group_id, req)); Ok(()) @@ -143,7 +143,7 @@ impl SipCore { } pub fn on_res(&mut self, _now_ms: u64, from: SocketAddr, res: SipResponse) -> Result<(), SipServerError> { - let group_id: (SocketAddr, CallId) = (from, res.call_id.clone()); + let group_id: (SocketAddr, CallId2) = (from, res.call_id.clone().into()); if let Some(_) = self.invite_in_groups.get(&group_id) { self.actions.push(SipServerEvent::OnInCallResponse(group_id, res)); Ok(()) @@ -159,7 +159,7 @@ impl SipCore { self.actions.pop() } - fn process_register_processor(&mut self, group_id: &(SocketAddr, CallId)) -> Option<()> { + fn process_register_processor(&mut self, group_id: &(SocketAddr, CallId2)) -> Option<()> { let processor = self.register_processors.get_mut(group_id)?; while let Some(action) = processor.pop_action() { match action { diff --git a/transports/sip/src/sip/utils.rs b/transports/sip/src/sip/utils.rs index 0c2d515e..bd8f6e15 100644 --- a/transports/sip/src/sip/utils.rs +++ b/transports/sip/src/sip/utils.rs @@ -1,5 +1,45 @@ use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; +use rsip::headers::CallId; + +#[derive(Debug, PartialEq, Eq, Hash, Clone)] +pub struct CallId2(pub String); + +impl From<&str> for CallId2 { + fn from(s: &str) -> Self { + CallId2(s.to_string()) + } +} + +impl From for CallId2 { + fn from(s: String) -> Self { + CallId2(s) + } +} + +impl From for String { + fn from(call_id: CallId2) -> Self { + call_id.0 + } +} + +impl From<&CallId2> for String { + fn from(call_id: &CallId2) -> Self { + call_id.0.clone() + } +} + +impl CallId2 { + pub fn new() -> Self { + Self(generate_random_string(16)) + } +} + +impl From for CallId2 { + fn from(call_id: CallId) -> Self { + Self(call_id.to_string()) + } +} pub fn generate_random_string(length: usize) -> String { let rng = thread_rng(); diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index 716c2cad..6e775b17 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -14,7 +14,7 @@ async-std = { workspace = true } async-trait = { workspace = true } media-utils = { workspace = true } poem-openapi = { version = "*", features = ["swagger-ui"] } -str0m = { git = "https://github.com/8xff/str0m.git", rev = "fe2c7a13b8d4314a40494039a20d06cb49d92c57"} +str0m = { version = "0.1.0", package = "atm0s-custom-str0m" } futures = { workspace = true } log = { workpsace = true } serde = { workspace = true }