Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
eddie murphy committed Dec 22, 2024
1 parent 19d43db commit 4bec8a1
Show file tree
Hide file tree
Showing 6 changed files with 2,359 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions content/kamailio/msg-flow/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: "路由执行的顺序"
date: "2024-12-22 16:20:42"
draft: false
type: posts
tags:
- all
categories:
- all
---

# 1. 请求消息处理过程

请求可以

- 直接丢弃,不返回任何响应。对于恶意请求,SIP Flood攻击,最好不要返回任何响应。
- 直接返回状态码,不做转发,例如直接返回301重定向
- 无状态转发
- 有状态转发
- 执行分支路由,分支路由也可以将消息丢弃
- 无论有无状态,请求发出去前都会执行onsend_route路由,在onsend_route内部,已经不能对SIP消息再做拦截


![](atta/2024-12-22-17-46-29.png)

# 2. 响应消息处理过程

- 首先执行reply_route{}, 在这个路由里可以将消息丢弃
- 然后判断消息是否有状态的
- 有状态,这执行onreply_route[ID]路由
- 如果响应是失败的,还可以执行failure_route[ID], 当前前提是在请求路由里是否设置了钩子
- 在失败路由可以,可以再次设置新的目标地址,进行转发; 设置了新的目标地址后,还可以设置分支路由

{{< notice tip >}}
这里要注意的是,响应路由在失败路由之前执行。
{{< /notice >}}

![](atta/2024-12-22-17-47-27.png)

# 3. 重传处理

![](atta/2024-12-22-17-49-19.png)
3 changes: 3 additions & 0 deletions static/js/mermaid.min.1.js

Large diffs are not rendered by default.

2,317 changes: 2,314 additions & 3 deletions static/js/mermaid.min.js

Large diffs are not rendered by default.

0 comments on commit 4bec8a1

Please sign in to comment.