Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!define DBURL "postgres://kamailio:secret_password@localhost:5433/kamailio"
- loadmodule "pv.so"
- loadmodule "ctl.so"
- loadmodule "jsonrpcs.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"
- #############[Подключение к БД]###########
- modparam("auth_db", "db_url", DBURL); # указываем URL для подключения, берем его из ранее созданной директивы DBURL
- request_route {
- route(REQINIT);
- if (is_method("CANCEL")) {
- if (t_check_trans()) {
- route(RELAY);
- }
- exit;
- }
- if (is_method("INVITE") || is_method("REGISTER")) {
- route(NAT);
- }
- if (is_method("REGISTER")) {
- route(AUTH);
- }
- route(DIALOG);
- }
- route[REQINIT] {
- force_rport;
- }
- route[AUTH] {
- if (!auth_check("$fd", "subscriber", "1")) {
- auth_challenge("$fd", "1");
- exit;
- }
- if (is_method("REGISTER")) {
- save("location");
- exit;
- } else {
- return;
- }
- }
- route[NAT] {
- if (nat_uac_test("19")) {
- if (is_method("REGISTER")) {
- set_contact_alias();
- } else {
- if(is_first_hop()) {
- set_contact_alias();
- }
- }
- }
- return;
- }
- route[DIALOG] {
- if (is_method("INVITE")) {
- route(AUTH);
- if (!lookup("location")) {
- sl_send_reply("403", "Forbidden");
- exit;
- }
- handle_ruri_alias();
- record_route();
- route(RELAY);
- }
- if (has_totag()) {
- if (loose_route()) {
- handle_ruri_alias();
- route(RELAY);
- }
- }
- if (is_method("ACK")) {
- if ( t_check_trans() ) {
- route(RELAY);
- exit;
- } else {
- exit;
- }
- }
- }
- route[RELAY] {
- t_on_reply("REPLY");
- t_relay();
- }
- onreply_route[REPLY] {
- route(NAT);
- }
Advertisement
Add Comment
Please, Sign In to add comment