<div dir="ltr"><div>The flag will prevent duplicates. Which version are you using, there was a patch a few months ago<br></div><div><br></div><div><br></div><div>The explanation shold be that you are resetting them.</div><div><br></div><div>Are you using the following, one option to confirm that your logic is good is add one log line at INFO / NOTICE level logging each time you reset the flag including the call-id :</div><div><br></div><div><span style="font-family:monospace">if (t_precheck_trans()) {<br>        t_check_trans();  <br>        exit;<br>}</span></div><div><span style="font-family:monospace"><br></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 12, 2020 at 4:13 AM Voip support <<a href="mailto:voipexpert0@gmail.com">voipexpert0@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear Community,<div>I have setup ACCDB module to save missed / failed and successful calls.<br><br>My issue is that i am getting duplicated entries for INVITE / BYE in acc database table.<br><br>For example:</div><div>id;method;from_tag;to_tag;callid;sip_code;sip_reason;time;src_ip;dst_user;dst_domain;src_user;src_domain;cdr_id<br><a href="mailto:231838%3BINVITE%3B21-7FC1D85%3B1914472180948750%3BKKyIdaaJceAu7pzN@172.16.0.35" target="_blank">231838;INVITE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN@172.16.0.35</a>;200;OK;2020-02-11 19:16:28;22.33.44.55;nlb124#78019989897056;11.11.11.11;asterisk;172.16.0.35;0<br><a href="mailto:231839%3BINVITE%3B21-7FC1D85%3B1914472180948750%3BKKyIdaaJceAu7pzN@172.16.0.35" target="_blank">231839;INVITE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN@172.16.0.35</a>;200;OK;2020-02-11 19:16:28;22.33.44.55;nlb124#78019989897056;11.11.11.11;asterisk;172.16.0.35;0<br><a href="mailto:231840%3BINVITE%3B21-7FC1D85%3B1914472180948750%3BKKyIdaaJceAu7pzN@172.16.0.35" target="_blank">231840;INVITE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN@172.16.0.35</a>;200;OK;2020-02-11 19:16:28;22.33.44.55;nlb124#78019989897056;11.11.11.11;asterisk;172.16.0.35;0<br><a href="mailto:231841%3BBYE%3B21-7FC1D85%3B1914472180948750%3BKKyIdaaJceAu7pzN@172.16.0.35" target="_blank">231841;BYE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN@172.16.0.35</a>;200;OK;2020-02-11 19:16:36;22.33.44.55;;190.196.153.130;asterisk;172.16.0.35;0<br><a href="mailto:231842%3BBYE%3B21-7FC1D85%3B1914472180948750%3BKKyIdaaJceAu7pzN@172.16.0.35" target="_blank">231842;BYE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN@172.16.0.35</a>;200;OK;2020-02-11 19:16:36;22.33.44.55;;190.196.153.130;asterisk;172.16.0.35;0<br><a href="mailto:231844%3BBYE%3B21-7FC1D85%3B1914472180948750%3BKKyIdaaJceAu7pzN@172.16.0.35" target="_blank">231844;BYE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN@172.16.0.35</a>;200;OK;2020-02-11 19:16:36;22.33.44.55;;190.196.153.130;asterisk;172.16.0.35;0<br><br>Following way: <br># ----- acc params -----<br>/* what special events should be accounted ? */<br>modparam("acc", "early_media", 0)<br>modparam("acc", "report_ack", 0)<br>modparam("acc", "report_cancels", 0)<br>/* by default ww do not adjust the direct of the sequential requests.<br> * if you enable this parameter, be sure the enable "append_fromtag"<br> * in "rr" module */<br>modparam("acc", "detect_direction", 0)<br>/* account triggers (flags) */<br>modparam("acc", "log_flag", FLT_ACC)<br>modparam("acc", "log_missed_flag", FLT_ACCMISSED)<br>modparam("acc", "log_extra",<br>        "src_user=$fU;src_domain=$fd;src_ip=$si;"<br>        "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")<br>modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)<br>/* enhanced DB accounting */<br>#!ifdef WITH_ACCDB<br>modparam("acc", "db_flag", FLT_ACC)<br>modparam("acc", "db_missed_flag", FLT_ACCMISSED)<br>modparam("acc", "db_url", DBURL)<br>#modparam("acc", "db_extra",<br>#       "src_user=$fU;src_domain=$fd;src_ip=$si;"<br>#       "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")<br>modparam("acc", "db_extra",<br>        "src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd;src_ip=$si")<br><br>#  our lines<br>modparam("acc", "cdrs_table", "acc_cdrs")<br>modparam("acc", "cdr_on_failed", 1)<br>#!endif<br><br>Then in routing config i set setflag(FLT_ACC FLT_ACCMISSED FLT_ACCFAILED in several places.<br><br>My question is - each setflag cause an entry to be saved in DB?<br>How can i debug and resolve the issue of duplicates.<br><br>I am trying to use a CDR script found somewhere on siremis sites to do the accounting but it's making trouble because due to duplicates in acc table i am getting cdrs unique key violations.<br><br>Secondary question is - if a BYE is not received / lost is there any way to send a check triggered by kamailio to each caller and callee side to check if dialog is still active.<br>I would not like to use session timers (as endpoints need to support it).<br><br>Best regards,<br>Tom</div><div><br></div></div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>