### Description

I don't know if this is a bug, or if I missing some config requirements. I 
mentioned the issue on the sr-user but did not get any comment.

In case serial (or combined serial/parallel) branching is wished, the q value 
from the registered contact is considered to define the order in which a call 
is serial branched.

If a CPE registers without q value, the value can be defined by:

modparam("registrar", "default_q", 500)

If a CPE registers with a q value, the client provided value is not being 
overridden by the default_q setting.

In order to force the order there is a need to override the q value provided by 
a CPE.

According to the Manual this is possible:

modparam("registrar", "xavp_cfg", "reg")

https://www.kamailio.org/docs/modules/devel/modules/registrar.html#registrar.p.xavp_cfg

q - q value of contact (integer 0-1000). It overrides q value given in contact 
header and default_q parameter. Used in save().

#### Reproduction

Actual config:

```
modparam("registrar", "method_filtering", 1)
modparam("registrar", "max_contacts", 10)
modparam("registrar", "max_expires", 3600)
modparam("registrar", "gruu_enabled", 0)
modparam("registrar", "retry_after", 30)
modparam("registrar", "xavp_cfg", "reg")
modparam("registrar", "default_q", 600)
modparam("registrar", "use_path", 1)
modparam("registrar", "path_mode", 1)
modparam("registrar", "path_check_local", 0)
```

```
route[REGISTRAR] {
        # Create an AOR based on the auth_username for the location service.
        $var(saveuri) = "sip:" + $aU + "@" + $rd;

        $xavp(reg=>q) = 450;

        $var(result) = save("location","0x00","$var(saveuri)");

        if ($var(result) == -2) {
                xlog("L_ERR", "$cfg(route): Too many contacts for 
$var(saveuri)\n");
                sl_reply_error();
        }
        if ($var(result) == -1) {
                xlog("L_ERR", "$cfg(route): Error saving location 
$var(saveuri)\n");
                sl_reply_error();
        }
        if ($var(result) == 1) {
                xlog("L_INFO", "$cfg(route): Contact $var(saveuri) inserted\n");
        }
        if ($var(result) == 2) {
                if ($avp(debug) > 0) {
                        xlog("L_INFO", "$cfg(route): Contact $var(saveuri) 
updated\n");
                }
        }
        if ($var(result) == 3) {
                xlog("L_INFO", "$cfg(route): Contact $var(saveuri) deleted\n");
        }
        if ($var(result) == 4) {
                xlog("L_INFO", "$cfg(route): Contact $var(saveuri) returned\n");
        }
}
```

#### Debugging Data

```
# kamctl ul show | json_pp | grep "Q"
                                 "Q" : 0.6,
                                 "Q" : 0.6,
                                 "Q" : 0.6,
                                 "Q" : 0.5,
                                 "Q" : 0.6,
                                 "Q" : 0.6,
                                 "Q" : 0.6,
```

CPE providing a q value (0.5 in this case for CPE 4) are not overriden.
CPE providing no q value are inserted with default_q value.

Expectation: $xavp(reg=>q) = 450 should cause all CPE to register with Q: 0.45

#### Log Messages

No errors logged while saving contact.

#### SIP Traffic

I could show the Register messages of CPE with q= attribute and without, but I 
don't think this contributes to solving the issue.

### Possible Solutions

I attempted some other notations like: 

$xavp(reg>q)
or
$xavp(reg[0]=>q)

none worked.

I also noted some time ago that setting: $xavp(reg=>max_contacts) also does not 
work

### Additional Information

```
# kamailio -v
version: kamailio 5.7.6 (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 11.4.0
```

```
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy
```

Any help / hints appreciated!

-Benoît-

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4068
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