# ------------------------------------------------------------ # (c) 2006 iptelorg GmbH # # Proprietary and Confidential # # This file is not to be disclosed to a third party without # written permission of iptelorg. # ------------------------------------------------------------- # # iptelorg SPS # # main configuration file # debug=3 # debug level (cmd line: -dddddddddd) #fork=yes #log_stderror=no # (cmd line: -E) #memlog=5 # memory debug log level #log_facility=LOG_LOCAL0 # sets the facility used for logging (see syslog(3)) check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=2 #CFGOPTION_SER_DOMAIN alias="test-domain.com" #ENDCFGOPTION #user=ser #group=ser #open_fd_limit=1024 # sets the open file descriptors limit mhomed=yes # usefull for multihomed hosts, small performance penalty #disable_tcp=yes 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 "/home/kubartv/SER/lib/ser/modules/sl.so" loadmodule "/home/kubartv/SER/lib/ser/modules/avp.so" loadmodule "/home/kubartv/SER/lib/ser/modules/avpops.so" loadmodule "/home/kubartv/SER/lib/ser/modules/tm.so" loadmodule "/home/kubartv/SER/lib/ser/modules/rr.so" loadmodule "/home/kubartv/SER/lib/ser/modules/maxfwd.so" loadmodule "/home/kubartv/SER/lib/ser/modules/usrloc.so" loadmodule "/home/kubartv/SER/lib/ser/modules/registrar.so" loadmodule "/home/kubartv/SER/lib/ser/modules/textops.so" loadmodule "/home/kubartv/SER/lib/ser/modules/mysql.so" loadmodule "/home/kubartv/SER/lib/ser/modules/dialog.so" loadmodule "/home/kubartv/SER/lib/ser/modules/rls.so" loadmodule "/home/kubartv/SER/lib/ser/modules/pa.so" loadmodule "/home/kubartv/SER/lib/ser/modules/presence_b2b.so" loadmodule "/home/kubartv/SER/lib/ser/modules/uri.so" loadmodule "/home/kubartv/SER/lib/ser/modules/uri_db.so" loadmodule "/home/kubartv/SER/lib/ser/modules/domain.so" loadmodule "/home/kubartv/SER/lib/ser/modules/fifo.so" loadmodule "/home/kubartv/SER/lib/ser/modules/xmlrpc.so" loadmodule "/home/kubartv/SER/lib/ser/modules/xlog.so" # Uncomment this if you want digest authentication # mysql.so must be loaded ! loadmodule "/home/kubartv/SER/lib/ser/modules/auth.so" loadmodule "/home/kubartv/SER/lib/ser/modules/auth_db.so" loadmodule "/home/kubartv/SER/lib/ser/modules/msilo.so" # ----------------- setting module-specific parameters --------------- # modparam("msilo","registrar","sip:registrar@test-domain.com") modparam("msilo","use_contact",0) modparam("msilo","expire_time",120) # -- usrloc params -- # -- auth params -- # Uncomment if you are using auth module # modparam("auth_db", "calculate_ha1", yes) # # If you set "calculate_ha1" parameter to yes (which true in this config), # uncomment also the following parameter) # modparam("auth_db", "password_column", "password") # -- rr params -- # 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") #CFGOPTION_SER_XCAP_ROOT1 modparam("rls", "xcap_root", "http://vpres/xcap") #ENDCFGOPTION modparam("rls", "mode", "simple") 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) #owi = offline winfo - uncomment all lines begining with it for offline winfo #owi modparam("pa", "use_offline_winfo", 1) 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") #CFGOPTION_SER_XCAP_ROOT2 modparam("pa", "auth_xcap_root", "http://vpres/xcap") #ENDCFGOPTION modparam("pa", "winfo_auth", "none") # use only published information modparam("pa", "use_callbacks", 1) modparam("pa", "accept_internal_subscriptions", 0) modparam("pa", "max_subscription_expiration", 120) # modparam("pa", "timer_interval", 25) modparam("presence_b2b", "presence_route", "") 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", "db_mode", 1) 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 withing 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 the request is for other domain use UsrLoc # (in case, it does not work, use the following command # with proper names and addresses in it) if (uri==myself) { if (!lookup_domain("To")) { log(1, "Unknown domain - message should be forwarded?"); route(1); break; } if (method=="SUBSCRIBE") { if (!t_newtran()) { sl_reply_error(); break; }; if (!lookup_user("To") && (@msg.supported=~"eventlist")) { # such user doesn't exist and Supported header field # -> probably RLS subscription # if ($did=="test") { # # redefine xcap root for this domain # log(1, "test domain\n"); # $xcap_root = "http://vencore.sip-server.net/xcap"; # } # else use default if (lookup_domain("From")) { if (lookup_user("From")) { 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" query_resource_list("default"); } } } if (!have_flat_list()) { # query_resource_list failed or was not called # do standard RLS query acording to To/AOR if (!query_rls_services()) { log(1, "XCAP query failed\n"); t_reply("404", "User not found"); break; } } handle_rls_subscription("1"); break; } # SUBSCRIBE to existing user if (handle_subscription("registrar")) {; # uses uid from AVP (get_to_uid) #owi: if (@msg.event=~"presence\.winfo") { #owi: # log(1, "subscription to watcherinfo\n"); #owi: dump_stored_winfo("registrar", "presence"); #owi: } #owi: else { #owi: if (@msg.event=~"presence") { #owi: # log(1, "subscription to presence\n"); #owi: # if offline user and new subscription (empty to tag) #owi: if (!target_online("registrar") && (@to.tag=="")) { #owi: store_winfo("registrar"); #owi: } #owi: } #owi: } break; # something has to be here } break; }; # get user (common for all other messages than SUBSCRIBE) if (!lookup_user("To")) { log(1, "Unknown user - message should be forwarded?"); # # break; append_hf("P-hint: unknown user\r\n"); } if (method=="REGISTER") { # Uncomment this if you want to use digest authentication # if (!www_authorize("iptel.org", "subscriber")) { # www_challenge("iptel.org", "0"); # break; # }; save("location"); break; }; if (method=="PUBLISH") { if (!t_newtran()) { # log(1, "newtran error\n"); sl_reply_error(); break; }; handle_publish("registrar"); # deliver messages to online user # TODO: only if user goes from offline to online? if (target_online("registrar")) { # MSILO - dumping user's offline messages # log(1, "Dumping stored messages\n"); m_dump("sip:127.0.0.1"); } 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; }; if (method=="MESSAGE") { if (target_online("registrar")) { # log(1, "MESSAGE for online user\n"); # forward message to TAS #if (!t_forward_nonack("localhost", 5060); if (lookup("location")) { # log(1, "Delivering MESSAGE\n"); if (!t_relay()) { sl_reply_error(); }; } else { if (!t_newtran()) { log(1, "newtran error\n"); sl_reply_error(); break; }; if (m_store("0", "sip:127.0.0.1")) { if (!t_reply("202", "Accepted")) { sl_reply_error(); } } else { if (!t_reply("503", "Service Unavailable")) { sl_reply_error(); }; } } # set failure route, if fails store the message break; } else { # MSILO - storing as offline message # TODO: store only text messages NOT isComposing... ! log(1, "storing MESSAGE using MSILO\n"); if (!t_newtran()) { log(1, "newtran error\n"); sl_reply_error(); break; }; if (m_store("0", "sip:127.0.0.1")) { # log(1, "MSILO: offline message stored\n"); if (!t_reply("202", "Accepted")) { sl_reply_error(); }; } else { log(1, "MSILO: offline message NOT stored\n"); if (!t_reply("503", "Service Unavailable")) { sl_reply_error(); }; }; } 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(); }; }