[SR-Users] outgoing TCP connection ID

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 2 19:48:10 CET 2020


Hello,

what's in kamailio memory related to a tcp connection may not be its
actual state, because the kernel/tcp stack can be in reconnecting state
without notifying the application layer. It can take up to a few minutes
to get to timeout and report connection is closed. So I am not sure you
can avoid send failure in t_relay(), and thus overall benefits could be
minimal.

Anyhow, look at the tcpops module, there is a function to get connection
id by peer address/port, which you can get with next-hop variable before
t_relay() (provided is not going to be fqdn, which may require mixing in
ipops module).

An alternative, if you need it for requests within dialog, you can use
hash table to store the connection ID using call-id as key when
processing the initial subscribe/invite, then you can retrieve it for
bye/notify/...

Cheers,
Daniel

On 02.11.20 19:04, Sergiu Pojoga wrote:
> Hi Daniel,
>
> In my case it's for an edge proxy scenario doing transport conversion,
> UDP backend to TCP/TLS client. So it would be after loose_route()
> followed by t_relay(). The initial TCP connection is established when
> a phone SUBSCRIBEs, later on the backend sends the in-dialog NOTIFY
> which often fails because the client & TCP connection is gone by now,
> causing a t_relay() failure.
>
> Thanks. Regards,
> --Sergiu
>
> On Mon, Nov 2, 2020 at 12:29 PM Daniel-Constantin Mierla
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>     Hello,
>
>     do you need it in a generic way, or after some specific operations
>     like lookup("location")?
>
>     Cheers,
>     Daniel
>
>     On 01.11.20 16:45, Sergiu Pojoga wrote:
>>     Hi there,
>>
>>     Is there a PV that exposes the outgoing TCP connection ID? $conid
>>     seems to be for received only.
>>
>>     /$conid - The TCP connection ID of the connection the current
>>     message arrived on for TCP, TLS, WS, and WSS. Set to $null for
>>     SCTP and UDP./
>>
>>     The objective is to check the status of the egress TCP connection
>>     like for e.g.:
>>     if(!tcp_conid_state(conid)) {
>>
>>     Thanks.
>>     --Sergiu
>>
>>     _______________________________________________
>>     Kamailio (SER) - Users Mailing List
>>     sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>>     https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users <https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>
>
>     -- 
>     Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com>
>     www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
>     Funding: https://www.paypal.me/dcmierla <https://www.paypal.me/dcmierla>
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201102/7c9e2cc1/attachment.htm>


More information about the sr-users mailing list