### 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/4126(a)github.com>
Hello, I discovered that kamcmd command doesn't allow the same argument for a rpc command if I call a one-liner command or from the kamcmd console. it's related to ul.add command
If I call this command from bash:
kamcmd ul.add location 222(a)domain.com sip:222@tbd.domain.com:5088;transport=udp 0 -1.0 . 0 2240 5023 . udp:8.12.6.7:5060
the command will fail with 2 errors:
error: 500 - Not enough parameters or wrong format
-bash: 0: command not found
I discovered if I remove ;transport=udp I get rid of the errors and I get new one:
Unknown option `-1'.
And if I set my Q value from -1.0 to 0.0 the command works
BUT
If I go into the kamcmd console and I ask the exact original command, it works and I can see in usrloc database that it accepted my Q value to -1.0 and the transport=udp string
I tried to use s: to force some argument as string but it doesn't works , may be I don't use correctly
I tried unsuccessfully:
kamcmd ul.add location 298(a)domain.com s:sip:298@tbd.domain.com:5088;transport=udp 0 s:-1.0 . 0 2240 5023 . udp:8.12.6.7:5060
-->
I use kamailio version
kamailio 5.7.1 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 10.2.1
kamcmd has been built from the same source code with the rest of the program
Built on debian 11
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4137
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4137(a)github.com>
Hello,
there is a planned mainenance work on the infrastructure for the server
hosting kamailio.org services (among them: the main website, wiki,
mailing lists) on next week, Tuesday, February 18, 2025, to start about
10:00am Berlin time (CET). Expect some intervals of unavailability, we
hope they will be short and most of them not noticeable for the majority
accessing these services during the day.
Once the work is finished, an announcement will be sent out.
The apt repository, github project and the matrix chat channels should
not be affected, they can be accessed as usual and can be used a backup
communication channels if anyone observes something that has to be
addressed.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio Advanced Training, March 24-28, 2025 -- asipto.com
Kamailio World Conference, May 12-13, 2025, Berlin -- kamailioworld.com