About question 1. If you send CANCEL before you have received any 1xx message you might end up that the other end receive the CANCEL before it receives the INVITE for which the CANCEL message is supposed to CANCEL.
If you wait until AFTER you have received a 1xx message (even 100 Trying) you are sure that the other end (nearest hop) has received the INVITE and thus are able to CANCEL the message. Also, if you receive a 200 OK instead of a 1xx message it is too late to send CANCEL - in that case you have to send ACK and then BYE to cancel the INVITE. If you receive an error response instead of 1xx such as 4xx or 5xx response then you can just send ACK within the transaction and no CANCEL is necessary - the request did not result in any dialog. So, if you get 2xx or higher responses you should not send CANCEL at all and so you must wait until you get 1xx before you try to send any CANCEL. If you intend to send CANCEL but have not yet received any response you must first wait to see what that response is and only send CANCEL if the response is 1xx. If it is 2xx you must send ACK then BYE and if it is 3xx or higher you only have to send ACK. It is only when you get 1xx that you actually send CANCEL to cancel the INVITE. About question 2. CANCEL is a message to cancel a request that has been initiated but not yet completed. Since INVITE is the only message that has a three-way handshake it is the only message that can be CANCELed. For any other message such as OPTION you receive a response and any response imply that the request has been completed (either accepted with a 2xx response or rejected with a suitable error response). In neither of those cases is CANCEL necessary nor suitable. Since you are not supposed to get 1xx responses from non-INVITE neither should you bother with CANCEL to cancel them. Hope this answers your questions. Alf On Mon, 2006-09-25 at 15:39 +0530, jafer sharif mohammed wrote: > HI, > I have list of two questions for clarification with explanation. > > > 1. why should CANCEL message shouldn't sent prior to arrival of 1XX > response. > 2. why will there be a race condition if CANCEL message is send to > non-invite message. > > > > waiting for reply. > jafer. > _______________________________________________ > Sip-implementors mailing list > [email protected] > https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors _______________________________________________ Sip-implementors mailing list [email protected] https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors
