<div dir="ltr"><div>Hi Alex,</div><div><br></div><div>yes, locally generated BYEs<br><div>I was trying to avoid the unique constraint approach as it is not very elegant.</div></div><div>I tried, AVPs, they are not accessible on the event_route[tm:local-request]</div>
<div><br></div><div>however, your idea on $dlg_vars was spot on, why didn't i think of that. Thanks a bunch!</div><div class="gmail_extra"><br clear="all"><div>Kelvin Chua</div>
<br><br><div class="gmail_quote">On Fri, Mar 28, 2014 at 12:58 AM, Alex Balashov <span dir="ltr"><<a href="mailto:abalashov@evaristesys.com" target="_blank">abalashov@evaristesys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Oh, you were talking about the BYEs that are internally generated by 'dialog'. In that case, ignore my advice; it's not applicable, because locally generated BYEs will not have the RR header and this won't work.<br>

<br>
In those situations, in my personal opinion, your best bet is to use a database-side UNIQUE constraint or trigger to ensure that only one BYE is logged for any given Call-ID. Otherwise, you're going to have to do some sort of internal statekeeping with 'htable' or what have you.<br>

<br>
You might be able to set $dlg_vars[1] indicating who is the callee and who is the caller, as well. However, I am not sure if you will have access to them inside the local event_route. That's a good question.<br>
<br>
[1] <a href="http://www.kamailio.org/wiki/cookbooks/4.1.x/pseudovariables#dlg_var_key" target="_blank">http://www.kamailio.org/wiki/<u></u>cookbooks/4.1.x/<u></u>pseudovariables#dlg_var_key</a><div class=""><div class="h5">
<br>
<br>
On 03/28/2014 03:56 AM, Alex Balashov wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 03/28/2014 03:53 AM, Kelvin Chua wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I have a situation here,<br>
<br>
when a dialog expires, it sends a BYE to both call legs and this does<br>
not generate an entry on acc table.<br>
<br>
however, when i use acc_db_request() on event_route[tm:local-request], i<br>
get 2 entries on acc, 1 for the downstream, and 1 for the upstream.<br>
<br>
is there a way of handling this so i can only get 1 BYE on acc?<br>
</blockquote>
<br>
You could take advantage of the rr module's is_direction() function:<br>
<br>
    <a href="http://kamailio.org/docs/modules/4.1.x/modules/rr.html#idp1797400" target="_blank">http://kamailio.org/docs/<u></u>modules/4.1.x/modules/rr.html#<u></u>idp1797400</a><br>
<br>
You will need to set the append_fromtag modparam to make it work:<br>
<br>
<br>
<a href="http://kamailio.org/docs/modules/4.1.x/modules/rr.html#append-fromtag-id" target="_blank">http://kamailio.org/docs/<u></u>modules/4.1.x/modules/rr.html#<u></u>append-fromtag-id</a><br>
<br>
-- Alex<br>
<br>
</blockquote>
<br>
<br>
-- <br>
Alex Balashov - Principal<br>
Evariste Systems LLC<br>
235 E Ponce de Leon Ave<br>
Suite 106<br>
Decatur, GA 30030<br>
United States<br>
Tel: <a href="tel:%2B1-678-954-0670" value="+16789540670" target="_blank">+1-678-954-0670</a><br>
Web: <a href="http://www.evaristesys.com/" target="_blank">http://www.evaristesys.com/</a>, <a href="http://www.alexbalashov.com/" target="_blank">http://www.alexbalashov.com/</a><br>
<br>
______________________________<u></u>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/<u></u>cgi-bin/mailman/listinfo/sr-<u></u>users</a><br>
</div></div></blockquote></div><br></div></div>