Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!KAMAILIO
- #
- # sample config file for dispatcher module
- # - load balancing of VoIP calls with round robin
- # - no TPC listening
- # - don't dispatch REGISTER and presence requests
- #
- # Kamailio (OpenSER) SIP Server v3.2
- # - web: http://www.kamailio.org
- # - git: http://sip-router.org
- #
- # Direct your questions about this file to: sr-users@lists.sip-router.org
- #
- # Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
- # for an explanation of possible statements, functions and parameters.
- #
- # Several features can be enabled using '#!define WITH_FEATURE' directives:
- #
- # *** To run in debug mode:
- # - define WITH_DEBUG
- #
- #!define WITH_DEBUG
- ####### Global Parameters #########
- #!ifdef WITH_DEBUG
- debug=4
- log_stderror=yes
- #!else
- debug=2
- log_stderror=no
- #!endif
- memdbg=5
- memlog=5
- log_facility=LOG_LOCAL0
- fork=yes
- children=4
- port=5060
- listen=udp:172.31.11.35:5060 advertise ec2-35-166-179-244.us-west-2.compute.amazonaws.com:5060
- sip_warning=no
- ####### Modules Section ########
- # set paths to location of modules (to sources or installation folders)
- #!ifdef WITH_SRCPATH
- mpath="modules"
- #!else
- mpath="/usr/local/lib64/kamailio/modules/"
- #!endif
- loadmodule "db_mysql.so"
- loadmodule "mi_fifo.so"
- loadmodule "kex.so"
- loadmodule "tm.so"
- loadmodule "tmx.so"
- loadmodule "sl.so"
- loadmodule "rr.so"
- loadmodule "pv.so"
- loadmodule "maxfwd.so"
- loadmodule "textops.so"
- loadmodule "siputils.so"
- loadmodule "xlog.so"
- loadmodule "sanity.so"
- loadmodule "ctl.so"
- loadmodule "mi_rpc.so"
- loadmodule "acc.so"
- loadmodule "dispatcher.so"
- loadmodule "corex.so"
- loadmodule "nathelper.so"
- # ----- rr params -----
- # add value to ;lr param to cope with most of the UAs
- modparam("rr", "enable_full_lr", 0)
- # do not append from tag to the RR (no need for this script)
- modparam("rr", "append_fromtag", 0)
- # ----- acc params -----
- modparam("acc", "log_flag", 1)
- modparam("acc", "failed_transaction_flag", 3)
- modparam("acc", "log_extra",
- "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")
- # ----- tm params -----
- modparam("tm", "fr_timer", 2000)
- modparam("tm", "fr_inv_timer", 40000)
- # ----- dispatcher params -----
- modparam("dispatcher", "list_file", "/usr/local/etc/kamailio/dispatcher.list")
- #modparam("dispatcher", "db_url", DBURL)
- modparam("dispatcher", "table_name", "dispatcher")
- modparam("dispatcher", "flags", 2)
- modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
- modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
- modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
- ####### Routing Logic ########
- # main request routing logic
- route {
- # handle requests within SIP dialogs
- route(WITHINDLG);
- if(!ds_select_dst("1", "0"))
- {
- send_reply("404", "No destination");
- exit;
- }
- route(RELAY);
- exit;
- }
- route[RELAY] {
- if (!t_relay()) {
- sl_reply_error();
- }
- exit;
- }
- # Handle requests within SIP dialogs
- route[WITHINDLG] {
- if (has_totag()) {
- # sequential request withing a dialog should
- # take the path determined by record-routing
- if (loose_route()) {
- if (is_method("BYE")) {
- setflag(1); # do accounting ...
- setflag(3); # ... even if the transaction fails
- }
- route(RELAY);
- } else {
- if ( is_method("ACK") ) {
- if ( t_check_trans() ) {
- # non loose-route, but stateful ACK;
- # must be ACK after a 487 or e.g. 404 from upstream server
- t_relay();
- exit;
- } else {
- # ACK without matching transaction ... ignore and discard.
- exit;
- }
- }
- sl_send_reply("404","Not here");
- }
- exit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement