mirror of https://github.com/sipwise/kamailio.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
226 lines
6.0 KiB
226 lines
6.0 KiB
debug=3 # debug level (cmd line: -dddddddddd)
|
|
|
|
check_via=no # (cmd. line: -v)
|
|
dns=no # (cmd. line: -r)
|
|
rev_dns=no # (cmd. line: -R)
|
|
port=5060
|
|
children=2
|
|
alias="test-domain.com"
|
|
|
|
mhomed=yes # useful for multihomed hosts, small performance penalty
|
|
|
|
#tcp_accept_aliases=yes # accepts the tcp alias via option (see NEWS)
|
|
#tcp_poll_method="sigio_rt"
|
|
|
|
# ------------------ module loading ----------------------------------
|
|
|
|
# Uncomment this if you want to use SQL database
|
|
loadmodule "/usr/lib/ser/modules/sl.so"
|
|
loadmodule "/usr/lib/ser/modules/avp.so"
|
|
loadmodule "/usr/lib/ser/modules/avpops.so"
|
|
loadmodule "/usr/lib/ser/modules/tm.so"
|
|
loadmodule "/usr/lib/ser/modules/rr.so"
|
|
loadmodule "/usr/lib/ser/modules/maxfwd.so"
|
|
loadmodule "/usr/lib/ser/modules/usrloc.so"
|
|
loadmodule "/usr/lib/ser/modules/registrar.so"
|
|
loadmodule "/usr/lib/ser/modules/textops.so"
|
|
loadmodule "/usr/lib/ser/modules/dialog.so"
|
|
loadmodule "/usr/lib/ser/modules/rls.so"
|
|
loadmodule "/usr/lib/ser/modules/pa.so"
|
|
loadmodule "/usr/lib/ser/modules/presence_b2b.so"
|
|
loadmodule "/usr/lib/ser/modules/uri.so"
|
|
loadmodule "/usr/lib/ser/modules/fifo.so"
|
|
loadmodule "/usr/lib/ser/modules/xmlrpc.so"
|
|
loadmodule "/usr/lib/ser/modules/xlog.so"
|
|
|
|
# ----------------- setting module-specific parameters ---------------
|
|
|
|
# add value to ;lr param to make some broken UAs happy
|
|
modparam("rr", "enable_full_lr", 1)
|
|
|
|
modparam("rls", "min_expiration", 120)
|
|
modparam("rls", "max_expiration", 120)
|
|
modparam("rls", "default_expiration", 120)
|
|
modparam("rls", "auth", "none")
|
|
modparam("rls", "xcap_root", "http://localhost/xcap")
|
|
modparam("rls", "reduce_xcap_needs", 1)
|
|
modparam("rls", "db_mode", 0)
|
|
# modparam("rls", "db_url", "mysql://ser:heslo@127.0.0.1:3306/ser")
|
|
|
|
modparam("pa", "use_db", 0)
|
|
modparam("pa", "offline_winfo_timer", 600)
|
|
modparam("pa", "offline_winfo_expiration", 600)
|
|
# modparam("pa", "db_url", "mysql://ser:heslo@127.0.0.1:3306/ser")
|
|
# mode of PA authorization: none, implicit or xcap
|
|
modparam("pa", "auth", "xcap")
|
|
modparam("pa", "auth_xcap_root", "http://localhost/xcap")
|
|
modparam("pa", "winfo_auth", "none")
|
|
modparam("pa", "use_callbacks", 1)
|
|
modparam("pa", "accept_internal_subscriptions", 0)
|
|
modparam("pa", "max_subscription_expiration", 120)
|
|
modparam("pa", "timer_interval", 1)
|
|
|
|
modparam("presence_b2b", "presence_route", "<sip:127.0.0.1;lr>")
|
|
# modparam("presence_b2b", "presence_route", "<sip:127.0.0.1;transport=tcp;lr>")
|
|
modparam("presence_b2b", "on_error_retry_time", 60)
|
|
modparam("presence_b2b", "wait_for_term_notify", 33)
|
|
modparam("presence_b2b", "resubscribe_delta", 30)
|
|
modparam("presence_b2b", "min_resubscribe_time", 60)
|
|
modparam("presence_b2b", "default_expiration", 3600)
|
|
modparam("presence_b2b", "handle_presence_subscriptions", 1)
|
|
|
|
modparam("usrloc", "db_mode", 0)
|
|
# modparam("domain|uri_db|acc|auth_db|usrloc|msilo", "db_url", "mysql://ser:heslo@127.0.0.1:3306/ser")
|
|
|
|
modparam("fifo", "fifo_file", "/tmp/ser_fifo")
|
|
|
|
# ------------------------- request routing logic -------------------
|
|
|
|
# main routing logic
|
|
|
|
route{
|
|
# XML RPC
|
|
if (method == "POST" || method == "GET") {
|
|
create_via();
|
|
dispatch_rpc();
|
|
break;
|
|
}
|
|
|
|
# initial sanity checks -- messages with
|
|
# max_forwards==0, or excessively long requests
|
|
if (!mf_process_maxfwd_header("10")) {
|
|
sl_send_reply("483", "Too Many Hops");
|
|
break;
|
|
};
|
|
if (msg:len >= max_len ) {
|
|
sl_send_reply("513", "Message too big");
|
|
break;
|
|
};
|
|
|
|
# we record-route all messages -- to make sure that
|
|
# subsequent messages will go through our proxy; that's
|
|
# particularly good if upstream and downstream entities
|
|
# use different transport protocol
|
|
if (!method=="REGISTER") record_route();
|
|
|
|
# subsequent messages within a dialog should take the
|
|
# path determined by record-routing
|
|
if (loose_route()) {
|
|
# mark routing logic in request
|
|
append_hf("P-hint: rr-enforced\r\n");
|
|
route(1);
|
|
break;
|
|
};
|
|
|
|
if (uri==myself) {
|
|
|
|
if (method=="SUBSCRIBE") {
|
|
if (!t_newtran()) {
|
|
sl_reply_error();
|
|
break;
|
|
};
|
|
|
|
# new subscription
|
|
if (@to.tag=="") {
|
|
if ((@msg.supported=~"eventlist")) {
|
|
# Supported header field
|
|
# -> may be RLS subscription
|
|
|
|
if (is_simple_rls_target("$uid-list")) {
|
|
# log(1, "it is simple subscription!\n");
|
|
# handle_rls_subscription("1");
|
|
# takes From UID and makes XCAP query
|
|
# for user's list named "default"
|
|
if (@to.tag=="") {
|
|
# only for new subscriptions (with empty to tag
|
|
if (!query_resource_list("default")) {
|
|
t_reply("500", "XCAP query error");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!have_flat_list()) {
|
|
# query_resource_list failed or was not called
|
|
# do standard RLS query according to To/AOR
|
|
query_rls_services();
|
|
}
|
|
|
|
if (have_flat_list()) {
|
|
handle_rls_subscription("1");
|
|
break;
|
|
}
|
|
}
|
|
|
|
# SUBSCRIBE to existing user
|
|
# xlog("L_ERR", "PA: handling subscription: %tu from: %fu\n");
|
|
handle_subscription("registrar");
|
|
|
|
break;
|
|
}
|
|
else { # renewal subscription
|
|
if (!handle_rls_subscription("0")) {
|
|
handle_subscription("registrar");
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
if (method=="REGISTER") {
|
|
save("location");
|
|
break;
|
|
};
|
|
|
|
|
|
if (method=="PUBLISH") {
|
|
if (!t_newtran()) {
|
|
sl_reply_error();
|
|
break;
|
|
};
|
|
handle_publish("registrar");
|
|
break;
|
|
};
|
|
|
|
if (method=="NOTIFY") {
|
|
if (!t_newtran()) {
|
|
log(1, "newtran error\n");
|
|
sl_reply_error();
|
|
break;
|
|
};
|
|
if (!handle_notify()) {
|
|
t_reply("481", "Unable to handle notification");
|
|
}
|
|
break;
|
|
};
|
|
|
|
# message authorization
|
|
if (method=="MESSAGE") {
|
|
log(1, "MESSAGE authorization\n");
|
|
if (!authorize_message("http://localhost/xcap")) {
|
|
sl_reply("403", "Forbidden");
|
|
break;
|
|
}
|
|
}
|
|
|
|
# native SIP destinations are handled using our USRLOC DB
|
|
if (!lookup("location")) {
|
|
sl_send_reply("404", "Not Found");
|
|
break;
|
|
};
|
|
};
|
|
# append_hf("P-hint: usrloc applied\r\n");
|
|
route(1);
|
|
}
|
|
|
|
route[1]
|
|
{
|
|
# send it out now; use stateful forwarding as it works reliably
|
|
# even for UDP2TCP
|
|
if (!t_relay()) {
|
|
sl_reply_error();
|
|
};
|
|
}
|
|
|
|
|