SIP 客户端应向邀请发送回复的位置

  • 本文关键字:回复 位置 客户端 SIP sip
  • 更新时间 :
  • 英文 :


假设有一个 SIP 客户端在侦听 100.0.0.100:5059。

它接收来自 10.0.0.101:5060 的 UDP 数据包,其中包含带有某些标头的邀请。例如:

  • Contact: <sip:100.0.0.102:5060>
  • Record-Route: <sip:100.0.0.103:5060>(此类标头的第一个)
  • Route: <sip:100.0.0.104:5060>
  • Via: <sip:100.0.0.105:5060>(此类标头中的第一个)

它应该在哪里发送"ACK"、"Tryinng"、"Dialog Establishment"、"BYE"等东西?100.0.0.什么?

(背景:试图编写"单个TCP连接中的整个SIP"包装器,将SIP中看到的所有地址转换为自身,但出现"请求超时","检测到循环","中继frobidden"错误,使对话仅持续15秒...可能是因为包装器做错了什么...为什么标头和应用程序/sdp?..)中有这么多各种令人困惑的IP地址)。

RFC 3261 第 18.2.2 节告诉您该怎么做。算法中的第三步是适用的步骤:

  o  Otherwise (for unreliable unicast transports), if the top Via
     has a "received" parameter, the response MUST be sent to the
     address in the "received" parameter, using the port indicated
     in the "sent-by" value, or using port 5060 if none is specified
     explicitly.  If this fails, for example, elicits an ICMP "port
     unreachable" response, the procedures of Section 5 of [4]
     SHOULD be used to determine where to send the response.
  o  Otherwise, if it is not receiver-tagged, the response MUST be
     sent to the address indicated by the "sent-by" value, using the
     procedures in Section 5 of [4].

[4]指的是这里。

通过 TCP 接收请求是一种更简单的情况:如果可以,您可以通过打开的连接发送请求。否则,您可以在最顶层Viareceived 参数中打开与 IP 地址的 TCP 连接(如果存在),或者如果不存在,则打开该标头的sent-by令牌。如果该尝试失败,则必须回退到上述 RFC 3263 中的算法。

最新更新