[SR-Users] Issue with dlg_setflag vs. setflag

Anthony Messina amessina at messinet.com
Fri Feb 6 02:13:36 CET 2015


I didn't understand that properly from the dialog module README in 6.10.  
dlg_manage():

"Process current SIP request with dialog module. It is an alternative to 
setting dialog flag for initial INVITE and Route-parameter-callback execution 
for within-dialog requests."

Your explanation was very helpful.  Thanks Daniel.  -A


On Thursday, February 05, 2015 12:32:41 PM Daniel-Constantin Mierla wrote:
> Hello,
> 
> dialog flags (dlg_setflag) are for storing specific flags inside the dialog
> structure. It is not used to mark a request for creating a dialog. For that
> you have to use setflag.
> 
> Cheers,
> Daniel
> 
> On 31/01/15 23:10, Anthony Messina wrote:
> 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/20150205/ceccec1e/attachment.sig>


More information about the sr-users mailing list