MCPcopy Create free account
hub / github.com/619dev/minghe / extract_status_code

Function extract_status_code

src/sip/parser.rs:386–400  ·  view source on GitHub ↗

提取响应状态码 从 SIP 响应消息的第一行提取状态码

(msg: &str)

Source from the content-addressed store, hash-verified

384///
385/// 从 SIP 响应消息的第一行提取状态码
386pub fn extract_status_code(msg: &str) -> Option<u16> {
387 let first_line = msg.lines().next()?;
388 let trimmed = first_line.trim();
389
390 if !trimmed.starts_with("SIP/2.0") {
391 return None;
392 }
393
394 let parts: Vec<&str> = trimmed.split_whitespace().collect();
395 if parts.len() >= 2 {
396 parts[1].parse().ok()
397 } else {
398 None
399 }
400}
401
402/// 提取 Via 分支参数
403pub fn extract_via_branch(msg: &str) -> Option<String> {

Callers 2

process_sip_messageFunction · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected