11 Querying for Capabilities 11查询功能 The SIP method OPTIONS allows a UA to query another UA or a proxy server as to its capabilities. This allows a client to discover information about the supported methods, content types, extensions, codecs, etc. without "ringing" the other party. For example, before a client inserts a Require header field into an INVITE listing an option that it is not certain the destination UAS supports, the client can query the destination UAS with an OPTIONS to see if this option is returned in a Supported header field. All UAs MUST support the OPTIONS method. SIP方法OPTIONS允许UA向另一UA或代理服务器查询其能力。这允许客户端发现有关支持的方法、内容类型、扩展、编解码器等的信息,而无需“打电话”给另一方。例如,在客户端将Require报头字段插入INVITE(列出不确定目标UAS是否支持的选项)之前,客户端可以使用OPTIONS查询目标UAS,查看是否在Supported报头字段中返回此选项。所有UA都必须支持OPTIONS方法。 The target of the OPTIONS request is identified by the Request-URI, which could identify another UA or a SIP server. If the OPTIONS is addressed to a proxy server, the Request-URI is set without a user part, similar to the way a Request-URI is set for a REGISTER request.
OPTIONS请求的目标由请求URI标识,该URI可以标识另一个UA或SIP服务器。如果OPTIONS寻址到代理服务器,则设置请求URI时不包含用户部分,类似于为REGISTER请求设置请求URI的方式。
Alternatively, a server receiving an OPTIONS request with a Max-Forwards header field value of 0 MAY respond to the request regardless of the Request-URI. 或者,接收到最大转发报头字段值为0的OPTIONS请求的服务器可以响应该请求,而不考虑请求URI。 This behavior is common with HTTP/1.1. This behavior can be used as a "traceroute" functionality to check the capabilities of individual hop servers by sending a series of OPTIONS requests with incremented Max-Forwards values. 这种行为在HTTP/1.1中很常见。此行为可用作“traceroute”功能,通过发送一系列具有递增的最大转发值的OPTIONS请求来检查单个跃点服务器的功能。 As is the case for general UA behavior, the transaction layer can return a timeout error if the OPTIONS yields no response. This may indicate that the target is unreachable and hence unavailable. 与一般UA行为的情况一样,如果OPTIONS没有产生响应,事务层可能会返回超时错误。这可能表明该目标是不可到达的,因此是不可用的。 An OPTIONS request MAY be sent as part of an established dialog to query the peer on capabilities that may be utilized later in the dialog.
OPTIONS请求可以作为已建立的对话的一部分发送,以向对等方查询稍后可以在对话中使用的能力。