Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####### Global Parameters #########
- debug=3
- log_stderror=yes
- log_facility=LOG_LOCAL0
- fork=no
- children=5
- /* uncomment the next line to disable TCP (default on) */
- disable_tcp=yes
- /* uncomment the next line to enable the auto temporary blacklisting of
- not available destinations (default disabled) */
- disable_dns_blacklist=yes
- /* uncomment the next line to enable IPv6 lookup after IPv4 dns
- lookup failures (default disabled) */
- #dns_try_ipv6=yes
- /* uncomment the next line to disable the auto discovery of local aliases
- based on revers DNS on IPs (default on) */
- #auto_aliases=no
- port=5060
- #listen=udp:192.168.1.2:5060
- listen=215.22.22.22:5060
- ####### Modules Section ########
- # Set module path.
- mpath="/usr/local/lib/kamailio/modules/"
- loadmodule "sl.so"
- loadmodule "tm.so"
- loadmodule "rr.so"
- loadmodule "maxfwd.so"
- loadmodule "textops.so"
- loadmodule "mi_fifo.so"
- loadmodule "uri.so"
- loadmodule "xlog.so"
- loadmodule "options.so"
- loadmodule "dialog.so"
- ### --- Module-specific parameters --- ###
- # ----- mi_fifo params -----
- modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
- # ---- tm params ---- #
- modparam("tm", "enable_stats", 0)
- # ----- rr params -----
- # add value to ;lr param to cope with most of the UAs
- modparam("rr", "enable_full_lr", 1)
- # do not append from tag to the RR (no need for this script)
- modparam("rr", "append_fromtag", 0)
- # ----- dialog params ----- #
- modparam("dialog", "enable_stats", 0)
- modparam("dialog", "hash_size", 128)
- modparam("dialog", "rr_param", "dlgcor")
- modparam("dialog", "dlg_flag", 2)
- modparam("dialog", "default_timeout", 120000)
- modparam("dialog", "dlg_match_mode", 2)
- modparam("dialog", "profiles_with_value", "incoming")
- #############################
- ### REQUEST ROUTING LOGIC ###
- #############################
- ## -- Main REQUEST-ROUTE -- ##
- route {
- if (!mf_process_maxfwd_header("10")) {
- sl_send_reply("483","Too Many Hops");
- exit;
- }
- # Reply to OPTIONS pings as necessary.
- if(is_method("OPTIONS")) {
- sl_send_reply("200", "OK");
- exit;
- }
- # Add Record-route header if appropriate.
- if(!is_method("REGISTER|OPTIONS"))
- record_route();
- # if(loose_route()) {
- # xlog("L_INFO", "[LOOSE -->] Performing loose routing for $rm\n");
- #
- # if(has_totag()) {
- # xlog("L_INFO", "[LOOSE -->] This request is in-dialog - to-tag present.\n");
- # } else {
- # xlog("L_INFO", "[LOOSE -->] This request is out-of-dialog - no to-tag.\n");
- # }
- # }
- if(src_ip == 198.225.86.10) {
- if(is_method("INVITE")) {
- rewritehostport("210.23.22.23:5060");
- xlog("L_INFO", "Relaying $rm from $rd to $ru\n");
- setflag(2);
- set_dlg_profile("incoming", "$fU");
- xlog("[D] Added new dialog for $fU\n");
- t_on_reply("1");
- t_on_failure("1");
- if(!t_relay()) {
- sl_reply_error();
- exit;
- }
- } else {
- xlog("L_INFO", "[SWITCH] Relaying $rm from $rd to $ru (DTAG=$fU)\n");
- if(is_in_profile("incoming", "$fU")) {
- xlog("L_INFO", "[SWITCH] [D] This $rm request is in-dialog for a dialog for $fU\n");
- } else {
- xlog("L_INFO", "[SWITCH] [D] No dialog affinity for this $rm\n");
- }
- t_on_reply("2");
- if(!t_relay()) {
- sl_reply_error();
- exit;
- }
- get_profile_size("incoming", "7709600101", "$avp(S:dlg_sz)");
- xlog("L_INFO", "[SWITCH] [D] Profile size for 7709600101 now: $avp(S:dlg_sz)\n");
- }
- } else {
- xlog("L_INFO", "[Z-END] Relaying $rm to $ru (DTAG=$fU)\n");
- if(is_in_profile("incoming", "$fU")) {
- xlog("L_INFO", "[Z-END] [D] This request is in-dialog for a dialog for $fU\n");
- }
- t_on_reply("2");
- if(!t_relay()) {
- sl_reply_error();
- exit;
- }
- }
- }
- ### -- FAILURE-ROUTE for INVITEs -- ###
- failure_route[1] {
- xlog("L_INFO", "[FAILURE-ROUTE 1] Removing dialog for cause $rs\n");
- if(is_in_profile("incoming", "$fU"))
- unset_dlg_profile("incoming", "$fU");
- }
- ### -- ONREPLY-ROUTE for INVITEs -- ###
- onreply_route[1] {
- if(t_check_status("^1.+")) {
- xlog("L_INFO", "[ONREPLY-ROUTE 1] Provisional reply $rs received.\n");
- exit;
- }
- else if(t_check_status("200")) {
- xlog("L_INFO", "[ONREPLY-ROUTE 1] 200 OK received for $fU\n");
- }
- if(is_in_profile("incoming", "$fU")) {
- xlog("L_INFO", "[ONREPLY-ROUTE 1] $rm/$rs is part of dialog for $fU\n");
- get_profile_size("incoming", "$fU", "$avp(S:dlg_sz)");
- xlog("L_INFO", "[ONREPLY-ROUTE 1] Dialog profile size is: $avp(S:dlg_sz)\n");
- }
- }
- ### -- ONREPLY-ROUTE for BYEs and CANCELs -- ###
- onreply_route[2] {
- xlog("L_INFO", "[ONREPLY-ROUTE 2] Received $rs for $rm\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement