SIP protocol specification RFC3261 Chinese sharing
9 canceling a request
in the previous chapter, we have discussed the processing flow of standard UA, including the request generated by the request of method and the processing response flow. In this chapter, we discuss cancel, which is a purposeful method
cancel request is the same as its name. It is used to cancel the previous request sent by the client. Specifically, it requires UAS to exit the previous request and generate an error response to that request. If UAS has generated a final response reply for a request, then it is invalid for cancel to send a cancellation for the request again. For this reason, most cancel requests take a long time for the server to respond. Therefore, for invite, which can be used as a reference for the plastic mold industry, using cancel is the best way, so that a response can be generated in a relatively long time. In the above use environment, when the UAS receiving the cancel request has not sent the final response, the UAS will process a stop ringing, and then send a special error response code (a 487) for this invite
both the proxy server and the user agent client can create and send cancel responses. Section 15 discusses the conditions for UAC to cancel the invite request, and section 16.10 discusses the details of the agent using cancel
the stateful agent responds to a cancel request instead of simply forwarding a response received from a downstream element. For that reason, cancel is regarded as a hop by hop request, because it is replied on the node of each stateful agent hop
9.1 client behavior
a cancel request can only be used to cancel an invite request, and should not be sent to cancel other requests
because other requests except invite requests will respond to this request immediately, sending a cancel request to a non invite request will always create a competitive condition
the following process is used to build a cancel request. The requests computer system in the cancel request must be confirmed through the digital part of the proprietary controller t-uri, call ID, to, cseq, and from header field values. These parameters, including tags, are in the canceled request. Only one via header value in the cancel built by the client must match the topmost via header field value in the canceled request. Using the same values in these header fields allows this cancel to match the request it is about to cancel. (Section 9.2 explains how matching occurs). However, the method part of this cseq header field must contain a value of cancel. Through such a process, as a transaction, within its authority, cancel can be fully confirmed and processed. (refer to section 17)
if the request being canceled contains a route header field value, the cancel request must include the value of that route header field
this requirement is a necessary condition. Through such processing requirements, the stateless agent can correctly route this cancel request
cancel requests must not contain any require or proxy require headers
once cancel is created, the client should check whether it receives any response message (temporary response or final response) for the request being cancelled (therefore, the request here is an original request)
if the client does not receive any temporary response, cancel must not be sent; Instead, the client must wait for the temporary response to arrive before sending the request. If the initial request has generated a final response, the request should not be sent. This is an invalid operation, because the cancel request has no effect on the initial request, and the request has generated a final response. When the client decides to send cancel, it creates a client transaction for the cancel, and then transmits the transaction, including the destination address, port and transmission method content associated with the cancel request. The destination address, port and transmission mode defined for this cancel request must be mutually confirmed with the initial request sent
before receiving the response of the previous request, if you are allowed to send cancel, the server can receive this cancel before the initial request includes greater design freedom, light weight, reduced product development cycle, etc
note that the two transactions - relative to the initial requested transaction and cancel transaction, are completed independently. However, a UAC that is processing a cancellation request cannot rely on the response -487 (end of request) to the initial request, because it needs to be consistent with RFC 2543, and UAS will not generate such a response. If the final response to the initial request is not received within 64 * T1 seconds,
the client should consider that the initial transaction can be cancelled, and should destroy the client transaction that is responsible for the initial request
9.2 server behavior
cancel method requires transaction users (TU) on the server side to cancel pending transactions. Tu decides whether to cancel the transaction by executing the cancel request. It is assumed that the request method is any method, but the transaction matching process can be applied to cancel or ack. The specific matching process is discussed in section 17.2.3. This matching transaction is one of the transactions that will be canceled
on the server side, the process of executing cancel requests completely depends on the server type. A stateless agent will forward the cancellation request. A stateful agent may have a response message, generate some of its own cancel requests, and then UAS replies to these responses. Refer to section 16.10 for the agent processing method of cancel
according to the standard UAS processing method, UAS first processes the cancel request. The specific processing method is described in Section 8.2. However, because the cancel request is handled in a hop by hop manner, it cannot be resubmitted. The server will not verify that it has obtained security verification in the authorization header. The message requires that the material cannot change color. Note that the cancel request also does not contain the require header field
according to the above processing flow, if UAS does not find a matching transaction for cancel, it should respond to this cancel with a 481 error code (call leg/transaction does not exist). If the transaction associated with the initial request still exists, the execution method of the UAC receiving the cancel request depends on whether the UAC has sent the final response to the associated initial request. If the final response has been sent, the cancel request has no impact on the initial request processing, any session state, and the response generated by the initial request. If the UAS does not send the final response, the processing flow of the UAS depends on the method of the initial request. Further, if the initial request is an invite method, the UAS should immediately reply to the invite with a 487 error code (request terminated). Cancel requests will not affect transactions generated by other methods defined in this specification, but only those generated by their own methods
regardless of the method of the initial request, as long as the cancel matches an existing transaction, the UAS should respond to the cancel itself and return a 200 (OK) response. This response message is created through the following process. Refer to section 8.2.6 for the specific creation process. It should be noted here that for cancel, the to tag in this response and the to tag in the response in the initial request should be the same. The reply response of the cancel is passed to the transaction processing of the server for transmission
continue to release
follow official account: asterisk CN, get valuable asterisk industry sharing
asterisk freepbx, freesbc technical documents:
integrated communication business solutions, collaborative solutions preferred products:
asterisk/freepbx/freesbc Chinese partners, official technology sharing group (3000 people):
LINK
Copyright © 2011 JIN SHI