要彻底明白三者之间的区别,首先得弄清楚三者的定义是什么?(见rfc3261)
via:
The Via header field indicates the path taken by the request so far and indicates the path that should be followed in routing responses. The branch ID parameter in the Via header field values serves as a transaction identifier, and is used by proxies to detect loops.
Route:
The Route header field is used to force routing for a request through the listed set of proxies. Examples of the use of the Route header field are in Section 16.12.1.
Record-Route:
via:
The Via header field indicates the path taken by the request so far and indicates the path that should be followed in routing responses. The branch ID parameter in the Via header field values serves as a transaction identifier, and is used by proxies to detect loops.
Route:
The Route header field is used to force routing for a request through the listed set of proxies. Examples of the use of the Route header field are in Section 16.12.1.
Record-Route:
The Record-Route header field is inserted by proxies in a request to force future requests in the dialog to be routed through the proxy.
简单来说,via的作用就是标记请求所经过的节点,好让其对应的响应能按照via标记好的路径返回回去;Route set(一个请求或应答中可以包含多个Route标记,这些Route标记称为Route Set)的作用是强制请求必须从Route set中设定的节点通过,Route set的生成可以是手动配置也可以是协议自己生成,需要手动配置的情况如,客户端向registar注册的时候,registar的路径就应该是通过手动配置,协议自己生成的情况如在对话生成前各个proxy往请求中添加Record-Route为了让后续的请求能继续通过该proxy发送,当对话建立好后就确定了后续的请求该走的路由,之后将Record-Route中的记录登记在Route set中来强制请求的路由。