]> git.ipfire.org Git - thirdparty/asterisk.git/commit
asterisk.c: Add "pre-init" and "pre-module" capability to cli.conf.
authorGeorge Joseph <gjoseph@sangoma.com>
Thu, 10 Apr 2025 13:59:34 +0000 (07:59 -0600)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 1 May 2025 12:41:16 +0000 (12:41 +0000)
commit74f9a12ce53a1b53f6c35370491911db158f3fcf
treef048031efcd4e82d51896059714f43e2aaefd9cf
parent817407f374e11f60a7b4abdfa8287132ce40c2ce
asterisk.c: Add "pre-init" and "pre-module" capability to cli.conf.

Commands in the "[startup_commands]" section of cli.conf have historically run
after all core and module initialization has been completed and just before
"Asterisk Ready" is printed on the console. This meant that if you
wanted to debug initialization of a specific module, your only option
was to turn on debug for everything by setting "debug" in asterisk.conf.

This commit introduces options to allow you to run CLI commands earlier in
the asterisk startup process.

A command with a value of "pre-init" will run just after logger initialization
but before most core, and all module, initialization.

A command with a value of "pre-module" will run just after all core
initialization but before all module initialization.

A command with a value of "fully-booted" (or "yes" for backwards
compatibility) will run as they always have been...after all
initialization and just before "Asterisk Ready" is printed on the console.

This means you could do this...

```
[startup_commands]
core set debug 3 res_pjsip.so = pre-module
core set debug 0 res_pjsip.so = fully-booted
```

This would turn debugging on for res_pjsip.so to catch any module
initialization debug messages then turn it off again after the module is
loaded.

UserNote: In cli.conf, you can now define startup commands that run before
core initialization and before module initialization.

(cherry picked from commit ade69af6d9ea753e7fb85d964fbedeeff0369e04)
configs/samples/cli.conf.sample
main/asterisk.c