From kamailio@marrold.co.uk Fri May 14 12:44:55 2021 From: Marrold To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] Setting $conid per branch Date: Fri, 14 May 2021 11:44:38 +0100 Message-ID: In-Reply-To: <891b2cee-5443-b24d-18f3-33e962231651@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0739663816==" --===============0739663816== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, Apologies for the delay updating this one - it took longer than expected to get our test platform upgraded to the latest kamailio version that included the newer TCPOPS functions. I can confirm that using tcp_get_conid() and tcp_set_otcpid() appears to work around the issue. I'm still curious why Kamailio is intermittently getting the wrong connection ID internally. Thinking about it some more, the issue is actually occuring on the *main* branch when we set the following vars from the output of reg_fetch_contacts, as it's only returning a single contact during testing. $ru =3D $var(addr); $du =3D $var(received); $bf =3D $var(cflags); $fs =3D $var(socket); Thanks On Tue, Mar 30, 2021 at 12:08 PM Daniel-Constantin Mierla wrote: > Hello, > > can you try with master branch to use sbranch-related functions from pv > module along with the result from reg_fetch_contact(). > > Cheers, > Daniel > On 19.03.21 11:13, Marrold wrote: > > We don't see the issue when using the standard lookup() function, only > when we start manually appending branches with the results > from reg_fetch_contact() > > Thanks > Matthew > > On Wed, Mar 17, 2021 at 7:18 AM Daniel-Constantin Mierla < > miconda(a)gmail.com> wrote: > >> Hello, >> >> >> On 11.03.21 10:55, Marrold wrote: >> >> Hi Daniel, >> >> I didn't spot those TCPOPs functions, I'll give them a try and let you >> know how I get on. >> >> Do you have any idea why Kamailio is intermittently selecting the wrong >> connection using ID vs peer address? >> >> >> have you tried and got that with lookup("location") or only with your >> script-based reg_fetch_contact()? >> >> Cheers, >> Daniel >> >> >> Thanks for the suggestions. >> Matthew >> >> On Wed, Mar 10, 2021 at 7:27 AM Daniel-Constantin Mierla < >> miconda(a)gmail.com> wrote: >> >>> Hello, >>> >>> a while ago I did some work to make possible to specify the outgoing tcp >>> connection id, see: >>> >>> * >>> https://www.kamailio.org/docs/modules/stable/modules/tcpops.html#tcpops.f= .tcp_set_otcpid >>> >>> And the next function after it. >>> >>> However, the testing was minimal, maybe not verifying the entire chain >>> with t_relay()/forward(). Even more, the specifying of the outbound tcp >>> connection was supposed to be done internally by the lookup("location"), >>> the functions from tcpops being added for more config flexibility, suitab= le >>> for single branch forwarding or branch_route blocks. >>> >>> However, in your seem to do manual processing with reg_fetch_contacts(), >>> not rely on lookup location. You can test with master and use $sbranch(..= .) >>> and corresponding functions from pv module, instead of setting the r-uri >>> and append_branch(). >>> >>> Cheers, >>> Daniel >>> On 10.03.21 06:00, Marrold wrote: >>> >>> Hi, >>> >>> I've done a bit more digging and realised that $conid is read-only, and >>> only available for an inbound connection - so I dont think it will achieve >>> what I need. >>> >>> I did a bit more troubleshooting and observed the differences in the >>> debug log between two identical calls: >>> >>> This example failed - the INVITEs went out to the incorrect endpoint / >>> TCP connection. The "ulc_conid" from the location table for the TCP >>> endpoint is 13: >>> >>> Mar 9 10:30:20 proxy-01 /sbin/kamailio[27014]: ERROR: