documents
#!define DBURL "postgres://kamailio:PASSWORD@DB_ADDR:DB_PORT/kamailio"
#!define tswitch 1
#!define fswitch 2
listen=udp:PUBLIC_IP:5060
listen=udp:LOCAL_IP:5060
listen=tls:PUBLIC_IP:7777
listen=tls:LOCAL_IP:7777
alias=tls:YOURDOMAIN.COM:7777
mhomed=1
tcp_accept_no_cl=yes
enable_tls=yes
loadmodule "pv.so"
loadmodule "ctl.so"
loadmodule "xlog.so"
loadmodule "jsonrpcs.so"
loadmodule "json.so"
loadmodule "tm.so"
loadmodule "textops.so"
loadmodule "sl.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "auth.so"
loadmodule "db_postgres.so"
loadmodule "auth_db.so"
loadmodule "siputils.so"
loadmodule "nathelper.so"
loadmodule "rr.so"
loadmodule "rtpengine.so"
loadmodule "htable.so"
loadmodule "dispatcher.so"
loadmodule "regex.so"
loadmodule "permissions.so"
loadmodule "xhttp.so"
loadmodule "tls.so"
loadmodule "websocket.so"
loadmodule "debugger.so"
loadmodule "corex.so"
loadmodule "tmx.so"
modparam("auth_db", "db_url", DBURL)
modparam("auth_db", "load_credentials", "$avp(pass)=password")
modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "db_mode", 2)
modparam("htable", "db_url", DBURL)
modparam("htable", "htable", "auth=>size=32;autoexpire=1800;")
modparam("htable", "htable", "ipban=>size=32;autoexpire=60;initval=0;")
modparam("rtpengine", "rtpengine_sock", "udp:10.0.0.4:2223")
modparam("dispatcher", "db_url", DBURL)
modparam("dispatcher", "ds_ping_interval", 10)
modparam("dispatcher", "ds_probing_threshold", 4)
modparam("dispatcher", "ds_inactive_threshold", 4)
modparam("dispatcher", "hash_pvar", "$td")
modparam("permissions", "db_url", DBURL)
modparam("permissions", "db_mode", 1)
modparam("tls", "config", "/etc/kamailio/tls.cfg")
request_route {
route(REQINIT);
if (is_method("CANCEL")) {
if (t_check_trans()) {
route(RELAY);
}
exit;
}
if (!is_method("ACK")) {
if(t_precheck_trans()) {
t_check_trans();
exit;
}
t_check_trans();
}
if (is_method("INVITE") || is_method("REGISTER")) {
route(NAT);
}
if (is_method("REGISTER")) {
route(AUTH);
}
route(DIALOG);
}
route[REQINIT] {
if($sht(ipban=>$si) > 3) {
exit;
}
force_rport;
}
route[AUTH] {
if (sht_match_name("auth", "eq", "$Au")) {
if (!pv_auth_check("$fd", "$sht(auth=>$Au)", "0", "1")) {
auth_challenge("$fd", "1");
$sht(ipban=>$si) = $sht(ipban=>$si) + 1;
exit;
}
consume_credentials();
$sht(ipban=>$si) = $null;
if (is_method("REGISTER")) {
save("location");
exit;
}
} else {
if (!auth_check("$fd", "subscriber", "1")) {
auth_challenge("$fd", "1");
$sht(ipban=>$si) = $sht(ipban=>$si) + 1;
exit;
}
$sht(auth=>$Au) = $avp(pass);
$sht(ipban=>$si) = $null;
consume_credentials();
if (is_method("REGISTER")) {
save("location");
exit;
}
}
}
route[NAT] {
if (nat_uac_test("19")) {
if (is_method("REGISTER")) {
set_contact_alias();
} else {
if(is_first_hop()) {
if (!ds_is_from_list("1", "2")) {
set_contact_alias();
}
}
}
}
return;
}
route[DIALOG] {
if (has_totag()) {
if (loose_route()) {
if(is_method("BYE")) {
handle_ruri_alias();
t_relay();
}
handle_ruri_alias();
route(RELAY);
}
}
if (is_method("ACK")) {
if ( t_check_trans() ) {
route(RELAY);
exit;
} else {
exit;
}
}
if (!ds_is_from_list("1", "2")) {
setflag(tswitch);
if ((is_method("INVITE") && allow_source_address("100")) || is_method("UPDATE")) {
record_route();
route(RELAY);
} else {
route(AUTH);
handle_ruri_alias();
record_route();
route(RELAY);
}
} else {
setflag(fswitch);
if (is_method("INVITE")) {
$rd = $fd;
$td = $fd;
lookup("location");
switch ($retcode) {
case -1:
case -3:
sl_send_reply("404", "Not Found");
exit;
case -2:
sl_send_reply("405", "Not Found");
exit;
};
handle_ruri_alias();
record_route();
route(RELAY);
}
}
}
route[RELAY] {
if(is_method("CANCEL") || is_method("ACK")) {
t_relay();
}
if (has_body("application/sdp") && isflagset(tswitch)) {
rtpengine_manage("ICE=remove replace-origin UDP/RTP external internal");
} else {
if (pcre_match("$dP", "(?i)wss|ws")) {
rtpengine_manage("replace-origin ICE=force SDES=off UDP/TLS/RTP/SAVPF codec-mask=all codec-transcode=PCMA,PCMU internal external");
} else {
rtpengine_manage("ICE=remove replace-origin codec-mask=all codec-transcode=PCMA,PCMU internal external");
}
}
t_on_reply("REPLY");
if (isflagset(fswitch)) {
t_relay();
}
if (isflagset(tswitch)) {
if (is_method("INVITE")) {
ds_select_dst("1", "4");
}
t_relay();
}
exit;
}
onreply_route[REPLY] {
route(NAT);
if (has_body("application/sdp")) {
rtpengine_manage("replace-origin");
}
}
include_file "http.conf"
https://www.4tablet-pc.net/software/7249-play-store-5-4-12-apk-download.html