Home > sip.js > SessionDialog > bye
Terminating a Session
This section describes the procedures for terminating a session established by SIP. The state of the session and the state of the dialog are very closely related. When a session is initiated with an INVITE, each 1xx or 2xx response from a distinct UAS creates a dialog, and if that response completes the offer/answer exchange, it also creates a session. As a result, each session is "associated" with a single dialog - the one which resulted in its creation. If an initial INVITE generates a non-2xx final response, that terminates all sessions (if any) and all dialogs (if any) that were created through responses to the request. By virtue of completing the transaction, a non-2xx final response also prevents further sessions from being created as a result of the INVITE. The BYE request is used to terminate a specific session or attempted session. In this case, the specific session is the one with the peer UA on the other side of the dialog. When a BYE is received on a dialog, any session associated with that dialog SHOULD terminate. A UA MUST NOT send a BYE outside of a dialog. The caller's UA MAY send a BYE for either confirmed or early dialogs, and the callee's UA MAY send a BYE on confirmed dialogs, but MUST NOT send a BYE on early dialogs.
However, the callee's UA MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out. If no SIP extensions have defined other application layer states associated with the dialog, the BYE also terminates the dialog.
https://tools.ietf.org/html/rfc3261\#section-15 FIXME: Make these proper Exceptions...
Signature:
bye(delegate?: OutgoingRequestDelegate, options?: RequestOptions): OutgoingByeRequest;
Parameter | Type | Description |
---|---|---|
delegate | OutgoingRequestDelegate | |
options | RequestOptions | BYE options bucket. |
Returns:
Throws Error
if callee's UA attempts a BYE on an early dialog. Throws Error
if callee's UA attempts a BYE on a confirmed dialog while it's waiting on the ACK for its 2xx response.