[SR-Users] Kamailio V 2.4.2 Dialog_ng crash and IMS_USRLOC_SCSCF doc

ycaner yasin.caner at netgsm.com.tr
Wed Apr 8 11:13:51 CEST 2015


Hello Daniel,
Thanks for reply. I found the problem. it is about ACCDB. when i active
WITH_ACCDB , after t_relay function ,dialog_ng is crashed. I added simple
cfg. I try to change flags to fix problem. bu i think it isn't about it.

Kamailio V2.4.2 Centos 6.6 64 bit Linux ims-kamailio.localdomain
2.6.32-504.12.2.el6.x86_64 #1 SMP Wed Mar 11 22:03:14 UTC 2015 x86_64 x86_64
x86_64 GNU/Linux


How to debug it to fix this problem? When i increase debug level , cant see
anything because of imuxsock.

Thanks.

#!KAMAILIO 
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_ACC
#!define WITH_ACCDB
#!define WITH_ACCDB_COMMENT
#!define WITH_DIALOGNG
#!define WITH_MULTIDOMAIN
#!define WITH_ANTIFLOOD
#!define WITH_NAT

#!ifdef ACCDB_COMMENT

  ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
  ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default '';
  ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
  ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT
'';
  ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL
DEFAULT '';
  ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL default
'';
  ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT
'';
  ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT
'';
  ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL
DEFAULT '';
#!endif
####### Defined Values #########
# *** Value defines - IDs used later in config

#!ifdef WITH_MYSQL
#!define DBURL "mysql://root:x@localhost/kamailio"
#!define DBURLCDR "mysql://root:x@localhost/kamailio_cdr"
#!define DBURLLOC "mysql://root:x@localhost/kamailio_loc"
#!endif

#!ifdef WITH_MULTIDOMAIN
#!define MULTIDOMAIN 1
#!else
#!define MULTIDOMAIN 0
#!endif
 
# - flags
#   FLT_ - per transaction (message) flags
#	FLB_ - per branch flags
#!define FLT_ACC 9
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3
#!define FLT_DIALOG 4 
#!define FLT_NATS 5
#!define FLB_NATB 6
#!define FLB_NATSIPPING 7

#!define DLG_TIMEOUT_AVP "i:1"
 
####### Global Parameters #########
 
#!ifdef WITH_DEBUG
#debug=0
debug=4
#log_stderror=no
log_stderror=no
#!else
debug=0
#debug=2
log_stderror=no
#!endif

memdbg=5
memlog=5
 
log_facility=LOG_LOCAL0
 
fork=yes
children=8
sip_warning=0 
#disable_tcp=yes
 
#auto_aliases=no
 
#alias="sip.mydomain.com"

listen=udp:x:5060
port=5060

user_agent_header="User-Agent: NetGSM SoftSwitch"
server_header="Server: NetGSM"
#!ifdef WITH_TLS
enable_tls=no
#!endif
 
# life time of TCP connection when there is no traffic
# - a bit higher than registration expires to cope with UA behind NAT
tcp_connection_lifetime=3605
 
####### Custom Parameters #########
 
# These parameters can be modified runtime via RPC interface
# - see the documentation of 'cfg_rpc' module.
#
# Format: group.id = value 'desc' description
# Access: $sel(cfg_get.group.id) or @cfg_get.group.id
#
####### Modules Section ########
 
# set paths to location of modules (to sources or installation folders)
#!ifdef WITH_SRCPATH
mpath="modules_k:modules"
#!else
mpath="/usr/local/lib64/kamailio/modules_k/:/usr/local/lib64/kamailio/modules/"
#!endif
 
#!ifdef WITH_MYSQL
loadmodule "db_mysql.so"
#!endif
 
loadmodule "mi_fifo.so"
loadmodule "sqlops.so"
loadmodule "kex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"

loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"
loadmodule "mi_rpc.so"
loadmodule "acc.so"
loadmodule "rtimer.so"
loadmodule "db_flatstore.so"
loadmodule "cfgutils.so"
loadmodule "utils.so"

#!ifdef WITH_DIALOGNG
loadmodule "dialog_ng.so"
#!endif

#!ifdef WITH_AUTH
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "permissions.so"
#!endif
 
#!ifdef WITH_ALIASDB
loadmodule "alias_db.so"
#!endif
 
#!ifdef WITH_SPEEDDIAL
loadmodule "speeddial.so"
#!endif
 
#!ifdef WITH_MULTIDOMAIN
loadmodule "domain.so"
#!endif
 
#!ifdef WITH_PRESENCE
loadmodule "presence.so"
loadmodule "presence_xml.so"
#!endif
 
#!ifdef WITH_NAT
loadmodule "nathelper.so"
loadmodule "rtpproxy.so"
#!endif

#!ifdef WITH_ANTIFLOOD
loadmodule "htable.so"
loadmodule "pike.so"
#!endif
 
#!ifdef WITH_XMLRPC
loadmodule "xmlrpc.so"
#!endif
 
#!ifdef WITH_DEBUG
loadmodule "debugger.so"
#!endif


#!ifdef WITH_DROUTING
loadmodule "drouting.so"
#!endif

#carrierroute module 
loadmodule "carrierroute.so"

 

#---------------cdr accounting ----------------

#modparam("acc", "log_level", 1)
#modparam("acc", "log_flag", 1)


# ----------------- setting module-specific parameters ---------------






# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
 

# ----- carrierroute -------
modparam("carrierroute","config_source","db")
modparam("carrierroute","db_url",DBURL)
modparam("carrierroute","carrierroute_table","carrierroute")
modparam("carrierroute","default_tree","default")
## tekrar yuklenirken cabuk olsun diye asagidaki limit yazilabilir.
modparam("carrierroute", "fetch_rows", 2000)
modparam("carrierroute", "subscriber_table", "subscriber")
modparam("carrierroute", "subscriber_user_col", "username")
modparam("carrierroute", "subscriber_carrier_col", "cr_preferred_carrier")




#-----------dynamic routing------------
#-------------------------------------------

 
# ----- tm params -----
modparam("tm", "failure_reply_mode", 3)
modparam("tm", "fr_timer", 11000)
modparam("tm", "fr_inv_timer", 120000)
 
 
# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
modparam("rr", "append_fromtag", 1)
modparam("rr", "add_username", 1)
modparam("rr", "custom_user_avp", "$avp(customuseravp)")
 
 
# ----- registrar params -----
modparam("registrar", "method_filtering", 1)
/* uncomment the next line to disable parallel forking via location */
# modparam("registrar", "append_branches", 0)
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
# max value for expires of registrations
modparam("registrar", "max_expires", 120)
# set it to 1 to enable GRUU
modparam("registrar", "gruu_enabled", 0)
 
#!ifdef WITH_ACC 
# ----- acc params -----
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
modparam("acc", "detect_direction", 0)
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "log_flag", FLT_ACC)
#!endif


#!ifdef WITH_ACCDB
modparam("acc",	"cdr_enable", 1)
modparam("acc", "early_media", 0) 
modparam("acc", "report_ack", 1) 
modparam("acc", "report_cancels", 1) 
modparam("acc", "detect_direction", 0)
modparam("acc", "db_url", DBURLCDR) 
modparam("acc", "log_flag", FLT_ACC) 
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
modparam("acc", "db_table_missed_calls", "missed_calls")
modparam("acc", "db_flag", FLT_ACC) 
modparam("acc", "acc_time_column", "calldatetime") 
modparam("acc",
"db_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_user=$rU;dst_domain=$rd")
#!endif 

# ----- usrloc params -----
/* enable DB persistency for location entries */
#!ifdef WITH_USRLOCDB
modparam("usrloc", "db_url", DBURLLOC)
modparam("usrloc", "db_mode", 2)
#modparam("usrloc", "use_domain", MULTIDOMAIN)
modparam("usrloc", "db_ops_ruid", 1)
modparam("usrloc", "use_domain", 0)
#!endif
 
 
# ----- auth_db params -----
#!ifdef WITH_AUTH
modparam("auth_db", "db_url", DBURL)
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "load_credentials",
"$avp(permit_ip)=permit_ip;$avp(src_userid)=userid")
modparam("auth_db", "password_column", "sippasswd")
modparam("auth_db", "use_domain", MULTIDOMAIN)
modparam("auth_db", "domain_column","domain")
modparam("permissions", "db_url", DBURL)
modparam("permissions", "db_mode", 1)
#!endif
 
 
# ----- alias_db params -----
#!ifdef WITH_ALIASDB
modparam("alias_db", "db_url", DBURL)
modparam("alias_db", "use_domain", MULTIDOMAIN)
#!endif
 
  
# ----- domain params -----
#!ifdef WITH_MULTIDOMAIN
modparam("domain", "db_url", DBURL)
# register callback to match myself condition with domains list
modparam("domain", "register_myself", 1)
#!endif
  
  
# ----- nathelper params -----
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
modparam("nathelper", "sipping_from", "sip:pinger at 192.168.0.197")
 
# params needed for NAT traversal in other modules
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
modparam("usrloc", "nat_bflag", FLB_NATB)

 
 
  
#!ifdef WITH_XMLRPC
# ----- xmlrpc params -----
modparam("xmlrpc", "route", "XMLRPC");
modparam("xmlrpc", "url_match", "^/RPC")
#!endif


#----------dialog_ng-----------------
#!ifdef WITH_DIALOGNG
modparam("dialog_ng", "hash_size", 4096)
modparam("dialog_ng", "rr_param", "did")
modparam("dialog_ng", "dlg_flag", 4)
#modparam("dialog_ng", "timeout_avp", "$avp(DLG_TIMEOUT_AVP)")
modparam("dialog_ng", "default_timeout", 3600)
modparam("dialog_ng", "detect_spirals", 1)
#!endif

 
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
# - note: this is the same as route { ... }
request_route {

	$avp(unique_id)	      = 0; 
	$avp(pidentity)       = 0;
	$avp(networkdatetime) = 0;
	$avp(ptparty)         = 0;
	$avp(poparty)         = 0;
	$avp(pprovider)       = 0;
	$avp(maliyet_id)      = 0;	
	$avp(tibtip)          = 0;
	$avp(permit_ip)       = "0.0.0.0";
	$avp(codectip)	      = 0;
	$avp(punique)         = $sruid;
	$avp(src_userid)      = 0;
	# per request initial checks
	route(REQINIT);
 
	# NAT detection
	route(NATDETECT);
	
 
	# handle requests within SIP dialogs
	route(WITHINDLG);
 
	### only initial requests (no To tag)
 
	# CANCEL processing
	if (is_method("CANCEL"))
	{
		if (t_check_trans())
			t_relay();
		exit;
	}

	if(t_precheck_trans()) {
        	t_check_trans();
       		 exit;
    	}
	
	t_check_trans();
 
	# authentication
	route(AUTH);
 
	# record routing for dialog forming requests (in case they are routed)
	# - remove preloaded route headers
	remove_hf("Route");
	if (is_method("INVITE|SUBSCRIBE"))
		record_route();
 
	# dispatch requests to foreign domains
	route(SIPOUT);
 
	route(REGISTRAR);
	
 
	if ($rU==$null)
	{
		sl_send_reply("484","Address Incomplete");
		exit;
	}

	if ($rU!=$null && is_method("OPTIONS"))
    	{
		sl_send_reply("200","OK");
		exit;
    	}

	if(is_method("INVITE")){
		setflag(4);
		setflag(9);
		setflag(2);
		setflag(3);	
	}

	route(LOCATION);
 
	route(RELAY);
}

failure_route[1]{
#Giden cagrilar icin failure route
        revert_uri();
       
if(!cr_next_domain("$avp(s:carrier)","$avp(s:domian)","$rU","$avp(s:host)","$T_reply_code","$avp(s:domain)")){
                xlog("L_NOTICE","[$avp(punique)] [$rU] [OUT]
[NoFailRoute]");
                exit;
        }
       
if(!cr_route("$avp(s:carrier)","$avp(s:domian)","$rU","$rU","call_id","$avp(s:route_desc)")){
                xlog("L_NOTICE","[$avp(punique)] [$rU] [OUT]
[NoFailRoute]");
                exit;
        }
        #xlog("L_INFO","failure:routing:route:$avp(s:route_desc)");
	$avp(maliyet_id)=$avp(s:route_desc);
        $avp(s:host)= $rd+":"+$rp;
        t_on_failure("1");
        if(!t_relay()) {
                 send_reply("408", "Servis Disi");
                 exit;
        }else{
                exit;
        }
        return;
}

failure_route[2]{
        
	revert_uri();
       
if(!cr_next_domain("$avp(s:carrier)","$avp(s:domian)","$rU","$avp(s:host)","$T_reply_code","$avp(s:domain)")){
                xlog("L_ALERT","[$ci] [$rU] [IN] [NoFailRoute]");
		exit;
        }
       
if(!cr_route("$avp(s:carrier)","$avp(s:domian)","$rU","$rU","call_id","$avp(s:route_desc)")){
		xlog("L_ALERT","[$ci] [$rU] [IN] [NoFailRoute]");
		exit;
        }
        $avp(s:host)= $rd+":"+$rp;
	$avp(maliyet_id)=$avp(s:route_desc);
	t_on_failure("2");
        if(!t_relay()) {
                 send_reply("408", "Servis Disi");
                 exit;
        }else{
                exit;
        }
        return;
}
failure_route[3]{
        revert_uri();
       
if(!cr_next_domain("$avp(s:carrier)","$avp(s:domian)","$rU","$avp(s:host)","$T_reply_code","$avp(s:domain)")){
                xlog("L_INFO","[$ci] [NoFailRoute]");
                exit;
        }
       
if(!cr_route("$avp(s:carrier)","$avp(s:domian)","$rU","$rU","call_id","$avp(s:route_desc)")){
                xlog("L_INFO","[$ci] [NoFailRoute]");
                exit;
        }
        $avp(maliyet_id)=$avp(s:route_desc);
	$avp(s:host)= $rd;
        t_on_failure("3");
        if(!t_relay()) {
                 send_reply("408", "Servis Disi");
                 exit;
        }else{
                 exit;
        }
        return;
}


route[PASSERTED]{
	
	if($hdr(P-Asserted-Identity)==$null || $ai==$null ){
               if($fU != "Anonymous" || $fU != "anonymous" || $fU !=
"Unavailable"){
				$avp(poparty) = $(fU{re.subst,/\[^0-9]//g});
								
				if($(avp(poparty){s.len})>9){
					$avp(poparty)=$(avp(poparty){s.substr,-10,10});
				}								
                }else{
                      $avp(poparty)=0000000;
                }
		append_hf("P-Asserted-Identity:$avp(poparty)\r\n");
		append_hf("P-Oparty:$avp(poparty)\r\n");
        }
        else{
		## Burada duzeltme yapilacak. <null> hatasi aliyor.
		xlog("L_WARN","passertediddentity:$ai");
		$avp(poparty)=$(ai{re.subst,/^sip:(.*)@(.*)/\1/});
                if($(avp(poparty){s.len})>9){
                        $avp(poparty) = $(avp(poparty){s.substr,-10,10});
                }
		
		append_hf("P-Oparty: $avp(poparty)\r\n");
        }
	return;
}

route[UNIQUEID]{

        if(!is_method("INVITE|BYE")){
                return;
        }


        if($hdr(P-Unique)==$null ){
                $avp(punique) = $sruid;

        }else{
                $avp(punique) =$hdr(P-Unique);
        }
        return;

}
route[SRCUSERID]{
	if(!is_method("INVITE|BYE")){
                return;
        }

	if($hdr(P-Src_userid)==$null){
                append_hf("P-Src_userid:$avp(src_userid)\r\n");

        }else{
                $avp(src_userid) =$hdr(P-Src_userid);
        }
        return;


}
route[PPROVIDER]{

	if(!is_method("INVITE|BYE")){
		return;
	}

	if($hdr(P-Provider)==$null ){
                $avp(pprovider) = $si;

        }else{
		$avp(pprovider) =$hdr(P-Provider);
        }
        return;
}
route[PTPARTY]{
	
	if($hdr(P-Tparty)==$null ){
		$avp(ptparty) = $(rU{re.subst,/\[^0-9]//g});
                
		if($(avp(ptparty){s.len})>9){
                        $avp(ptparty) = $(avp(ptparty){s.substr,-10,10});
                }
		
		append_hf("P-Tparty:$avp(ptparty)\r\n");
	}else{
		$avp(ptparty) = $(hdr(P-Tparty){re.subst,/\[^0-9]//g});
		if($(avp(ptparty){s.len})>9){
                        $avp(ptparty) = $(avp(ptparty){s.substr,-10,10});
                }
		
	}
	return;
}

route[POPARTY]{

	if($hdr(P-Oparty)==$null ){
		$avp(poparty) = $(fU{re.subst,/\[^0-9]//g});
                
		if($(avp(poparty){s.len})>9){
                        $avp(poparty) = $(avp(poparty){s.substr,-10,10});
                }
			append_hf("P-Oparty:$avp(poparty)\r\n");
	}else{
		$avp(poparty) = $(hdr(P-Oparty){re.subst,/\[^0-9]//g});
		
			if($(avp(poparty){s.len})>9){
                        	$avp(poparty) = $(avp(poparty){s.substr,-10,10});
                	}
	}
	return;

}


route[RELAY] {
	# enable additional event routes for forwarded requests
        # - serial forking, RTP relaying handling, a.s.o.
        if(is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
                if(!t_is_set("branch_route")) {
			t_on_branch("MANAGE_BRANCH");
		}
        }

	if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
                if(!t_is_set("onreply_route")){
			 t_on_reply("MANAGE_REPLY");
        	}
	}
	if (is_method("INVITE")) {
                if(!t_is_set("failure_route")){
			t_on_failure("MANAGE_FAILURE");
		}
        }

	if(!t_relay()) {
                sl_reply_error();
        }

	exit;		
}
 
 
route[REQINIT] {
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483","Too Many Hops");
		exit;
	}
 
	if(!sanity_check("1511", "7"))
	{
		xlog("Malformed SIP message from $si:$sp\n");
		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()) {
			route(DLGURI);
			if (is_method("BYE")) {	
				xlog("L_ALERT","BYE");	
				setflag(4);
		                setflag(9);
                		setflag(2);
		                setflag(3);
			}

			if ( is_method("ACK") ) {
				# ACK is forwarded statelessy
				route(NATMANAGE);
			}
			route(RELAY);
		} else {
			if (is_method("SUBSCRIBE") && uri == myself) {
				# in-dialog subscribe requests
				route(PRESENCE);
				exit;
			}
			if ( is_method("ACK") ) {
				if ( t_check_trans() ) {
					# no loose-route, but stateful ACK;
					# must be an 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;
	}
}
# URI update for dialog requests
route[DLGURI] {
#!ifdef WITH_NAT
        if(!isdsturiset()) {
                handle_ruri_alias();
        }
#!endif
        return;
}

# Handle SIP registrations
route[REGISTRAR] {
	if (is_method("REGISTER"))
	{
		if(isflagset(FLT_NATS))
		{
			setbflag(FLB_NATB);
			# uncomment next line to do SIP NAT pinging 
			setbflag(FLB_NATSIPPING);
		}
		if (!save("location"))
		{
			sl_reply_error();
 		}
		exit;
	}
}
 
# USER location service
route[LOCATION] {
	$avp(oexten) = $rU;
	if (!lookup("location") ) {
		$var(rc) = $rc;
		t_newtran();
		switch ($var(rc)) {
			case -1:
			case -3:
				send_reply("404", "Not Found");
				exit;
			case -2:
				send_reply("405", "Method Not Allowed");
				exit;
		}
	}
} 
# Presence server route
route[PRESENCE] {
	if(!is_method("PUBLISH|SUBSCRIBE"))
		return;
 
	# if presence enabled, this part will not be executed
	if (is_method("PUBLISH") || $rU==$null)
	{
		sl_send_reply("404", "Not here");
		exit;
	}
	return;
}
 
# Authentication route
route[AUTH] {
#!ifdef WITH_AUTH

        if (is_method("REGISTER"))
        {
		auth_check("$rd","subscriber", "0");
                $var(auth_sonuc) = $rc;
		if($var(auth_sonuc)<0)
		{
			xlog("LOG_LOCAL5","L_INFO","REGISTRATION $fU@$si:$sp \n");
			
			switch($var(auth_sonuc))
			{
				case '-1':
					xlog("LOG_LOCAL5","L_WARN","REGISTRATION: GENERIC ERROR! $fU@$si:$sp
\n");
					break;
				case '-2':
					xlog("LOG_LOCAL5","L_WARN","REGISTRATION: WRONG PASSWORD! $fU@$si:$sp 
\n");
					 break;
				case '-3':
					xlog("LOG_LOCAL5","L_WARN","REGISTRATION: INVALID USER! $fU@$si:$sp
\n");
					 break;
				case '-4':
                                       
xlog("LOG_LOCAL5","L_WARN","REGISTRASYON: NONCE EXPIRED $fU@$si:$sp \n");
					 break;
				case '-5':
                                       
xlog("LOG_LOCAL5","L_WARN","REGISTRASYON: REQUEST DOESNT CONTAIN
AUTHORIZATION HEADER $fU@$si:$sp  \n");
		 			 break;
				case '-6':
                                       
xlog("LOG_LOCAL5","L_WARN","REGISTRASYON: NONCE REUSED $fU@$si:$sp \n");
					 break;
				case '-8':
                                       
xlog("LOG_LOCAL5","L_WARN","REGISTRATION: AUTH USER MISMATCH! $fU@$si:$sp
\n");
					 break;
				default: 
					xlog("LOG_LOCAL5","L_WARN","REGISTRATION: UNKNOWN ERROR! $fU@$si:$sp 
\n");
			}
		}
		else
		{
			
			xlog("LOG_LOCAL3","L_WARN","REGISTER BASARILI $fU@$si:$sp \n");

		}
		#xlog("L_INFO","auth_check result -> $var(auth_sonuc)");
			if(!auth_check("$fd", "subscriber", "0")) {
					auth_challenge("$fd", "0");
					exit;
			}else{
					return;
			}
        }
		
	##Trusted tablosun da ip yok ise auth yapar
	
	$var(allwed)=allow_trusted();

	    if(is_method("INVITE") &&  $var(allwed)<0 ){
                auth_check("$rd","subscriber", "0");
                $var(auth_res) = $rc;
                #xlog("L_ALERT","INVITETA AUTH SONUCU $var(auth_res) $fU
\n");
                if($var(auth_res)>0)
                {
						return;
                }
                else
                {
                        auth_challenge("$rd", "0");
                        if($var(auth_res)!=-5)
                        {
                                xlog("LOG_LOCAL5","L_WARN","REGISTRATION:
WRONG PASSWORD! $fU@$si:$sp  \n");
                        }
                        exit;
                }
        }
#!endif
	return;
}
# Caller NAT detection route
route[NATDETECT] {
#!ifdef WITH_NAT
	force_rport();
	if (nat_uac_test("19")) {
		if (is_method("REGISTER")) {
			fix_nated_register();
		} else {
			fix_nated_contact();
		}
		setflag(FLT_NATS);
	}
#!endif
	return;
}
 
# RTPProxy control
route[NATMANAGE] {
#!ifdef WITH_NAT
	if (is_request()) {
		if(has_totag()) {
			if(check_route_param("nat=yes")) {
				setbflag(FLB_NATB);
			}
		}
	}
	if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
		return;
 
	#rtpproxy_manage("co");
 
	if (is_request()) {
		if (!has_totag()) {
			add_rr_param(";nat=yes");
		}
	}
	if (is_reply()) {
		if(isbflagset(FLB_NATB)) {
			fix_nated_contact();
		}
	}
#!endif
	return;
}
 
# Routing to foreign domains
route[SIPOUT] {
	if (!uri==myself)
	{
		append_hf("P-hint: outbound\r\n");
		route(RELAY);
	}
}
# XMLRPC routing
#!ifdef WITH_XMLRPC
route[XMLRPC] {
	# allow XMLRPC from localhost
	if ((method=="POST" || method=="GET")
			&& (src_ip==127.0.0.1)) {
		# close connection only for xmlrpclib user agents (there is a bug in
		# xmlrpclib: it waits for EOF before interpreting the response).
		if ($hdr(User-Agent) =~ "xmlrpclib")
			set_reply_close();
		set_reply_no_connect();
		dispatch_rpc();
		exit;
	}
	send_reply("403", "Forbidden");
	exit;
}
#!endif
 
# route to voicemail server
route[TOVOICEMAIL] {
	return;
}
 
# manage outgoing branches
branch_route[MANAGE_BRANCH] {
	xdbg("new branch [$T_branch_idx] to $ru\n");
	route(NATMANAGE);
}
 
# manage incoming replies
onreply_route[MANAGE_REPLY] {
	xdbg("incoming reply\n");
	if(status=~"[12][0-9][0-9]")
		route(NATMANAGE);
}
 
# manage failure routing cases
failure_route[MANAGE_FAILURE] {
	route(NATMANAGE);
 
	if (t_is_canceled()) {
		exit;
	}
}




--
View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-V-2-4-2-Dialog-ng-crash-and-IMS-USRLOC-SCSCF-doc-tp136786p136816.html
Sent from the Users mailing list archive at Nabble.com.



More information about the sr-users mailing list