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: <script>: Connection ID parameter: [2] ***
but tcp_conid_alive complaints: *** ERROR: <core> [core/sr_module.c:1638]: get_int_fparam(): Could not convert PV to int ERROR: tcpops [tcpops_mod.c:374]: w_tcp_conid_state(): invalid parameter 'conid' (must be a number) ***
Using a hardcoded number such as "1" generates no complaints.
Kamailio version: version: kamailio 5.3.7 (x86_64/linux)
Not sure what's going on here, any ideas?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
Try to convert to int using the {s.int} transformation.
Regards, Ovidiu Sas
On Mon, May 3, 2021 at 5:41 PM David Villasmil david.villasmil.work@gmail.com 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: <script>: Connection ID parameter: [2]
but tcp_conid_alive complaints:
ERROR: <core> [core/sr_module.c:1638]: get_int_fparam(): Could not convert PV to int ERROR: tcpops [tcpops_mod.c:374]: w_tcp_conid_state(): invalid parameter 'conid' (must be a number)
Using a hardcoded number such as "1" generates no complaints.
Kamailio version: version: kamailio 5.3.7 (x86_64/linux)
Not sure what's going on here, any ideas?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
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@gmail.com phone: +34669448337
On Mon, May 3, 2021 at 11:06 PM Ovidiu Sas osas@voipembedded.com 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 david.villasmil.work@gmail.com 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: <script>: Connection ID parameter: [2]
but tcp_conid_alive complaints:
ERROR: <core> [core/sr_module.c:1638]: get_int_fparam(): Could not
convert PV to int
ERROR: tcpops [tcpops_mod.c:374]: w_tcp_conid_state(): invalid parameter
'conid' (must be a number)
Using a hardcoded number such as "1" generates no complaints.
Kamailio version: version: kamailio 5.3.7 (x86_64/linux)
Not sure what's going on here, any ideas?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to
the sender!
Edit mailing list options or unsubscribe:
-- VoIP Embedded, Inc. http://www.voipembedded.com
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: