RFC3261: SIP:12对话

12 Dialogs
12对话

   A key concept for a user agent is that of a dialog.  A dialog represents a peer-to-peer SIP relationship between two user agents that persists for some time.  The dialog facilitates sequencing of messages between the user agents and proper routing of requests between both of them.  The dialog represents a context in which to interpret SIP messages.  Section 8 discussed method independent UA processing for requests and responses outside of a dialog.  This section discusses how those requests and responses are used to construct a dialog, and then how subsequent requests and responses are sent within a dialog.

​用户代理的一个关键概念是对话。对话表示两个用户代理之间持续一段时间的对等SIP关系。该对话便于在用户代理之间对消息进行排序,并便于在两者之间正确路由请求。该对话表示用于解释SIP消息的上下文。第8节讨论了对话之外的请求和响应的独立于方法的UA处理。本节讨论如何使用这些请求和响应来构建对话,以及如何在对话中发送后续请求和响应。

   A dialog is identified at each UA with a dialog ID, which consists of a Call-ID value, a local tag and a remote tag.  The dialog ID at each UA involved in the dialog is not the same.  Specifically, the local tag at one UA is identical to the remote tag at the peer UA.  The tags are opaque tokens that facilitate the generation of unique dialog IDs.

在每个UA处用一个对话ID标识一个对话,该对话由一个呼叫ID值、一个本地标签和一个远程标签组成。对话中涉及的每个UA的对话ID不相同。具体而言,一个UA的本地标签与对等UA的远程标签相同。这些标签是不透明的令牌,有助于生成唯一的对话ID。

   A dialog ID is also associated with all responses and with any request that contains a tag in the To field.  The rules for computing the dialog ID of a message depend on whether the SIP element is a UAC or UAS.  For a UAC, the Call-ID value of the dialog ID is set to the Call-ID of the message, the remote tag is set to the tag in the To field of the message, and the local tag is set to the tag in the From field of the message (these rules apply to both requests and responses).  As one would expect for a UAS, the Call-ID value of the dialog ID is set to the Call-ID of the message, the remote tag is set to the tag in the From field of the message, and the local tag is set to the tag in the To field of the message.

对话ID还与所有响应以及“To”字段中包含标记的任何请求相关联。用于计算消息的对话ID的规则取决于SIP元素是UAC还是UAS。对于UAC,对话ID的呼叫ID值设置为消息的呼叫ID,远程标记设置为消息“To”字段中的标记,本地标记设置为消息“From”字段中(这些规则适用于请求和响应)的标记。正如人们对UAS所期望的那样,对话ID的呼叫ID值被设置为消息的呼叫ID,远程标记被设置为该消息的From字段中的标记,本地标记被设置成该消息的to字段中的标签。

   A dialog contains certain pieces of state needed for further message transmissions within the dialog.  This state consists of the dialog ID, a local sequence number (used to order requests from the UA to its peer), a remote sequence number (used to order requests from its peer to the UA), a local URI, a remote URI, remote target, a boolean flag called "secure", and a route set, which is an ordered list of URIs.  The route set is the list of servers that need to be traversed to send a request to the peer.  A dialog can also be in the "early" state, which occurs when it is created with a provisional response, and then transition to the "confirmed" state when a 2xx final response arrives.  For other responses, or if no response arrives at all on that dialog, the early dialog terminates.

对话包含在对话中进一步传输消息所需的某些状态。此状态由对话ID、本地序列号(用于将请求从UA排序到对等方)、远程序列号(用来将请求从对等方排序到UA)、本地URI、远程URI、远程目标、称为“安全”的布尔标志和路由集组成,路由集是URI的有序列表。路由集是向对等方发送请求所需遍历的服务器列表。对话也可以处于“早期”状态,这发生在使用临时响应创建对话时,然后在2xx最终响应到达时转换到“已确认”状态。对于其他响应,或者如果该对话上根本没有响应,则早期对话终止。