Kamailio webrtc

From 탱이의 잡동사니
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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