I'm currently using Kamailio built from master@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; }
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@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; }
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
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@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; }