<div dir="ltr"><div>According to this article I mentioned in the beginning:</div><div><br></div><div><a href="http://nil.uniza.sk/sip/kamailio/configuring-kamailio-4x-websocket">http://nil.uniza.sk/sip/kamailio/configuring-kamailio-4x-websocket</a></div><div><br></div><div>In http:request they do straight away the set_reply_close();</div><div><br></div><div>I don't know exactly if this kamailio.cfg implementation may be useful for working with WSS:</div><div><br></div><div>event_route[xhttp:request] {</div><div>set_reply_close();</div><div>set_reply_no_connect();</div><div><br></div><div>if ($Rp != MY_WS_PORT</div><div>#!ifdef WITH_TLS</div><div>     && $Rp != MY_WSS_PORT</div><div>#!endif</div><div>) {</div><div>  xlog("L_WARN", "HTTP request received on $Rp\n");</div><div>  xhttp_reply("403", "Forbidden", "", "");</div><div>  exit;</div><div>}</div><div><br></div><div>xlog("L_DBG", "HTTP Request Received\n");</div><div><br></div><div>if ($hdr(Upgrade)=~"websocket"</div><div>   && $hdr(Connection)=~"Upgrade"</div><div>   && $rm=~"GET") {</div><div><br></div><div>  # Validate Host - make sure the client is using the correct</div><div>  # alias for WebSockets</div><div>  if ($hdr(Host) == $null || !is_myself("sip:" + $hdr(Host))) {</div><div>   xlog("L_WARN", "Bad host $hdr(Host)\n");</div><div>   xhttp_reply("403", "Forbidden", "", "");</div><div>   exit;</div><div>  }</div><div><br></div><div>  # Optional... validate Origin - make sure the client is from an</div><div>  # authorised website.  For example,</div><div>  #</div><div>  # if ($hdr(Origin) != "<a href="http://communicator.MY_DOMAIN">http://communicator.MY_DOMAIN</a>"</div><div>  #     && $hdr(Origin) != "<a href="https://communicator.MY_DOMAIN">https://communicator.MY_DOMAIN</a>") {</div><div>  # xlog("L_WARN", "Unauthorised client $hdr(Origin)\n");</div><div>  # xhttp_reply("403", "Forbidden", "", "");</div><div>  # exit;</div><div>  # }</div><div><br></div><div>  # Optional... perform HTTP authentication</div><div><br></div><div>  # ws_handle_handshake() exits (no further configuration file</div><div>  # processing of the request) when complete.</div><div>  if (ws_handle_handshake())</div><div>  {</div><div>   # Optional... cache some information about the</div><div>   # successful connection</div><div>   exit;</div><div>  }</div><div>}</div><div><br></div><div>HTTP authentication is not being properly set up. Any indications on how to perform this sucessfully?</div><div><br></div><div>Kind regards</div><div><br></div><div>Manuel</div><div><br></div><div><br></div><div>>Hello,</div><div>></div><div>>from the logs you sent now, it appears that you have set_reply_close() </div><div>>in config, therefore the connection is closed after sending the reply.</div><div>></div><div>>Cheers,</div><div>>Daniel</div></div>