### Description
According to the documentation for the UAC module, the `uac_reg` command can accept an optional argument to use the pre-calculated HA1 format:
``` 4.7. uac_auth([mode]) This function can be called only from failure route and will build the authentication response header and insert it into the request without sending anything.
If mode is set to 1, then the password has to be provided in HA1 format. The parameter can be a static integer or a variable holding an integer value ```
However, when I attempt to use this in my configuration file, Kamailio fails to start.
### Troubleshooting
#### Reproduction
The problem is reproducible in the 5.4, 5.4-nightly, and dev-nightly debian packages with the following config file:
``` #!KAMAILIO
loadmodule "tm" loadmodule "sl" loadmodule "pv" loadmodule "uac" loadmodule "rr"
modparam("uac","auth_username_avp","$avp(auser)") modparam("uac","auth_password_avp","$avp(apass)") modparam("uac","auth_realm_avp","$avp(arealm)")
request_route {
if( $rm == "INVITE" ) { t_on_failure("TRUNKAUTH"); }
t_relay(); }
failure_route[TRUNKAUTH] {
$avp(auser) = "user"; $avp(arealm) = "realm"; $avp(apass) = "password";
if (uac_auth(1)) { t_relay(); } exit; } ```
A check on syntax file syntax gives an error of:
``` $ sudo kamailio -eEc
0(18427) ERROR: <core> [core/cfg.y:3451]: yyparse(): cfg. parser: failed to find command uac_auth (params 1) 0(18427) CRITICAL: <core> [core/cfg.y:3592]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 30, column 19: unknown command, missing loadmodule?
ERROR: bad config file (1 errors) ```
No failures are observed if the parameter is removed from line 30. Changed from `if (uac_auth(1)) {` to `if (uac_auth()) {`.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.4.4 (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, 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_BLACKLIST, 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 8.3.0 ```
* **Operating System**:
<!-- Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...; Kernel details (output of `uname -a`) -->
``` Linux aarenet-sipdir2 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux ```
The parameter has to be provided in between double quotes, like a string. Several functions support getting the parameter as an integer value directly, but not all of them -- the common is to enclose the parameters in quotes, no matter is a number or a string. Even those able to get it directly a number, work with quoted values. The support for number parameters came via incorporating SER project, and afaik, internally they convert to string to pass it to the functions which expect string format always, then each function knows what values/parameters are expected and they convert to numbers, if it is the case.
The readme of uac module in devel branch has a better example highlighting the parameter format.
Reopen if enclosing in quotes does not work.
Closed #2672.
It's the same result with a double quoted "1".
`if (uac_auth("1")) {`
The error message looks like it can't find the command with this signature. ``` 0(24044) ERROR: <core> [core/cfg.y:3536]: yyparse(): cfg. parser: failed to find command uac_auth (params 1) 0(24044) CRITICAL: <core> [core/cfg.y:3677]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 30, column 21: unknown command, missing loadmodule? ```
This is testing in 5.5.0-dev4 from the Debian repository.
```version: kamailio 5.5.0-dev4 (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, 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 8.3.0 ```
I looked in the code and the function with one parameter is actually exported as `uac_auth_mode(...)`, so it is an error in the docs. I will fix that soon.
At the end I exposed the function under name uac_auth() which can take the parameter, along with documenting uac_auth_mode(), which was kept as well, so both variants should work now using master branch. I will backport to 5.4 soon.