diff --git a/main/asterisk.c b/main/asterisk.c index 73d390fad2..eb403e97ff 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1140,6 +1140,7 @@ static void publish_system_message(const char *message_type, struct ast_json *ob return; } + ast_json_ref(obj); event_info = ast_json_pack("{s: s, s: i, s: o}", "type", message_type, "class_type", EVENT_FLAG_SYSTEM, @@ -2007,10 +2008,15 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart) } } active_channels = ast_active_channels(); - json_object = ast_json_pack("{s: s, s: s}", - "Shutdown", active_channels ? "Uncleanly" : "Cleanly", - "Restart", restart ? "True" : "False"); - publish_system_message("Shutdown", json_object); + /* Don't publish messages if we're a remote console - we won't have all of the Stasis + * topics or message types + */ + if (!ast_opt_remote) { + json_object = ast_json_pack("{s: s, s: s}", + "Shutdown", active_channels ? "Uncleanly" : "Cleanly", + "Restart", restart ? "True" : "False"); + publish_system_message("Shutdown", json_object); + } ast_verb(0, "Asterisk %s ending (%d).\n", active_channels ? "uncleanly" : "cleanly", num); diff --git a/main/devicestate.c b/main/devicestate.c index afa9621d31..f331b1d19f 100644 --- a/main/devicestate.c +++ b/main/devicestate.c @@ -784,6 +784,9 @@ static void devstate_exit(void) int devstate_init(void) { + if (STASIS_MESSAGE_TYPE_INIT(ast_device_state_message_type) != 0) { + return -1; + } device_state_topic_all = stasis_topic_create("ast_device_state_topic"); if (!device_state_topic_all) { return -1; @@ -792,9 +795,6 @@ int devstate_init(void) if (!device_state_topic_cached) { return -1; } - if (STASIS_MESSAGE_TYPE_INIT(ast_device_state_message_type) != 0) { - return -1; - } device_state_topic_pool = stasis_topic_pool_create(ast_device_state_topic_all()); if (!device_state_topic_pool) { return -1; diff --git a/res/res_fax.c b/res/res_fax.c index 4b8c9d7ca9..4b942e5245 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -2246,7 +2246,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det */ static int report_send_fax_status(struct ast_channel *chan, struct ast_fax_session_details *details) { - RAII_VAR(struct ast_json *, json_obj, NULL, ao2_cleanup); + RAII_VAR(struct ast_json *, json_obj, NULL, ast_json_unref); RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup); struct ast_json *json_filenames; @@ -2257,7 +2257,7 @@ static int report_send_fax_status(struct ast_channel *chan, struct ast_fax_sessi { SCOPED_CHANNELLOCK(lock, chan); - json_obj = ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: s, s: s, s: o}", + json_obj = ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: s, s: o}", "type", "send" "remote_station_id", S_OR(pbx_builtin_getvar_helper(chan, "REMOTESTATIONID"), ""), "local_station_id", S_OR(pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"), ""),