[SR-Users] Issue with dlg_setflag vs. setflag

Anthony Messina amessina at messinet.com
Sat Jan 31 23:10:21 CET 2015


I'm currently using Kamailio built from master at e59db79 and have been following 
the recent threads about the dialog module as I'm moving toward adding dialog 
support for presence and CDRs in my setup.

However, I seem to have come across an issue where dlg_setflag() does nothing, 
while setflag() works properly with the following (trimmed) script.  So for 
now, I issue setflag(FLT_DIALOG) for INVITE rather than 
dlg_setflag(FLT_DIALOG).

Is there something I'm missing about dlg_setflag()?


#!define FLT_DIALOG 4
request_route {
	route(REQINIT);
	route(NATDETECT);
	if(is_method("CANCEL")) {
		if(t_check_trans()) {
			route(RELAY);
		}
		exit;
	}
	route(WITHINDLG);
	if(t_precheck_trans()) {
		t_check_trans();
		exit;
	}
	t_check_trans();
	route(AUTH);
	remove_hf("Route");
	if(is_method("INVITE|SUBSCRIBE"))
		record_route();
	if(is_method("INVITE")) {
		setflag(FLT_ACC);
		# Enable dialog support (dlg_setflag not working)
		#dlg_setflag(FLT_DIALOG);
		setflag(FLT_DIALOG);
	}
	route(SIPOUT);
	route(PRESENCE);
	route(REGISTRAR);
	if($rU==$null) {
		# request with no Username in RURI
		sl_send_reply("484","Address Incomplete");
		exit;
	}
	route(PSTN);
	route(LOCATION);
	route(RELAY);
}

route[WITHINDLG] {
	if(!has_totag()) return;
	if(loose_route()) {
		route(DLGURI);
		if(is_method("BYE")) {
			setflag(FLT_ACC);
			setflag(FLT_ACCFAILED);
			# Testing dialog flag
			xlog("L_INFO", "Completed $dlg(from_uri) to 
$dlg(to_uri) - $DLG_lifetime duration\n");
		} else if(is_method("ACK")) {
			route(NATMANAGE);
		} else if(is_method("NOTIFY")) {
			record_route();
		}
		route(RELAY);
		exit;
	}
	if(is_method("SUBSCRIBE") && uri==myself) {
		route(PRESENCE);
		exit;
	}
	if(is_method("ACK")) {
		if(t_check_trans()) {
			route(RELAY);
			exit;
		} else {
			exit;
		}
	}
	sl_send_reply("404","Not Found");
	exit;
}

-- 
Anthony - https://messinet.com/ - https://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150131/f527e0f0/attachment.sig>


More information about the sr-users mailing list