diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-02-11 17:28:13 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-02-11 17:28:13 +0000 |
commit | feddab7944a12746bcbdb6fc82cc9d4951d61eb5 (patch) | |
tree | c2aafc025e36fccf736fd7dcfd1fd6650b995e5c /include/asterisk.h | |
parent | 29f3ff0b615bb0847727e2df45d5590f5f9ebcee (diff) |
HTTP: Stop accepting requests on final system shutdown.
There are three CLI commands to stop and restart Asterisk each.
1) core stop/restart now - Hangup all calls and stop or restart Asterisk.
New channels are prevented while the shutdown request is pending.
2) core stop/restart gracefully - Stop or restart Asterisk when there are
no calls remaining in the system. New channels are prevented while the
shutdown request is pending.
3) core stop/restart when convenient - Stop or restart Asterisk when there
are no calls in the system. New calls are not prevented while the
shutdown request is pending.
ARI has made stopping/restarting Asterisk more problematic. While a
shutdown request is pending it is desirable to continue to process ARI
HTTP requests for current calls. To handle the current calls while a
shutdown request is pending, a new committed to shutdown phase is needed
so ARI applications can deal with the calls until the system is fully
committed to shutdown.
* Added a new shutdown committed phase so ARI applications can deal with
calls until the final committed to shutdown phase is reached.
* Made refuse new HTTP requests when the system has reached the final
system shutdown phase. Starting anything while the system is actively
releasing resources and unloading modules is not a good thing.
* Split the bridging framework shutdown to not cleanup the global bridging
containers when shutting down in a hurry. This is similar to how other
modules prevent crashes on rapid system shutdown.
* Moved ast_begin_shutdown(), ast_cancel_shutdown(), and
ast_shutting_down(). You should not have to include channel.h just to
access these system functions.
ASTERISK-24752 #close
Reported by: Matthew Jordan
Review: https://reviewboard.asterisk.org/r/4399/
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431692 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk.h')
-rw-r--r-- | include/asterisk.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/asterisk.h b/include/asterisk.h index ee1a9c337..edb100b6b 100644 --- a/include/asterisk.h +++ b/include/asterisk.h @@ -111,6 +111,42 @@ int ast_register_cleanup(void (*func)(void)); */ void ast_unregister_atexit(void (*func)(void)); +/*! + * \brief Cancel an existing shutdown and return to normal operation. + * + * \note Shutdown can be cancelled while the server is waiting for + * any existing channels to be destroyed before shutdown becomes + * irreversible. + * + * \return non-zero if shutdown cancelled. + */ +int ast_cancel_shutdown(void); + +/*! + * \details + * The server is preventing new channel creation in preparation for + * shutdown and may actively be releasing resources. The shutdown + * process may be canceled by ast_cancel_shutdown() if it is not too + * late. + * + * \note The preparation to shutdown phase can be quite lengthy + * if we are gracefully shutting down. How long existing calls will + * last is not up to us. + * + * \return non-zero if the server is preparing to or actively shutting down. + */ +int ast_shutting_down(void); + +/*! + * \return non-zero if the server is actively shutting down. + * \since 13.3.0 + * + * \details + * The server is releasing resources and unloading modules. + * It won't be long now. + */ +int ast_shutdown_final(void); + #if !defined(LOW_MEMORY) /*! * \brief Register the version of a source code file with the core. |