SIP transactions and dialogs

来源:互联网 发布:javascript动画教程 编辑:程序博客网 时间:2024/05/22 17:20

理解事务(transaction)和对话(dialog)之间的区别是非常重要的。因为我们将在OpenSIPS脚本中使用它们。例如,有键值对属性依附于事务,有对话变量依附于对话。如果你不能识别对话和变量,那么你将很难配置SIP服务器。

transactions and dialogs

A transaction occurs between a user agent client and server and comprises of all the messages from the request to the final response (including all the interim responses).The responses can be provisional, starting with one followed by two digits (for example, 180 Ringing) or final, starting with two followed by two digits (for example, 200 OK). The scope of a transaction is defined by the stack of Via headers of the SIP messages. So, the user agents, after the initial invite, don’t need to rely on DNS or location tables to route the messages.

The ACK request is a special case. For positive replies (2XX), the UAC creates a new transaction and generates a new Contact header and it can be sent straight to the UAS bypassing the proxy. However, for negative replies, it belongs to the INVITE transaction because it is not possible to create a new transaction without the Contact of the other part. In this case, the request is sent to the same proxy as INVITE.

Dialog(对话)对话是两个UAs(user agent) 之间持续一段时间的端到端(peer-to-peer)的SIP 关系. 一个对话由一个Call-ID, 一个local tag 和 一个remote tag来标识.对话过去也叫做 “call leg”。对话的建立是收到UAS的响应(To tag)时开始建立的。收到180响应时建立dialog叫做早期对话(early dialog),收到2XX的应答开始才是真正的dialog建立。

A dialog is a succession of transactions that control the creation, existence, and termination of the dialog. All dialogs do have a transaction to create them and may (or may not) have a transaction to change the dialog (mid-transaction). Additionally,the end-dialog transaction may be missing. (Some dialogs do end based on timeouts rather than on explicit termination.)

按照 rfc3665 的描述,有 11 个基本的会话建立流程。其列出的并不一定是完整的,但是覆盖了最好的例子。前两个流程在这一章节中进行了阐述——成功建立会话 Successful Session Establishment和通过两个代理建立会话 Session Establishment Through Two Proxies。其它的一些将在第11章Implementing SIP Servers中见到。


1 0