SIP 关键词 ============ SIP 关键词以粘性缓冲区(sticky buffers)形式实现,可用于匹配 SIP 消息中的字段。 如 RFC3261 所述,通用头部字段名称可能以缩写形式表示。此类情况下,头部名称会被标准化为常规形式以便通过对应的粘性缓冲区进行匹配。 ============================== ================== 关键词 方向 ============================== ================== sip.method 请求 sip.uri 请求 sip.request_line 请求 sip.stat_code 响应 sip.stat_msg 响应 sip.response_line 响应 sip.protocol 双向 sip.from 双向 sip.to 双向 sip.via 双向 sip.user_agent 双向 sip.content_type 双向 sip.content_length 双向 ============================== ================== sip.method ---------- 该关键词匹配 SIP 请求中的方法字段。 语法 ~~~~~~ :: sip.method; content:; 典型方法示例: * INVITE * BYE * REGISTER * CANCEL * ACK * OPTIONS 示例 ~~~~~~~~ :: sip.method; content:"INVITE"; sip.uri ------- 该关键词匹配 SIP 请求中的 URI 字段。 语法 ~~~~~~ :: sip.uri; content:; 其中 为符合 SIP URI 架构的地址。 示例 ~~~~~~~~ :: sip.uri; content:"sip:sip.url.org"; sip.request_line ---------------- 该关键词强制检查完整的 SIP 请求行。 语法 ~~~~~~ :: sip.request_line; content:; 其中 可为部分或完整请求行。 示例 ~~~~~~~~ :: sip.request_line; content:"REGISTER sip:sip.url.org SIP/2.0" sip.stat_code ------------- 该关键词匹配 SIP 响应中的状态码。 语法 ~~~~~~ :: sip.stat_code; content: 其中 属于以下任一类状态码组: * 1xx - 临时响应 * 2xx - 成功响应 * 3xx - 重定向响应 * 4xx - 客户端错误响应 * 5xx - 服务器错误响应 * 6xx - 全局错误响应 示例 ~~~~~~~~ :: sip.stat_code; content:"100"; sip.stat_msg ------------ 该关键词匹配 SIP 响应中的状态消息。 语法 ~~~~~~ :: sip.stat_msg; content: 其中 为状态码关联的原因短语。 示例 ~~~~~~~~ :: sip.stat_msg; content:"Trying"; sip.response_line ----------------- 该关键词强制检查完整的 SIP 响应行。 语法 ~~~~~~ :: sip.response_line; content:; 其中 可为部分或完整响应行。 示例 ~~~~~~~~ :: sip.response_line; content:"SIP/2.0 100 OK" sip.protocol ------------ 该关键词匹配 SIP 请求或响应行中的协议字段。 若响应行为 'SIP/2.0 100 OK',则该缓冲区将包含 'SIP/2.0' 语法 ~~~~~~ :: sip.protocol; content: 其中 为 SIP 协议版本。 示例 ~~~~~~~ :: sip.protocol; content:"SIP/2.0" sip.from -------- 该关键词匹配 SIP 头部中可能存在的 From 字段。 同时匹配常规形式和缩写形式,但无法区分二者。 语法 ~~~~~~ :: sip.from; content: 其中 为 From 头部的值。 示例 ~~~~~~~ :: sip.from; content:"user" sip.to ------ 该关键词匹配 SIP 头部中可能存在的 To 字段。 同时匹配常规形式和缩写形式,但无法区分二者。 语法 ~~~~~~ :: sip.to; content: 其中 为 To 头部的值。 示例 ~~~~~~~ :: sip.to; content:"user" sip.via -------- 该关键词匹配 SIP 头部中可能存在的 Via 字段。 同时匹配常规形式和缩写形式,但无法区分二者。 语法 ~~~~~~ :: sip.via; content: 其中 为 Via 头部的值。 示例 ~~~~~~~ :: sip.via; content:"SIP/2.0/UDP" sip.user_agent -------------- 该关键词匹配 SIP 头部中可能存在的 User-Agent 字段。 语法 ~~~~~~ :: sip.user_agent; content: 其中 为 User-Agent 头部的值。 示例 ~~~~~~~ :: sip.user_agent; content:"Asterisk" sip.content_type ---------------- 该关键词匹配 SIP 头部中可能存在的 Content-Type 字段。 同时匹配常规形式和缩写形式,但无法区分二者。 语法 ~~~~~~ :: sip.content_type; content: 其中 为 Content-Type 头部的值。 示例 ~~~~~~~ :: sip.content_type; content:"application/sdp" sip.content_length ------------------ 该关键词匹配 SIP 头部中可能存在的 Content-Length 字段。 同时匹配常规形式和缩写形式,但无法区分二者。 语法 ~~~~~~ :: sip.content_length; content: 其中 为 Content-Length 头部的值。 示例 ~~~~~~~ :: sip.content_length; content:"200"