ERROR: receive_fd: EOF on 15 child process 26410 exited by a signal 11 core was generated INFO: terminating due to SIGCHLD INFO: signal 15 received .... repeated ... INFO:mi_fifo:mi_destroy: seems that fifo child is already dead!
I've added xlog lines to narrow down where it is crashing. It hasn't crashed since that so not sure exactly where it is crashing in the script. I think it is crashing some where around a avp_db_load: if ( avp_db_load("$ru/username","*/usr_preferences_to") )
It doesn't always crash on setting up a call... just when I'm not watching for it.
Thanks Dave PS my first time posting to a user list so not sure just how things work for it. Pointers welcome.
here is some pert info about my install:
version: openser 1.2.1-notls (i386/linux) flags: STATS: Off, USE_IPV6, USE_TCP, DISABLE_NAGLE, USE_MCAST, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535 poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. svnrevision: unknown @(#) $Id: main.c 1827 2007-03-12 15:22:53Z bogdan_iancu $ main.c compiled on 11:12:59 Sep 6 2007 with gcc 4.1.1
Hi!
Dave Singer schrieb:
core was generated
You are lucky - you have a core dump. This allows you to analyze why openser crashed.
gdb /usr/sbin/openser /location/to/core-file
Usually the core is in the directory where you started openser, or in / or somewhere else ;-)
gdb will show you where openser crashed. With the command "bt" you get backtrace which shows openser's stack before crashing.
please send the output of gdb to the list.
regards klaus
INFO: terminating due to SIGCHLD INFO: signal 15 received .... repeated ... INFO:mi_fifo:mi_destroy: seems that fifo child is already dead!
I've added xlog lines to narrow down where it is crashing. It hasn't crashed since that so not sure exactly where it is crashing in the script. I think it is crashing some where around a avp_db_load: if ( avp_db_load("$ru/username","*/usr_preferences_to") )
It doesn't always crash on setting up a call... just when I'm not watching for it.
Thanks Dave PS my first time posting to a user list so not sure just how things work for it. Pointers welcome.
here is some pert info about my install:
version: openser 1.2.1-notls (i386/linux) flags: STATS: Off, USE_IPV6, USE_TCP, DISABLE_NAGLE, USE_MCAST, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535 poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. svnrevision: unknown @(#) $Id: main.c 1827 2007-03-12 15:22:53Z bogdan_iancu $ main.c compiled on 11:12:59 Sep 6 2007 with gcc 4.1.1
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
Accidently replied directly to clause. So here is a summary: Sent core dump and system spec info like openser ver. Klaus suggested upgrading to the latest openser 1.2 svn code, trying again, include pert part of openser.cfg, sip packet capture, and making a bug report.
So I'm now using latest svn of openser 1.2 as of 11/12/07 on a different server (the backup server) Problem still persists.
gdb of one of the core dumps is included below. Below that is a nuterized (my personal server and gateway info cleaned out) openser.cfg
Thanks Dave
Below is the gdb of one of the cores:
Using host libthread_db library "/lib/libthread_db.so.1". warning: Can't read pathname for load map: Input/output error. Core was generated by `/usr/local/sbin/openser'. Program terminated with signal 11, Segmentation fault. #0 0x0808f152 in comp_scriptvar (msg=<value optimized out>, op=<value optimized out>, left=<value optimized out>, right=0x817ab9c) at route.c:748 748 backup = s1->s[s1->len]; s1->s[s1->len] = '\0';
openser.cfg:
# # $Id: openser.cfg,v 1.6 2006/02/15 18:23:46 bogdan_iancu Exp $ # # simple quick-start config script #
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E) log_facility=LOG_LOCAL7 log_name="openser"
# Uncomment these lines to enter debugging mode #fork=no #log_stderror=yes #listen=eth0 # check_via=no # (cmd. line: -v) dns=yes # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4 disable_dns_blacklist=yes
#listen=udp:eth0 #fifo="/tmp/openser_fifo" #fifo_db_url="postgres://seronstar:garney@208.76.152.52/seronstar"
# # uncomment the following lines for TLS support #disable_tls = 0 #listen = tls:your_IP:5061 #tls_verify = 1 #tls_require_certificate = 0 #tls_method = TLSv1 #tls_certificate = "/var/tmp/portage/net-misc/openser-1.1.0 /image///etc/openser/tls/user/user-cert.pem" #tls_private_key = "/var/tmp/portage/net-misc/openser-1.1.0 /image///etc/openser/tls/user/user-privkey.pem" #tls_ca_list = "/var/tmp/portage/net-misc/openser-1.1.0 /image///etc/openser/tls/user/user-calist.pem"
# # ------------------ module loading ----------------------------------
mpath="/usr/local/lib/openser/modules/" # Uncomment this if you want to use MySQL database #loadmodule "mysql.so"
loadmodule "postgres.so" loadmodule "mysql.so" loadmodule "mi_fifo.so" loadmodule "xlog.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "usrloc.so" loadmodule "registrar.so" loadmodule "textops.so" loadmodule "avpops.so" loadmodule "group.so" loadmodule "uri.so" loadmodule "uri_db.so" loadmodule "alias_db.so" # Uncomment this if you want digest authentication # postgres.so must be loaded ! loadmodule "auth.so" loadmodule "auth_db.so" loadmodule "acc.so" loadmodule "uac.so" loadmodule "diversion.so" loadmodule "mediaproxy.so" loadmodule "domain.so" loadmodule "lcr.so"
# ----------------- setting module-specific parameters ---------------
# -- usrloc params -- #modparam("usrloc", "db_mode", 0) # Uncomment this if you want to use SQL database # for persistent storage and comment the previous line modparam("usrloc", "db_mode", 2) modparam("usrloc", "nat_bflag", 6)
#modparam("usrloc|avpops|auth_db|group|acc|uri_db|alias_db", #modparam("usrloc|auth_db|group|acc|uri_db|alias_db|avpops", modparam("usrloc|auth_db|group|acc|uri_db|alias_db|avpops|domain|lcr", "db_url","mysql://openser:openser@dbserver.myserver.net/openser")
# "db_url","postgres://openser:openser@dbserver.myserver.net/openser")
#modparam("avpops", "avp_table", "avp_table") modparam("avpops", "avp_table", "usr_preferences")
# UAC (User Agent Client) module provides some basic UAC functionalities like FROM header manipulation (anonymization) or client authentication. modparam("uac", "rr_store_param", "vsf") modparam("uac", "from_restore_mode", "auto")
# -- auth params -- # Uncomment if you are using auth module modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "load_credentials", "$avp(s:rpid)=rpid;email_address") modparam("auth", "rpid_avp", "$avp(s:rpid)") # # If you set "calculate_ha1" parameter to yes (which true in this config), # uncomment also the following parameter) # modparam("auth_db", "password_column", "password")
modparam("tm", "fr_inv_timer_avp", "$avp(i:25)") modparam("tm", "fr_timer", 2)
# -- rr params -- # add value to ;lr param to make some broken UAs happy #modparam("rr", "enable_full_lr", 1) #modparam("rr", "append_fromtag", 1)
# -- FIFO options starting with openser 1.2 modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo") modparam("mi_fifo", "fifo_mode", 0600) #modparam("mi_fifo", "fifo_group", 0) #modparam("mi_fifo", "fifo_group", "root") #modparam("mi_fifo", "fifo_user", 0) #modparam("mi_fifo", "fifo_user", "root") modparam("mi_fifo", "reply_dir", "/tmp/")
modparam("mediaproxy", "mediaproxy_socket", "/var/run/proxydispatcher.sock") modparam("domain", "db_mode", 1)
modparam("acc", "early_media", 0) modparam("acc", "failed_transaction_flag", 24) modparam("acc", "report_ack", 0) modparam("acc", "report_cancels", 0) modparam("acc", "log_flag", 0) modparam("acc", "log_missed_flag", 0) modparam("acc", "log_level", 2) modparam("acc", "db_flag", 25) modparam("acc", "db_missed_flag", 0) modparam("acc", "db_table_acc", "acc") modparam("acc", "db_table_missed_calls", "missed_calls") modparam("acc", "detect_direction", 1) modparam("acc", "db_extra", "src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd") #modparam("acc", "multi_leg_info", "diversion_user=$di{url.user };diversion_domain=$di{uri.domain}") modparam("acc", "multi_leg_info", "diversion_user=$avp(s:diversion_user);diversion_domain=$avp(s:diversion_domain)")
modparam("lcr","gw_uri_avp","gw_uri_avp")
modparam("lcr", "gw_table", "gw") modparam("lcr", "gw_name_column", "gw_name") modparam("lcr", "ip_addr_column", "ip_addr") modparam("lcr", "port_column", "port") modparam("lcr", "uri_scheme_column", "uri_scheme") modparam("lcr", "transport_column", "transport") modparam("lcr", "grp_id_column", "grp_id") modparam("lcr", "lcr_table", "lcr") modparam("lcr", "strip_column", "strip") modparam("lcr", "prefix_column", "prefix") modparam("lcr", "from_uri_column", "from_uri") modparam("lcr", "priority_column", "priority") #modparam("lcr", "gw_uri_avp", "1400") modparam("lcr", "ruri_user_avp", "1402") modparam("lcr", "contact_avp", "1401") modparam("lcr", "fr_inv_timer_avp", "s:fr_inv_timer_avp") modparam("lcr", "fr_inv_timer", 90) modparam("lcr", "fr_inv_timer_next", 30) modparam("lcr", "rpid_avp", "s:rpid")
# ------------------------- what set?flags mean --------------------
## General Flags ##
# setflag(1); # from PSTN gateway # setflag(2); # from local user # setflag(3); # user NOT allowed to make pstn calls # setflag(4); # user account IS disabled # setflag(24); # account failed transactions # setflag(25); # account successful transactions
## Branch Flags # setbflag(22); # mark media proxy as started
# ------------------------- request routing logic -------------------
# main routing logic
route{
# 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"); xlog("L_INFO", "Sanity Check: Too Many Hops\n"); exit; xlog("L_INFO", "ignored break\n"); };
if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); xlog("L_INFO", "Sanity Check: Message too big\n"); exit; };
# 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 (is_method("OPTIONS") || is_method("NOTIFY")) { exit; } if (method!="REGISTER" && method!="ACK") { record_route(); xlog("L_INFO", "start route logic: r-uri <$ru> f-uri <$fu> f-Usr <$fU> FromDisplay $fn\n"); xlog("L_INFO", "Recording Route: r-uri <$ru>\n"); setflag(24); # account failed transactions setflag(25); # account successful transactions };
# 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"); xlog("L_INFO", "following previous route: r-uri <$ru>\n"); if(is_method("BYE")) { setflag(24); # account failed transactions setflag(25); # account successful transactions } route(1); exit; };
if (uri==myself) { xlog("L_INFO", "message to me, Req Meth $rm\n"); if (method=="REGISTER") { route(5); }; setflag(24); # account failed transactions setflag(25); # account successful transactions if(is_method("CANCEL") || is_method("ACK")) { if(t_check_trans()) { route(1); } else {
xlog("L_INFO", "Dropping mis-routed request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); } exit; } # if(from_uri==myself) # { # # need to make this detect an infinite loop, sometimes simulring may send to loop to call other phone numbers # xlog("L_INFO", "Dropping local loop-back oops - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); # drop(); # }
# guilty until proven innocent... don't let call go to PSTN unless the server or user is authorized for that through later checks. setflag(3) ; # user not allowed to make pstn calls
#if ( from_gw("1") ) if ( uri =~ "sip.myserver.net" && is_present_hf("Remote-Party-ID") ) { xlog("L_INFO", "Looks like it came from a verizon gateway server, aka PSTN\n"); setflag(1); # from PSTN Gateway } else { xlog("L_INFO", "Its NOT from a verizon gateway server, aka PSTN\n"); } if ( ! isflagset(1) ) # if not from PSTN { route(9) ; # load settings for calling user. if ( ! isflagset(2) ) # if NOT local user { route(10) ; # check for and load settings for calling domain. } } if ($rP=~"tcp") { avp_printf("$avp(s:DestURI)", "sip:$rU@$rd;transport=UDP" ); avp_pushto("$ru", "$avp(s:DestURI)" ); } route(3); # Clean it up and send it our user if appropriate. route(4); # Send our little one to the world and hope it survives :'(
} }
error_route { xlog("L_INFO", "--- error route class=$(err.class) level=$(err.level) info=$(err.info) rcode=$(err.rcode) rreason=$(err.rreason) ---\n"); xlog("L_INFO", "--- error from [$si:$sp]\n+++++\n$mb\n++++\n"); #sl_send_reply("$err.rcode", "$err.rreason"); route(7); # stop media proxy exit; }
route[1] { xlog("L_INFO", "Request leaving server - M=$rm RURI=$ru Proto=$dP F=$fu T=$tu IP=$si ID=$ci\n"); # for TC51 ( when device unreachable proper 403 is not returned ) #sl_send_reply("100", "Giving a try"); #sl_send_reply("403", "Not Reachable"); #drop() ; #t_on_failure("1"); if ( ! uri==myself ) { if ( is_method("INVITE")) route(6); # start media proxy if ( is_method("CANCEL")) route(7); # stop media proxy } t_on_reply("1"); if(isflagset(24) || isflagset(25)) route(8); # populate accounting info $avp(i:25)=5000 ; if (!t_relay()) { # This section doesn't seem to be reached even on failures. xlog("L_INFO", "Failed sending to: $ru\n"); xlog("L_INFO", "--- error route class=$(err.class) level=$(err.level) info=$(err.info) rcode=$(err.rcode) rreason=$(err.rreason) ---\n"); xlog("L_INFO", "--- error from [$si:$sp] \n +++++\n$mb\n++++\n"); sl_send_reply("$err.rcode", "$err.rreason"); route(7); # stop media proxy } exit; }
route[2] { xlog("Now in route_2\n"); xlog("L_INFO", "Checking if $rU is one of our numbers\n"); $avp(s:Original_User) = $rU ; # ok to load avps for potential TO user, # If the user doesn't exist the avp's for the from user won't be over writen # and we are not pulling the from specific user preferences. if ( avp_db_load("$ru/username","*/usr_preferences_to") ) { xlog("L_INFO", "avp_db_load was successfull\n"); } else { xlog("L_INFO", "avp_db_load failed with return code: $rc\n"); } if (is_avp_set("$avp(s:call_forward)")) { # hard forward to new user/number xlog("L_INFO", "$rU is hard forwarded to $avp(s:call_forward) \n"); add_diversion("user-unavailable"); # set user that we will load new from user preferences for. $avp(s:from_usr_tmp) = $ru; route(9); # load from user preferences avp_pushto("$ru/username", "$avp(s:call_forward)"); rewritehost("127.0.0.1"); avp_delete("$avp(s:via)/g"); # look up for if new number is one of ours and has settings avp_db_load("$ru{uri.user}/username","*/usr_preferences_to"); route(8); # set vars for accounting diversion info.
#avp_db_load("$avp(s:call_forward)/username","*/usr_preferences_to"); # TODO: should do a loop to check for new num forwarding and make sure not infinite loop. } if (alias_db_lookup("dbaliases")) { if (!uri==myself) { avp_pushto("$ru/username", "$avp(s:Original_User)"); xlog("L_INFO", "routing for gateway_dbaliases: r-uri <$ru>\n"); route(1); } else { xlog("L_INFO", "dbaliases changed user to $rU>\n"); } } else { xlog("L_INFO", "dbaliases lookup failed w/ return code=$rc for r-uri <$ru>\n"); } if ( is_avp_set("$avp(s:num_alias)")) { avp_pushto("$ru/username", "$avp(s:num_alias)"); xlog("L_INFO", "redirecting to another number: $avp(s:num_alias)\n"); } if ( is_avp_set("$avp(s:via)")) { avp_pushto("$ru/domain", "$avp(s:via)"); xlog("L_INFO", "$rU is reached through server: $avp(s:via)\n"); } if (!uri==myself) { xlog("L_INFO", "routing to default server: $rd\n"); route(1); } xlog("L_INFO", "checking devices registered here in location table: r-uri <$ru>\n"); #lookup("location"); if (!uri==myself) { xlog("L_INFO", "routing from info in location table\n"); avp_pushto("$ru/username", "$avp(s:Original_User)"); route(1); } }
route[3] { xlog("Now in route_3\n"); # Check if it belongs to us first if ( uri=~"sip:[0-9]{7}@" ) { # Handle 7 digit numbers # by temp adding areacode from calling num # and run it against databases with our nums. xlog("L_INFO", "Caller dialed 7 digits. Checking if callers area code + $rU is one of our numbers\n"); $avp(s:FromUser)=$fU; $avp(s:OriginalDestinationNumber)=$rU; xlog("L_INFO", "avp-cid $avp(s:FromUser) avp-ariacode $avp(s:AreaCode) f-uri <$fu>\n"); avp_subst("$avp(s:FromUser)/$avp(s:AreaCode)","/^([0-9]{3}).*/\1/"); xlog("L_INFO", "avp-fU $avp(s:FromUser) avp-ariacode $avp(s:AreaCode) f-uri <$fu>\n"); avp_printf("$avp(s:NewTenDigDest)","$avp(s:AreaCode)$rU"); xlog("about to push avp NewTenDigDest: $avp(s:NewTenDigDest)"); avp_pushto("$ru/username","$avp(s:NewTenDigDest)"); } else if ( uri=~"sip:+" || uri=~"sip:+{0,1}1[0-9]{10}@" ) { # clean num to 10 digit # Remove "+" from front of incoming number. # it must have come in from verizon $avp(s:OriginalDestinationNumber)=$rU; xlog("L_INFO", "Requested number starts with +1, clean it off: $rU\n"); $avp(s:OriginalDestinationNumber)=$rU; #xlog("L_INFO", "avp-cid $avp(s:OriginalDestinationNumber) avp-ariacode $avp(s:NewTenDigDest) f-uri <$fu>\n");
avp_subst("$avp(s:OriginalDestinationNumber)/$avp(s:NewTenDigDest)","/.*([0-9]{10})$/\1/"); avp_pushto("$ru/username","$avp(s:NewTenDigDest)"); xlog("L_INFO", "avp-NewTenDigDest $avp(s:NewTenDigDest) avp-cleaned $avp(s:OriginalDestinationNumber) r-uri <$ru>\n"); } route(2); # Check db if Dest num is for us. xlog("Back from route_2\n"); if (is_avp_set("$avp(s:call_forward)") ) { xlog("Forwarding call and new num is not ours.. out to the world you go! Ha Ha Ha!\n"); route(4); } if ( is_avp_set("$avp(s:OriginalDestinationNumber)") && ! is_avp_set("$avp(s:call_forward)") ) { # restore original num incase there is more processing needed by calling process. avp_pushto("$ru/username","$avp(s:OriginalDestinationNumber)"); xlog("Restored original num: ru -> $ru"); } route(4); # Send our little one to the world and hope it survives :'(
}
route[4] { xlog("L_INFO", "In route-4: r-uri <$ru>\n"); # routing to world. xlog("L_INFO", "no location defined for uri: r-uri <$ru>\n"); #Call destination is PSTN, so send it to the gateway xlog("L_INFO", "CALL: PSTN gateway\n"); xlog("Before set: avp-rpid is $avp(s:rpid)"); if ( ! from_uri=~"sip:+" ) { avp_printf("$avp(s:rpid)","sip:+1$fU@sip.myserver.net"); xlog("NOT from ser test phone. setting avp-rpid to $avp(s:rpid)"); } else { avp_printf("$avp(s:rpid)","sip:$fU@sip.myserver.net"); xlog("NOT from ser test phone. setting avp-i13 to $avp(s:rpid)"); } if(is_present_hf("P-Asserted-Identity")) { remove_hf("P-Asserted-Identity"); } # if( ! (is_present_hf("Remote-Party-ID") && $re =~ "sip:+[1-9]+" ) ) # { if ( is_present_hf("Remote-Party-ID") ) { remove_hf("Remote-Party-ID"); } append_hf("Remote-Party-ID: <$avp(s:rpid)>;privacy=$avp(s:privacy)\r\n") ; # Append Remote-Party-ID header field # }
xlog("L_INFO", ": f-uri before with +1: f-uri <$fu>\n"); uac_replace_from("$avp(s:rpid)") ; # if (!load_gws("1")) # { # #sl_send_reply("500", "Server Internal Error - Cannot load gateways from group 1"); # #exit; # xlog("L_INFO", ": Gateways failed to load from group 1\n"); # } avp_printf("$avp(s:first_gw)","sip:$rU@<first-gw-addr>"); avp_printf("$avp(s:first_gw)","sip:$rU@<second-gw-addr>"); # xlog("L_INFO", ": Gateways loaded -- gw_uri_avp = $avp(s:gw_uri_avp)\n"); # xlog("L_INFO", ": Added entry to Gateways avp gw_uri_avp = $avp(s:gw_uri_avp)\n"); # if ( next_gw() ) # { # xlog("L_INFO", ": Gateways loaded, gw_uri_avp = $avp(s:gw_uri_avp)\n"); # } # else # { # xlog("L_INFO", ": Gateway query returned nothing, gw_uri_avp = $avp(s:gw_uri_avp)\n"); # } #t_on_branch("1"); t_on_failure("1"); avp_pushto("$ru","$avp(s:first_gw)"); # new branch for this uri xlog("L_INFO", ": first_gw branching -- $avp(s:first_gw)\n"); avp_delete("$avp(s:first_gw)"); xlog("L_INFO", ": first_gw 'next-time' branch to -- $avp(s:first_gw)\n"); route(1) ; }
route[5] { # useing digest authentication if (!www_authorize("", "subscriber")) { xlog("L_INFO", "user didn't send credentials: f-uri <$fu> r-uri <$ru>\n"); www_challenge("", "0"); exit; }; xlog("L_INFO", "user registered: f-uri <$fu>\n"); if (!src_ip==<other-loadballance-host-ip>) { t_replicate("sip:<other-loadballance-host-ip>:5060"); };
save("location"); exit; }
route[6] { # force media proxy start xlog("L_INFO", "in route 6: Start Media Proxy\n"); setbflag(22); # mark media proxy as started if(! isbflagset(22)) { xlog("L_INFO", "Starting Media Proxy\n"); if(use_media_proxy()) { xlog("L_INFO", "Started Media Proxy\n"); } else { xlog("L_INFO", "FAILED to start Media Proxy\n"); } }
# setbflag(22); # mark media proxy as started. # use_media_proxy(); }
route[7] { # force media proxy stop if (isbflagset(22)) end_media_session(); }
route[8] { #modparam("acc", "multi_leg_info", "diversion_user=$avp(s:diversion_user);diversion_domain=$avp(s:diversion_domain)") if ( is_present_hf("Diversion")) { $avp(s:diversion_user)=$di{url.user}; $avp(s:diversion_domain)=$di{uri.domain}; } }
route[9] { xlog("L_INFO", "In Route 9.\n"); if ( ! is_avp_set("$avp(s:from_usr_tmp)" ) ) #if ( $var(from_usr_tmp){s.len} == 0 ) { $avp(s:from_usr_tmp) = $fu; } xlog("L_INFO", "Loading AVPs for from user $avp(s:from_usr_tmp) if they exist\n");
#if(avp_db_load("$fu{uri.user}/username","*/usr_preferences_from"))
if(avp_db_load("$avp(s:from_usr_tmp)/username","*/usr_preferences_from")) { xlog("L_INFO", "Loaded AVPs for from user $fU\n"); setflag(2) ; # from local user # is user account set to disabled or not allowed to make calls to pstn? if ( ! is_avp_set("$avp(s:allow_call_pstn)") || avp_check("$avp(s:allow_call_pstn)", "re/yes/i") ) { resetflag(3) ; # user IS allowed to make pstn calls } else { setflag(3) ; # user IS NOT allowed to make pstn calls } if ( ! is_avp_set("$avp(s:acct_status)") || ! avp_check("$avp(s:acct_status)", "re/disabled/i") ) { resetflag(4) ; # user account IS NOT disabled } else { setflag(4) ; # user account IS disabled setflag(3) ; # user IS NOT allowed to make pstn calls }
} avp_delete("$avp(s:from_usr_tmp)"); }
route[10] # check for and load settings for calling domain. { xlog("L_INFO", "In Route 10.\n");
} onreply_route[1] { xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n"); if(! isbflagset(22) && status=~"(180)|(183)|2[0-9][0-9]") if ( is_method("CANCEL")) route(7); # stop media proxy # if ( is_method("INVITE")) # route(6); # { # xlog("L_INFO", "Starting Media Proxy\n"); # if(use_media_proxy()) # { # setbflag(22); # mark media proxy as started # xlog("L_INFO", "Started Media Proxy\n"); # } # else # { # xlog("L_INFO", "FAILED to start Media Proxy\n"); # } # } exit;
}
failure_route[1] { xlog("L_INFO", "Failure route for PSTN entered - S=$T_reply_code M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# avp_pushto("$br","$avp(s:first_gw)"); # new branch for this uri # xlog("L_INFO", ": first_gw branching -- $avp(s:first_gw)\n"); # avp_delete("$avp(s:first_gw)"); # xlog("L_INFO", ": first_gw 'next-time' branch to -- $avp(s:first_gw)\n"); if (t_check_status("(403)|(Forbiden)")) { xlog("L_INFO", "Status $T_reply_code\n"); xlog("L_INFO", "Rejected by this gateway group, skip to next group if it exists.\n"); avp_delete("$avp(s:first_gw)/g"); } if ( ! is_avp_set("$avp(s:first_gw)") ) { if ( is_avp_set("$avp(s:second_gw)")) {
avp_copy("$avp(s:second_gw)", "$avp(s:first_gw)/gd"); if ( is_avp_set("$avp(s:third_gw)")) { avp_copy("$avp(s:third_gw)", "$avp(s:second_gw)/gd"); } } else { xlog("L_INFO", "Out of gateways to try, dropping call.\n"); drop(); } } t_on_failure("1"); t_on_branch("1"); avp_pushto("$br","$avp(s:first_gw)"); # new branch for this uri avp_delete("$avp(s:first_gw)"); # t_on_failure("2"); # t_on_branch("2"); # rewritehost("65.217.40.219"); xlog("L_INFO", "Now R-URI=$ru\n"); # append_branch(); route(1); }
branch_route[1] { xlog("L_INFO", "In Branch_Route 1\n"); if(uri==myself) {
xlog("L_INFO", "Dropping local branch - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); drop(); } else { xlog("L_INFO", "In Branch_Route 1, Sending to=$ru\n"); if ( is_method("INVITE")) route(6); # start media proxy if ( is_method("CANCEL")) route(7); # stop media proxy } }
branch_route[2] { xlog("L_INFO", "In Br_Rt2, Failed Domain=$avp(s:FailedAddr)\n"); if(uri==myself ) {
xlog("L_INFO", "Dropping local branch - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); drop(); } else { xlog("L_INFO", "In Br_Rt2, Sending to=$ru Proto=$dP\n"); if ( is_method("INVITE")) route(6); # start media proxy if ( is_method("CANCEL")) route(7); # stop media proxy } }