Kamailio webrtc: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
No edit summary
 
Line 46: Line 46:
</pre>
</pre>


== Demo client ==
* https://tryit.jssip.net/


== See also ==
== See also ==

Latest revision as of 20:45, 16 June 2020

Overview

Kamailio WevRTC 설정 내용 정리

Example

loadmodule "xhttp.so"
loadmodule "tls.so"
loadmodule "websocket.so"
loadmodule "nathelper.so"

# ----- tls params
modparam("tls", "tls_method", "SSLv23")
modparam("tls", "certificate", "/usr/local/etc/kamailio/certs/cert.pem")
modparam("tls", "private_key", "/usr/local/etc/kamailio/certs/key.pem")

...
event_route[xhttp:request] {

  if ($Rp != 80 && $Rp != 443) {
    xhttp_reply("403", "Forbidden", "", "");
    exit;
  }

  if (!($hdr(Upgrade) =~ "websocket") || !($hdr(Connection) =~ "Upgrade") || !($rm =~ "GET")) {
    sl_send_reply("403", "Forbidden");
    exit;
  }

  # Validate Host - make sure the client is using the correct
  # alias for WebSockets
  if ($hdr(Host) == $null || !is_myself("sip:" + $hdr(Host))) {
    xlog("L_WARN", "Bad host $hdr(Host)\n");
    xhttp_reply("403", "Forbidden", "", "");
    exit;
  }

  # ws_handle_handshake() exits (no further configuration file
  # processing of the request) when complete.
  if (ws_handle_handshake()) {
    # Optional... cache some information about the
    # successful connection
    exit;
  }

}

Demo client

See also