test/acc-test.cfg
88d4cea5
 #
 # $Id$
 #
 # iptel.org real world configuration
 #
 
 # ----------- global configuration parameters ------------------------
 
 # we're debugging now
 
 debug=9          # debug level (cmd line: -dddddddddd)
 fork=no
 log_stderror=yes	# (cmd line: -E)
 
 #fork=yes
 #children=16
 #log_stderror=no	# (cmd line: -E)
 
 check_via=yes     # (cmd. line: -v)
 dns=on           # (cmd. line: -r)
 rev_dns=yes      # (cmd. line: -R)
 
 # experimental usage at port 5060
 #port=9060
 #port=8060
 port=5060
 # advertise IP address in Via (as opposed to advertising DNS name
 # which is annoying for downstream servers and some phones can
 # not handle DNS at all)
 #listen=195.37.77.101
 #listen=193.175.135.170
 # ------------------ module loading ----------------------------------
 
 loadmodule "../sip_router/modules/sl/sl.so"
 loadmodule "../sip_router/modules/print/print.so"
 loadmodule "../sip_router/modules/tm/tm_mod.so"
 #loadmodule "../sip_router/modules/acc/acc.so"
 loadmodule "../sip_router/modules/rr/rr.so"
 loadmodule "../sip_router/modules/maxfwd/maxfwd.so"
 #loadmodule "../sip_router/modules/mysql/mysql.so"
 loadmodule "../sip_router/modules/usrloc/usrloc.so"
 #loadmodule "../sip_router/modules/auth/auth.so"
 #loadmodule "../sip_router/modules/cpl/cpl.so"
 loadmodule "../sip_router/modules/radius_acc/radius_acc.so"
 loadmodule "../sip_router/modules/registrar/registrar.so"
 
 
 # ----------------- setting module-specific parameters ---------------
 
 # -- usrloc params --
 
 # use in-RAM usrloc
 #modparam("usrloc", "use_db", 0)
 
 # -- acc params --
 # report ACKs too for sake of completeness -- as we account PSTN
 # destinations which are RR, ACKs should show up
 #modparam("acc", "report_ack", 1)
 # don't bother me with early media reports (I don't like 183 
 # too much anyway...ever thought of timer C hitting after
 # listening to music-on-hold for five minutes?)
 #modparam("acc", "early_media", 0)
 #modparam("acc", "log_level", 1)
 # that is the flag for which we will account -- don't forget to
 # set the same one :-)
 #modparam("acc", "acc_flag", 1 )
 # we are interested only in succesful transactions
 #modparam("acc", "failed_transactions", 0 )
 
 
 # -- acc params --
 # report ACKs too for sake of completeness -- as we account PSTN
 # destinations which are RR, ACKs should show up
 modparam("radius_acc", "report_ack", 1)
 # don't bother me with early media reports (I don't like 183
 # too much anyway...ever thought of timer C hitting after
 # listening to music-on-hold for five minutes?)
 modparam("radius_acc", "early_media", 0)
 modparam("radius_acc", "log_level", 1)
 # that is the flag for which we will account -- don't forget to
 # set the same one :-)
 modparam("radius_acc", "acc_flag", 1 )
 # we are interested only in succesful transactions
 modparam("radius_acc", "failed_transactions", 0 )
 
 # -- tm params --
 modparam("tm", "fr_timer", 30 )
 modparam("tm", "fr_inv_timer", 60 )
 
 # -------------------------  request routing logic -------------------
 
 # main routing logic
 
 route{
 
 	# filter local stateless ACK generated by authentication of mf replies
 	sl_filter_ACK();
 
 	# filter too old messages
 	log("LOG: Checking maxfwd\n");
 	if (!mf_process_maxfwd_header("10")) {
 		log("LOG: Too many hops\n");
 		sl_send_reply("483","Too Many Hops");
 		break;
 	};
 
 	# len_gt *after* max_fwd, otherwise an "INVITE sip:sos@0.0.0.0"
 	# will cause "message too big" for a short message
 
 	if (len_gt( max_len )) {
 		sl_send_reply("513", "Riesengross -- Message too large");
 		break;
 	};
 
 	# Do strict routing if route headers present
 	if (method=="INVITE") {
 		addRecordRoute();
 	} else {
 		rewriteFromRoute();
 	};
 
 
 	# that is outbound request...
 
 	if (!(uri=~"fox\.iptel\.org([;:].*)*" 
 		| uri=~"[@:\.]195\.37\.77\.101([;:].*)*"  )) {
 		route(2);
 		# break from route (2) return -- stop then !
 		break;
 	};
 	# here we continue with requests for our domain...
 
 	if (method=="REGISTER") {
 		# update Contact database
        	log("LOG: REGISTER is authorized, saving location\n");
 		save("location");
 		break;
 	};
 
 	# native SIP destinations are handled using our USRLOC DB
 	if (!lookup("location")) {
 		if (method=="ACK") {
 			log("Ooops -- an ACK made it here -- probably UAC screwed up to-tags\n");
 			break;
 		};
 		log("LOG: Unable to lookup contact, sending 404\n");
 		sl_send_reply("404", "Not Found");
 		break;
 	};
 
 	# label for accounting
 	setflag(1);
 	# we now know we may, we know where, let it go out now!
 	if (!t_relay()) {
 		sl_reply_error();
 		break;
 	};
 }
 #---------------------------------------------------------------------
 
 # routing logic for outbound requests targeted out of our domain
 # -- use outbound proxy iptel.org (note that except to FOKUS/PBX,
 # or itpel.org users, requests will be challenged)
 route[2] {
 		log("LOG: that's a request to outside");
 		# label for accounting
 		setflag(1);
 		if (!t_relay_to("fox.iptel.org", "5060")) {
 			sl_reply_error();
 			break;
 		};
 }