From 98cdf66e0f0344959e622e3b31914d27c8bf33ee Mon Sep 17 00:00:00 2001 From: yeoleobun Date: Tue, 16 Dec 2025 10:11:11 +0800 Subject: [PATCH] use locator for sip over websocket --- src/transaction/transaction.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/transaction/transaction.rs b/src/transaction/transaction.rs index 35fd0a9..b69c3bc 100644 --- a/src/transaction/transaction.rs +++ b/src/transaction/transaction.rs @@ -470,7 +470,16 @@ impl Transaction { if let Some(resp) = self.last_response.as_ref() { if resp.status_code.kind() == StatusCodeKind::Successful { // 2xx response, set destination from request - if let Some(dest) = destination_from_request(req) { + if let Some(mut dest) = destination_from_request(req) { + // for sip over websocket, query locator with contact address + if dest.addr.host.to_string().ends_with("invalid") { + let contact = resp.contact_header()?; + let uri = contact.uri()?; + if let Some(locator) = self.endpoint_inner.locator.as_ref() { + dest = locator.locate(&uri).await?; + } + } + let (conn, addr) = self .endpoint_inner .transport_layer