Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 1.66 KB

sip.js.useragent.stop.md

File metadata and controls

37 lines (24 loc) · 1.66 KB

Home > sip.js > UserAgent > stop

UserAgent.stop() method

Stop the user agent.

Signature:

stop(): Promise<void>;

Returns:

Promise<void>

Remarks

Resolves when the user agent has completed a graceful shutdown.

1) Sessions terminate.
2) Registerers unregister.
3) Subscribers unsubscribe.
4) Publishers unpublish.
5) Transport disconnects.
6) User Agent Core resets.

The user agent state transistions to stopped once these steps have been completed. Calling start() after calling stop() will fail if stop() has yet to resolve.

NOTE: While this is a "graceful shutdown", it can also be very slow one if you are waiting for the returned Promise to resolve. The disposal of the clients and dialogs is done serially - waiting on one to finish before moving on to the next. This can be slow if there are lot of subscriptions to unsubscribe for example.

THE SLOW PACE IS INTENTIONAL! While one could spin them all down in parallel, this could slam the remote server. It is bad practice to denial of service attack (DoS attack) servers!!! Moreover, production servers will automatically blacklist clients which send too many requests in too short a period of time - dropping any additional requests.

If a different approach to disposing is needed, one can implement whatever is needed and execute that prior to calling stop(). Alternatively one may simply not wait for the Promise returned by stop() to complete.