[sr-dev] [kamailio/kamailio] tmx: t_reuse_branch() doesn't copy $du into new branch (#1264)

Sebastian Damm notifications at github.com
Fri Oct 6 16:34:34 CEST 2017


### Description

When using the t_reuse_branch() function after a branch failure, Kamailio doesn't send out the call again if $du was filled and differed from $ru. Instead, Kamailio tries to send the call directly to $ru.

I would expect that the call gets sent out the same way as the original call.

### Troubleshooting

#### Reproduction

You need a setup like this:

UAC1 K(LB) <=> K(Proxy/Registrar) <=> K(LB) => UAC2

When a UAC registers, the Path module is used to save the LB (Loadbalancer) for outbound calls. When UAC1 calls UAC2, the original call gets sent through K(LB) to UAC2. However, if the first call gets rejected and the call gets retried through branch failure route, K(Proxy/Registrar) tries to send the call directly to the request URI.

In your branch_route add a reference to a branch failure route:

```t_on_branch_failure("samplename");```

Then add a branch failure route like this:

```event_route[tm:branch-failure:handle_tls_branch] {
        if(t_check_status("488")) {
                if (isbflagset(0) && !isbflagset(1)) {
                        t_reuse_branch();
                        setbflag(1);
                        t_relay();
                }
        }
}```

When filling $du manually before sending out the call again, everything works.

### Possible Solutions

The original destination URI should be copied to the reused branch.

### Additional Information

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

```
version: kamailio 4.4.5 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, 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
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, 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 4.7.2
```
But from what I see in source code, the devel version still copies the same value.

* **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`)
-->

```
Debian Wheezy
```


-- 
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/1264
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20171006/ae739418/attachment.html>


More information about the sr-dev mailing list