<div dir="ltr"><div><div><div>Could this be a bug in pua?<br><br></div>Using kamailio 4.1.3 (642428c)<br><br></div>Looking forward to hear from you.<br><br></div>BR,<br></div><div class="gmail_extra"><br clear="all"><div><p>
<font color="#1f497d" face="'Trebuchet MS', sans-serif">--</font></p><p><b><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#1f497d">Nuno Miguel Reis</span></b><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"> | <b>Unified Communication</b></span><b><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#1f497d"> Systems</span></b><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"><br>

M. <a value="+351918919465">+351 913907481</a> | <a href="mailto:nreis@wavecom.pt" target="_blank"><span style="color:blue">nreis@wavecom.pt</span></a></span><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif""></span><span style="font-size:10.0pt;font-family:"Trebuchet MS","sans-serif";color:#1f497d"></span><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"><br>
</span></p><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770">WAVECOM-Soluções Rádio, S.A.</span><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"><br>

Cacia Park | Rua do Progresso, Lote 15</span><span style="font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#133770"><br>3800-639 AVEIRO | Portugal</span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br>

T. <a value="+351234919190">+351 309 700 225</a> | F. <a value="+351234919191">+351 234 919 191</a></span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br></span><b><span style="font-size:9.0pt;font-family:"Trebuchet MS","sans-serif";color:#1f497d"><a href="http://maps.google.com/maps/ms?msa=0&msid=202333747613191340808.0004b4b227a6144f0df88" target="_blank"><span style="color:#1f497d">GPS</span></a> | <a href="http://www.wavecom.pt/" target="_blank"><span style="color:#1f497d">www.wavecom.pt</span></a></span></b><b><a href="http://www.wavecom.pt/" target="_blank"><span style="color:#1f497d"></span></a></b><p>
<span style="border-collapse:collapse"></span></p><p><a href="http://www.wavecom.pt/pt/wavecom/premios.php" style="color:rgb(17,85,204)" target="_blank"><span style="text-decoration:none"><img src="cid:image001.png@01CD4A22.D45EAB90" alt="Description: Description: WavecomSignature" border="0" height="100" width="400"></span></a><span style="color:rgb(31,73,125)"></span></p>


<p><a href="http://www.wavecom.pt/pt/mail_eventos.php" style="color:rgb(17,85,204);font-size:medium;font-family:'Times New Roman'" target="_blank"><img alt="Publicity" src="http://www.wavecom.pt/email_signature/pub.png" border="0" height="71" width="389"></a>
</p><p></p><p><span><br></span></p></div>
<br><br><div class="gmail_quote">On Tue, Jun 3, 2014 at 3:23 PM, Nuno Reis <span dir="ltr"><<a href="mailto:nreis@wavecom.pt" target="_blank">nreis@wavecom.pt</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div><div>Hi guys.<br><br></div>I've setup presence management in kamailio and i'm currently persisting the presence info in a postgres DB.<br></div>I'm having a recurring issue on DB key violations, here's a log error output on that:<br>


<br>Jun  3 15:09:46 144227  ERROR: pua_dialoginfo [pua_dialoginfo.c:264]: __dialog_sendpublish(): bad reply or missing CONTACT hdr<br>Jun  3 15:10:01 723993  ERROR: presence [presentity.c:807]: update_presentity(): No E_Tag match a.1401768964.671509.1990.6<br>


Jun  3 15:10:06 242334  WARNING: db_postgres [km_dbase.c:235]: db_postgres_submit_query(): postgres result check failed with code 7 (PGRES_FATAL_ERROR)<br>Jun  3 15:10:06 242370  WARNING: db_postgres [km_dbase.c:239]: db_postgres_submit_query(): postgres query command failed, connection status 0, error [ERROR:  duplicate key value violates unique constraint "pua_pua_idx"#012DETAIL:  Key (etag, tuple_id, call_id, from_tag)=(a.1401768964.671497.1902.6, , , ) already exists.#012]<br>


Jun  3 15:10:06 243415  WARNING: db_postgres [km_dbase.c:235]: db_postgres_submit_query(): postgres result check failed with code 7 (PGRES_FATAL_ERROR)<br>Jun  3 15:10:06 243449  WARNING: db_postgres [km_dbase.c:239]: db_postgres_submit_query(): postgres query command failed, connection status 0, error [ERROR:  duplicate key value violates unique constraint "pua_pua_idx"#012DETAIL:  Key (etag, tuple_id, call_id, from_tag)=(a.1401768964.671497.1902.6, , , ) already exists.#012]<br>


Jun  3 15:10:06 244458  WARNING: db_postgres [km_dbase.c:235]: db_postgres_submit_query(): postgres result check failed with code 7 (PGRES_FATAL_ERROR)<br>Jun  3 15:10:06 244487  WARNING: db_postgres [km_dbase.c:239]: db_postgres_submit_query(): postgres query command failed, connection status 0, error [ERROR:  duplicate key value violates unique constraint "pua_pua_idx"#012DETAIL:  Key (etag, tuple_id, call_id, from_tag)=(a.1401768964.671497.1902.6, , , ) already exists.#012]<br>


Jun  3 15:10:06 244504  ERROR: db_postgres [km_dbase.c:247]: db_postgres_submit_query(): 0x7f21476b1910 PQsendQuery Error: ERROR:  duplicate key value violates unique constraint "pua_pua_idx"#012DETAIL:  Key (etag, tuple_id, call_id, from_tag)=(a.1401768964.671497.1902.6, , , ) already exists.#012 Query: update kamailio.pua set expires=1401807715,cseq=0,etag='a.1401768964.671497.1902.6',desired_expires=1401811600,version=2 where pres_uri='<a href="mailto:sip%3A208@freguesiadearroios.govoice.pt" target="_blank">sip:208@freguesiadearroios.govoice.pt</a>' AND pres_id='DIALOG_PUBLISH.440163220-35219-52@BJC.BGI.B.BAI' AND flag=1024 AND event=32<br>


Jun  3 15:10:06 244521  ERROR: <core> [db_query.c:337]: db_do_update(): error while submitting query<br>Jun  3 15:10:06 244548  ERROR: db_postgres [km_dbase.c:537]: db_postgres_store_result(): invalid query, execution aborted<br>


Jun  3 15:10:06 244560  ERROR: db_postgres [km_dbase.c:538]: db_postgres_store_result(): driver error: PGRES_FATAL_ERROR, ERROR:  duplicate key value violates unique constraint "pua_pua_idx"#012DETAIL:  Key (etag, tuple_id, call_id, from_tag)=(a.1401768964.671497.1902.6, , , ) already exists.#012<br>


Jun  3 15:10:06 244584  WARNING: db_postgres [km_dbase.c:647]: db_postgres_update(): unexpected result returned<br>Jun  3 15:10:06 244591  ERROR: pua [pua.c:1076]: db_update(): while updating in database<br><br><br></div>


I've read the module documentation, but there isn't much documentation on it and i'm basically guessing and trying here.<br>Can someone tell me what am i doing wrong or maybe what should a try to be able to persist the presence status in a postgres database.<br>


</div>I know that i could use in memory persistence or other  type of DB, but i really want to know if i can use a normal postgres DB for presence persistence and what could be used to avoid key violations.<br><br></div>

Looking forward to hear from you.<br>
</div>Best Regards,<br clear="all"><div><div><div><div><div><div><div><div><div><p><font color="#1f497d" face="'Trebuchet MS', sans-serif">--</font></p><p><b><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(31,73,125)">Nuno Miguel Reis</span></b><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"> | <b>Unified Communication</b></span><b><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(31,73,125)"> Systems</span></b><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br>



M. <a value="+351918919465">+351 913907481</a> | <a href="mailto:nreis@wavecom.pt" target="_blank"><span style="color:blue">nreis@wavecom.pt</span></a></span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif""></span><span style="font-size:10pt;font-family:"Trebuchet MS","sans-serif";color:rgb(31,73,125)"></span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br>


</span></p><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)">WAVECOM-Soluções Rádio, S.A.</span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br>



Cacia Park | Rua do Progresso, Lote 15</span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br>3800-639 AVEIRO | Portugal</span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br>



T. <a value="+351234919190">+351 309 700 225</a> | F. <a value="+351234919191">+351 234 919 191</a></span><span style="font-size:8pt;font-family:"Trebuchet MS","sans-serif";color:rgb(19,55,112)"><br></span><b><span style="font-size:9pt;font-family:"Trebuchet MS","sans-serif";color:rgb(31,73,125)"><a href="http://maps.google.com/maps/ms?msa=0&msid=202333747613191340808.0004b4b227a6144f0df88" target="_blank"><span style="color:rgb(31,73,125)">GPS</span></a> | <a href="http://www.wavecom.pt/" target="_blank"><span style="color:rgb(31,73,125)">www.wavecom.pt</span></a></span></b><b><a href="http://www.wavecom.pt/" target="_blank"><span style="color:rgb(31,73,125)"></span></a></b><p>


<span style="border-collapse:collapse"></span></p><p><a href="http://www.wavecom.pt/pt/wavecom/premios.php" style="color:rgb(17,85,204)" target="_blank"><span style="text-decoration:none"><img src="cid:image001.png@01CD4A22.D45EAB90" alt="Description: Description: WavecomSignature" border="0" height="100" width="400"></span></a><span style="color:rgb(31,73,125)"></span></p>




<p><a href="http://www.wavecom.pt/pt/mail_eventos.php" style="color:rgb(17,85,204);font-size:medium;font-family:'Times New Roman'" target="_blank"><img alt="Publicity" src="http://www.wavecom.pt/email_signature/pub.png" border="0" height="71" width="389"></a>
</p><p></p><p><span><br></span></p></div>
</div></div></div></div></div></div></div></div></div>
</blockquote></div><br></div>