<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please
use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on
sr-users mailing list:
*
http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask
on sr-dev mailing list:
*
http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the
developers to troubleshoot the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment).
-->
### Description
I'm appending two contacts / branches upon receiving a call. This is a snippet of the
config I'm using to debug:
```
xlog ("=== branch 0: $(branch(uri)[0]), $(branch(q)[0])\n");
xlog ("=== branch 1: $(branch(uri)[1]), $(branch(q)[1])\n");
revert_uri();
t_load_contacts();
while (t_next_contacts()) {
xlog ("==== $ru\n");
}
```
We expect that the branches are rearranged by weight. When t_next_contacts() is called,
the $ru is being rewritten with the branch having the highest q value. This behavior
changed after upgrading to v5.4.0. The order of the branches is now being reversed.
### Troubleshooting
#### Reproduction
<!--
If the issue can be reproduced, describe how it can be done.
-->
#### Debugging Data
<!--
If you got a core dump, use gdb to extract troubleshooting data - full backtrace,
local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile
bt full
info locals
list
If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->
```
(paste your debugging data here)
```
#### Log Messages
In v5.4.0, this is what we're seeing in the logs
```
ERROR: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: === branch 0:
sip:1001@gateway2.carrierB.com;transport=udp, 200
ERROR: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: === branch 1:
sip:1001@gateway1.carrierB.com;transport=tcp, 300
DEBUG: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: tm [t_serial.c:526]:
t_load_contacts(): load_contact mode not selected, using: 0
DEBUG: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: tm [t_serial.c:340]:
ki_t_load_contacts_mode(): nr_branches is 2
DEBUG: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: <core> [core/xavp.c:539]:
xavp_destroy_list(): destroying xavp list 0x7fcbe3103e20
DEBUG: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: tm [t_serial.c:890]:
ki_t_next_contacts(): Appending branch
uri-'sip:1001@gateway1.carrierB.com;transport=tcp' dst-'' path-''
inst-'' ruid-'' location_ua-''
DEBUG: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: <core> [core/xavp.c:539]:
xavp_destroy_list(): destroying xavp list 0x7fcbe3103b68
ERROR: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: ==== sip:1001@carrierB
DEBUG: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: <core> [core/xavp.c:539]:
xavp_destroy_list(): destroying xavp list 0x7fcbe3103890
ERROR: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: ====
sip:1001@gateway2.carrierB.com;transport=udp
DEBUG: IBG_LOG: sipp-ci1-20200819163846-1-22(a)172.18.1.21: tm [t_serial.c:627]:
ki_t_next_contacts(): no contacts in contacts_avp - we are done!
```
This was the behavior in v.5.3.4
```
ERROR: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: === branch 0:
sip:1001@gateway2.carrierB.com;transport=udp, 200
ERROR: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: === branch 1:
sip:1001@gateway1.carrierB.com;transport=tcp, 300
DEBUG: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: tm [t_serial.c:191]:
ki_t_load_contacts(): nr_branches is 2
DEBUG: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: <core> [core/xavp.c:529]:
xavp_destroy_list(): destroying xavp list 0x7f55bdf0c1d8
ERROR: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: ====
sip:1001@gateway1.carrierB.com;transport=tcp
DEBUG: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: <core> [core/xavp.c:529]:
xavp_destroy_list(): destroying xavp list 0x7f55bdf0bf00
ERROR: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: ====
sip:1001@gateway2.carrierB.com;transport=udp
DEBUG: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: <core> [core/xavp.c:529]:
xavp_destroy_list(): destroying xavp list 0x7f55bdf0bc28
ERROR: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: ==== sip:1001@carrierB
DEBUG: IBG_LOG: sipp-ci1-20200819172941-1-22(a)172.18.1.21: tm [t_serial.c:460]:
ki_t_next_contacts(): no contacts in contacts_avp - we are done!
```
#### SIP Traffic
<!--
If the issue is exposed by processing specific SIP messages, grab them with ngrep or save
in a pcap file, then add them next, or attach to issue, or provide a link to download them
(e.g., to a pastebin site).
-->
```
(paste your sip traffic here)
```
### Possible Solutions
<!--
If you found a solution or workaround for the issue, describe it. Ideally, provide a pull
request with a fix.
-->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
(paste your output here)
```
* **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`)
-->
```
(paste your output here)
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2449