Kamailio webrtc

From 탱이의 잡동사니
Revision as of 20:42, 16 June 2020 by Pchero (talk | contribs) (Created page with "== Overview == Kamailio WevRTC 설정 내용 정리 == Example == <pre> loadmodule "xhttp.so" loadmodule "tls.so" loadmodule "websocket.so" loadmodule "nathelper.so" # -----...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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;
  }

}


See also