<div dir="ltr">Hello,<div><br></div><div>I am setting up this scenario using Kamailio 4.2.2:</div><div><br></div><div>[UA] <-> [kamailio1] <-> [kamailio2] <-> [other stuff]</div><div><br></div><div>UA connects to kamailio1 using SIP/WSS, kamailio1 proxies request along to kamailio2.  Note that my intent here is to have kamailio2 provide the registrar functionality.  The kamailio2 (or something behind it) can also initiate transactions to UA, like OPTIONS, for example.</div><div><br></div><div>I'm having an issue though: when the websocket connection between kamailio1 and UA dies, transaction requests from kamailio2 show up to kamailio1, and I get errors in kamailio1's logs because the WSS connection is gone.  I get messages as follows (debug=2):</div><div><br><div><div>Mar  6 00:17:33 kamailio1 /usr/local/sbin/kamailio[5653]: WARNING: <core> [msg_translator.c:2778]: via_builder(): TCP/TLS connection (id: 0) for WebSocket could not be found</div><div>Mar  6 00:17:33 kamailio1 /usr/local/sbin/kamailio[5653]: ERROR: <core> [msg_translator.c:1996]: build_req_buf_from_sip_req(): could not create Via header</div><div>Mar  6 00:17:33 kamailio1 /usr/local/sbin/kamailio[5653]: ERROR: tm [t_fwd.c:527]: prepare_new_uac(): could not build request</div><div>Mar  6 00:17:33 kamailio1 /usr/local/sbin/kamailio[5653]: ERROR: tm [t_fwd.c:1777]: t_forward_nonack(): ERROR: t_forward_nonack: failure to add branches</div><div><br></div></div></div><div>At debug=4, I get the output here: <a href="http://pastebin.com/d3RumekG">http://pastebin.com/d3RumekG</a></div><div><br></div><div>In a running tshark, I see kamailio1 responding to kamailio2 with a "SIP/2.0 500 No error (2/TM)".  It appears to me that this is happening before t_relay() even returns.</div><div><br></div><div>Is there a way to prevent the SIP 500 from being sent back to the client?  I am calling t_on_branch_failure("kam2bf") and t_on_failure("kam2f"), with each of those handlers (event_route[tm:branch-failure:kam2bf] and failure_route[kam2f]) written to print a log message, but it appears that neither of those handlers are being called.  I tried installing these handlers independently to no avail.</div><div><br></div><div>I also tried registering a t_on_reply() handler, thinking it was an internally-generated SIP response that might make it through my handler on its way out to kam2, but that is also not getting invoked.</div><div><br></div><div>I want to return a 404 or something similar instead of having a 500 auto-returned for me.</div><div><br></div><div>Related to this, is there a way to query kamailio's in-memory client connectivity data structure for the connectivity status of a client? Or is this something best done by keeping track of every client myself using (e.g.) localcache?</div><div><br></div><div>Any pointers are appreciated.  Thanks!</div><div><br></div><div>Armen</div><div><br></div><div><br></div></div>