Be aware that r-uri (request uri, represented by $ru as var) it is itself a branch. Also
$du (outbound proxy - destination uri) is associated with the $ru branch.
In the config snippet, you assign values to $du, that means you set the destination
address for the branch of r-uri ($ru). because you only use append branch, you don't
change the r-uri branch and that stays as extra branch with latest $du you set.
What you should do:
- if $var(i)==0 (the first row of the result) - set the $ru to the contact and the $du to
received value
- if $var(i)!=0 (the next rows of the result) - do append_branch() with the contact and
set the $(branch(dst_uri)[-1]) to received value
As a suggestion, you are using the string transformation to parse URI from database in
order to get domain part, etc... you better use the uri transformation, because it is
designed for this kind of need.
I am closing this here, such discussion has to be done on sr-users mailing list, follow up
there if you need further assitance.
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/72#issuecomment-75843183