[core] Add SHUTDOWN_REQUESTED event. Bind to this event to know when ASAP or elegant shutdown has been requested.
This commit is contained in:
parent
9248aa05ec
commit
562079376a
|
@ -2048,6 +2048,7 @@ typedef uint32_t switch_io_flag_t;
|
|||
SWITCH_EVENT_CALL_SETUP_RESULT
|
||||
SWITCH_EVENT_CALL_DETAIL
|
||||
SWITCH_EVENT_DEVICE_STATE
|
||||
SWITCH_EVENT_SHUTDOWN_REQUESTED - Shutdown of the system has been requested
|
||||
SWITCH_EVENT_ALL - All events at once
|
||||
</pre>
|
||||
|
||||
|
@ -2143,6 +2144,7 @@ typedef enum {
|
|||
SWITCH_EVENT_CALL_DETAIL,
|
||||
SWITCH_EVENT_DEVICE_STATE,
|
||||
SWITCH_EVENT_TEXT,
|
||||
SWITCH_EVENT_SHUTDOWN_REQUESTED,
|
||||
SWITCH_EVENT_ALL
|
||||
} switch_event_types_t;
|
||||
|
||||
|
|
|
@ -2809,7 +2809,11 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
|
|||
{
|
||||
int x = 19;
|
||||
uint32_t count;
|
||||
|
||||
switch_event_t *shutdown_requested_event = NULL;
|
||||
if (switch_event_create(&shutdown_requested_event, SWITCH_EVENT_SHUTDOWN_REQUESTED) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(shutdown_requested_event, SWITCH_STACK_BOTTOM, "Event-Info", "%s", cmd == SCSC_SHUTDOWN_ASAP ? "ASAP" : "elegant");
|
||||
switch_event_fire(&shutdown_requested_event);
|
||||
}
|
||||
switch_set_flag((&runtime), SCF_SHUTDOWN_REQUESTED);
|
||||
if (cmd == SCSC_SHUTDOWN_ASAP) {
|
||||
switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
|
||||
|
|
|
@ -223,6 +223,7 @@ static char *EVENT_NAMES[] = {
|
|||
"CALL_DETAIL",
|
||||
"DEVICE_STATE",
|
||||
"TEXT",
|
||||
"SHUTDOWN_REQUESTED",
|
||||
"ALL"
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue