cli: Prevent assertions on startup from bad ao2 refs.

If "core show channels" is run before startup has completed, it
is possible for bad ao2 refs to occur because the system is not
yet fully initialized. This will lead to an assertion failing.

To prevent this, initialization of CLI builtins is moved to be
later along in the main load sequence. Core CLI commands are
loaded at the same time, but channel-related commands are loaded
later on.

ASTERISK-29846 #close

Change-Id: If6b3cde802876bd738c1b4cf2683bea6ddc615b6
This commit is contained in:
Naveen Albert
2022-05-03 12:53:28 +00:00
committed by Friendly Automation
parent a0713a9f70
commit c7612521be
3 changed files with 23 additions and 23 deletions

View File

@@ -4269,6 +4269,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
/* loads the cli_permissions.conf file needed to implement cli restrictions. */
ast_cli_perms_init(0);
ast_cli_channels_init(); /* Not always safe to access CLI commands until startup is complete. */
ast_stun_init();