preloaded route什么意思呢?
没有totag,并且有Route头,这就是了
用fs模拟下:
originate sofia/default/1001@192.168.1.100;fs_path=sip:192.168.1.200 &park
INVITE sip:1001@192.168.1.100 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.205;rport;branch=z9hG4bKeN6vy00rSg5FQ
Route: <sip:192.168.1.200>
Max-Forwards: 70
From: <sip:0000000000@192.168.1.205>;tag=Ujj1agKj25jye
To: <sip:1001@192.168.100.201>
Call-ID: 908ea203-0f07-4756-b9e2-bbababfde8b9
CSeq: 71834061 INVITE
Contact: <sip:mod_sofia@192.168.1.205:5060>
.
.
.
fs的地址是192.168.1.205
kamailio的地址是192.168.1.200,route指向kamailio
终端地址是192.168.1.100 ,$ru指向终端地址
对应的路由可以这样写:
# - remove preloaded route headers
remove_hf("Route");
if (!loose_route_preloaded()) {sl_send_reply("404", "Preloaded route expected");exit;
}route(RELAY); # 其实就是relay到$ru,192.168.1.100
为什么一定要 删除Route头呢?
Daniel是这样描述的:
Record-Route is added by proxies to requests creating dialogs to require
that the requests within the dialog will be sent through them. There
Record-Route headers become Route in within dialog requests. In other
words, Route forces next hop address and can be dangerous from security
point of view if not trusted, Record-Route is just to carry some
addresses for later usage, no immediate impact in routing of that request.
可以参考这里:
https://lists.kamailio.org/pipermail/sr-users/2012-June/073781.html
一般的场景是这样的:
register---kamailio(add path)---fs
fs ---invite(with route)---kamailio
书不能不读,但是要真的全部读明白,不容易