diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 09fe09defc..d1dde740db 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -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 @@ -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; diff --git a/src/switch_core.c b/src/switch_core.c index baed1783e6..d3150835c0 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -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); diff --git a/src/switch_event.c b/src/switch_event.c index aa0ea7ee88..8b8d57250c 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -223,6 +223,7 @@ static char *EVENT_NAMES[] = { "CALL_DETAIL", "DEVICE_STATE", "TEXT", + "SHUTDOWN_REQUESTED", "ALL" };