]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core] add SCSC_SHUTDOWN_CAUSE
authorChris Rienzo <chris@signalwire.com>
Wed, 6 May 2020 15:46:57 +0000 (11:46 -0400)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 18:59:56 +0000 (21:59 +0300)
src/include/private/switch_core_pvt.h
src/include/switch_types.h
src/switch_core.c

index 388813701f8d8d027391b47d28aba32aa643d8a3..a69c3173cc9c51c8c190b08ca2ace6798a1cb025 100644 (file)
@@ -305,6 +305,7 @@ struct switch_runtime {
        uint32_t port_alloc_flags;
        char *event_channel_key_separator;
        uint32_t max_audio_channels;
+       switch_call_cause_t shutdown_cause;
 };
 
 extern struct switch_runtime runtime;
index 4757ed1c3abbe75ff4fef27243003bdee6d592c5..7217a207a4997476a7d413702ef62d1c644667e7 100644 (file)
@@ -2292,7 +2292,8 @@ typedef enum {
        SCSC_SPS_PEAK_FIVEMIN,
        SCSC_SESSIONS_PEAK,
        SCSC_SESSIONS_PEAK_FIVEMIN,
-       SCSC_MDNS_RESOLVE
+       SCSC_MDNS_RESOLVE,
+       SCSC_SHUTDOWN_CAUSE
 } switch_session_ctl_t;
 
 typedef enum {
index 81b6de762be6490a8209fe466633b8d26a791866..c3ddc5124e57236e9b533f25bbdd5cfac9be9ee0 100644 (file)
@@ -1857,6 +1857,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
        memset(&runtime, 0, sizeof(runtime));
        gethostname(runtime.hostname, sizeof(runtime.hostname));
 
+       runtime.shutdown_cause = SWITCH_CAUSE_SYSTEM_SHUTDOWN;
        runtime.max_db_handles = 50;
        runtime.db_handle_timeout = 5000000;
        runtime.event_heartbeat_interval = 20;
@@ -3013,6 +3014,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
        case SCSC_MDNS_RESOLVE:
                switch_core_media_set_resolveice(!!oldintval);
                break;
+       case SCSC_SHUTDOWN_CAUSE:
+               runtime.shutdown_cause = oldintval;
+               break;
        }
 
        if (intval) {
@@ -3068,7 +3072,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
        switch_set_flag((&runtime), SCF_SHUTTING_DOWN);
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
-       switch_core_session_hupall(SWITCH_CAUSE_SYSTEM_SHUTDOWN);
+       switch_core_session_hupall(runtime.shutdown_cause);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
 
        switch_loadable_module_shutdown();