From david.villasmil.work@gmail.com Tue May 4 00:20:10 2021 From: David Villasmil To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] Can't make tcp_conid_alive work with $var Date: Mon, 03 May 2021 23:19:57 +0100 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2116902042==" --===============2116902042== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Thanks Ovidiu, Already tried that.. $var(conid) = $(hdr(Route){param.value,wsconnid}); $var(conid) = $(var(conid){s.striptail,1}{s.int}); Regards, David Villasmil email: david.villasmil.work(a)gmail.com phone: +34669448337 On Mon, May 3, 2021 at 11:06 PM Ovidiu Sas wrote: > Try to convert to int using the {s.int} transformation. > > Regards, > Ovidiu Sas > > On Mon, May 3, 2021 at 5:41 PM David Villasmil > wrote: > > > > Hello guys, > > > > I'm trying to do the following: > > > > On INVITE, i add a param to RR "wsconnid" which is the connection id of > the WS socket. > > Afterwards, i get an OPTIONS including said param. > > > > Next I want to retrieve the param and check if the connection is alive. > > > > NOTE: using simply "$(hdr(Route){param.value,wsconnid})" returns an > extra ">" from the end of the string, and i haven't been able to remove > that any other way but with "striptail", it works fine. > > > > *** > > $var(conid) = $(hdr(Route){param.value,wsconnid}); > > $var(conid) = $(var(conid){s.striptail,1}); > > xlog("L_ERR", "Connection ID parameter: [$var(conid)]"); > > if (tcp_conid_alive("$var(conid)")) { > > xlog("L_ERR", "WS Connection ID $var(conid) is alive"); > > } else { > > xlog("L_ERR", "WS Connection ID $var(conid) is NOT alive"); > > } > > *** > > > > With that, "$var(conid)" contains the connection id properly: > > *** > > ERROR: