### Description

I am trying to configure some "default" settings in Kamailio that would be 
independent of the configuration file. The command-line options `--loadmodule` 
and `--modparam` seemed to be exactly what I was looking for.

However, I noticed that these options are processed **before** the 
configuration file is loaded. As a result, the `--modparam` option cannot be 
used separately, because the module for the specified parameter has not yet 
been loaded:

```
# kamailio -E -DD --modparam=corex:alias_subdomains:s:kamailio.org           
0(653) ERROR: <core> [core/modparam.c:199]: set_mod_param_regex(): No module 
matching <corex> found
0(653) ERROR: <core> [main.c:2584]: main(): failed to set modparam: 
corex:alias_subdomains:s:kamailio.org

```
To address this, the module needs to be loaded first using the `--loadmodule` 
option. However, this causes an error if the same module is also loaded in the 
configuration file:

```
# kamailio -E -DD --loadmodule=corex 
--modparam=corex:alias_subdomains:s:kamailio.org
0(654) WARNING: <core> [core/sr_module.c:611]: ksr_load_module(): attempting to 
load the same module twice (/usr/lib/x86_64-linux-gnu/kamailio/modules/corex.so)
0(654) CRITICAL: <core> [core/cfg.y:4014]: yyerror_at(): parse error in config 
file /etc/kamailio/kamailio.cfg, line 283, column 12-21: failed to load module
```

### Possible Solutions

Would it be possible to move the processing of these command-line options 
**after** the configuration file is loaded? And could the `--loadmodule` option 
ignore loading a module if it has already been loaded via the configuration 
file?

Another potential solution could be introducing new options, such as 
`--loadmodule-after` and `--modparam-after`, to specify parameters that should 
only be applied once the configuration file has been loaded.

What do you think about these suggestions?

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
version: kamailio 5.8.4 (x86_64/linux) 
```

* **Operating System**:



```
Linux 010a217cd09a 6.12.10-orbstack-00297-gf8f6e015b993 #42 SMP Sun Jan 19 
03:00:07 UTC 2025 x86_64 GNU/Linux
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4126
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/4...@github.com>
_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to