Kamailio webrtc: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
(Created page with "== Overview == Kamailio WevRTC 설정 내용 정리 == Example == <pre> loadmodule "xhttp.so" loadmodule "tls.so" loadmodule "websocket.so" loadmodule "nathelper.so" # -----...")
 
Line 49: Line 49:
== See also ==
== See also ==
* https://telecom.altanai.com/2018/09/04/kamailio-webrtc-sip-server - Kamailio WebRTC SIP Server
* https://telecom.altanai.com/2018/09/04/kamailio-webrtc-sip-server - Kamailio WebRTC SIP Server
* https://github.com/havfo/WEBRTC-to-SIP/blob/master/etc/kamailio/kamailio.cfg


[[category:kamailio]]
[[category:kamailio]]

Revision as of 20:42, 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;
  }

}


See also