]> 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)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Wed, 16 Apr 2025 12:29:18 +0000 (12:29 +0000)
commitc52136c277fedac304fd11b36b0d671f83700e84
treee30a1ca8c6a405fa84d47292e83d30064a13f4ef
parent085fd922fce55cd58d6a241789ea21983c4a2a08
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.
configs/samples/cli.conf.sample
main/asterisk.c