From kamailio@marrold.co.uk Tue Mar 9 09:56:19 2021 From: Marrold To: sr-users@lists.kamailio.org Subject: [SR-Users] Setting $conid per branch Date: Tue, 09 Mar 2021 08:56:06 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1797470646==" --===============1797470646== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Hi all, I'm currently adding a feature to our Kamailio configuration to fork calls based on user agent. To do so I'm getting the registered endpoints with reg_fetch_contacts() iterating through and matching on them, then using seturi() / append_branch() and setting the dst-uri and flags as required. However, calls are intermittently going to the wrong TCP connection, despite the logs showing the correct destination IP and port in the ONSEND route. Looking in the location table I can see each registration has a connection_id, and the debug log indicates it's finding the connection by ID: DEBUG: [core/tcp_main.c:1651]: _tcpconn_find(): found connection by id: 3 Is there a way to set the conid per branch? Is it necessary? We're using kamailio 5.3.3 on Debian 10. Thanks Matthew --===============1797470646== Content-Type: text/html Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="attachment.html" MIME-Version: 1.0 PGRpdiBkaXI9Imx0ciI+SGkgYWxsLDxkaXY+PGJyPjwvZGl2PjxkaXY+SSYjMzk7bSBjdXJyZW50 bHkgYWRkaW5nIGEgZmVhdHVyZSB0byBvdXIgS2FtYWlsaW8gY29uZmlndXJhdGlvbiB0byBmb3Jr IGNhbGxzIGJhc2VkIG9uIHVzZXIgYWdlbnQuPC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5UbyBk byBzbyBJJiMzOTttIGdldHRpbmcgdGhlIHJlZ2lzdGVyZWQgZW5kcG9pbnRzIHdpdGjCoHJlZ19m ZXRjaF9jb250YWN0cygpIGl0ZXJhdGluZyB0aHJvdWdoIGFuZCBtYXRjaGluZyBvbiB0aGVtLMKg dGhlbiB1c2luZyBzZXR1cmkoKSAvIGFwcGVuZF9icmFuY2goKSBhbmQgc2V0dGluZyB0aGUgZHN0 LXVyaSBhbmQgZmxhZ3MgYXMgcmVxdWlyZWQuPC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5Ib3dl dmVyLCBjYWxscyBhcmUgaW50ZXJtaXR0ZW50bHkgZ29pbmcgdG8gdGhlIHdyb25nIFRDUCBjb25u ZWN0aW9uLCBkZXNwaXRlIHRoZSBsb2dzIHNob3dpbmcgdGhlIGNvcnJlY3QgZGVzdGluYXRpb24g SVAgYW5kIHBvcnQgaW4gdGhlIE9OU0VORCByb3V0ZS48L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2 Pkxvb2tpbmcgaW4gdGhlIGxvY2F0aW9uIHRhYmxlIEkgY2FuIHNlZSBlYWNoIHJlZ2lzdHJhdGlv biBoYXMgYSBjb25uZWN0aW9uX2lkLCBhbmQgdGhlIGRlYnVnIGxvZyBpbmRpY2F0ZXMgaXQmIzM5 O3MgZmluZGluZyB0aGUgY29ubmVjdGlvbiBieSBJRDo8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2 PsKgREVCVUc6ICZsdDtjb3JlJmd0OyBbY29yZS90Y3BfbWFpbi5jOjE2NTFdOiBfdGNwY29ubl9m aW5kKCk6IGZvdW5kIGNvbm5lY3Rpb24gYnkgaWQ6IDM8YnI+PC9kaXY+PGRpdj48YnI+PC9kaXY+ PGRpdj5JcyB0aGVyZSBhIHdheSB0byBzZXQgdGhlIGNvbmlkIHBlciBicmFuY2g/IElzIGl0IG5l Y2Vzc2FyeT88YnI+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5XZSYjMzk7cmUgdXNpbmfCoGth bWFpbGlvIDUuMy4zIG9uIERlYmlhbiAxMC48L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PlRoYW5r czwvZGl2PjxkaXY+TWF0dGhldzwvZGl2PjwvZGl2Pgo= --===============1797470646==-- From kamailio@marrold.co.uk Wed Mar 10 06:01:45 2021 From: Marrold To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] Setting $conid per branch Date: Wed, 10 Mar 2021 05:00:00 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0359200390==" --===============0359200390== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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: