<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 3, 2013 at 10:15 PM, mayamatakeshi <span dir="ltr">&lt;<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a>&gt;</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>Hello,<br>I am experimenting with module dialog profiles to limit simultaneous calls from/to a subscriber.<br>
This works fine.<br>And also works when I restart opensips:<br>  - calls established before restart are counted when limit is checked<br>
  - acc record (cdr mode) is generated for the call when BYE is received.<br>I can see this happens because when opensips shuts down gracefully, it saves dialog data to DB.<br><br><br>Then, I experimented simulating an opensips crash by doing &quot;kill -9 pid&quot; for each opensips process.<br>

This was done after i confirmed dialog has flushed its data to DB (i am using db_mode=DELAYED and db_update_period=10).<br>However, after restarting opensips, although I can see it was able to load dialog data:<br>  - calls established before the &quot;crash&quot; are not counted when limit is checked<br>

  - no acc record is generated when BY is received.<br><br><br>Comparing, the records for the same call that periodic dialog update generates with what a graceful shutdown saves, I can see they are different:<br><br><br>
After periodic dialog db update:<br>
<br>mysql&gt; select * from dialog;<br>+---------------+--------------------------------------+-----------------------------------+--------------------------------------+--------------------------------+--------------------------------------+------------------+----------------+-------------+-------------+------------------+------------------+------------------+------------------+----------------------------------+------------------------------------+------------------------+------------------------+-------+------------+------------+------+----------+--------------+-------+<br>

| dlg_id        | callid                               | from_uri                          | from_tag                             | to_uri                         | to_tag                               | mangled_from_uri | mangled_to_uri | caller_cseq | callee_cseq | caller_ping_cseq | callee_ping_cseq | caller_route_set | callee_route_set | caller_contact                   | callee_contact                     | caller_sock            | callee_sock            | state | start_time | timeout    | vars | profiles | script_flags | flags |<br>

+---------------+--------------------------------------+-----------------------------------+--------------------------------------+--------------------------------+--------------------------------------+------------------+----------------+-------------+-------------+------------------+------------------+------------------+------------------+----------------------------------+------------------------------------+------------------------+------------------------+-------+------------+------------+------+----------+--------------+-------+<br>

| 9549462304683 | b583e688-f87b-4861-936f-7dc76e33004a | <a href="mailto:sip%3A53535353224123@somedomain.com" target="_blank">sip:53535353224123@somedomain.com</a> | d2ecbce5-9275-4788-a40c-509a23476e35 | <a href="mailto:sip%3A234223423423@192.168.2.177" target="_blank">sip:234223423423@192.168.2.177</a> | 39178165-9e29-4a31-af78-51e61e54920c | NULL             | NULL           | 0           | 21320       |                0 |                0 | NULL             | NULL             | <a href="http://sip:sip-tester@192.168.2.78:5060" target="_blank">sip:sip-tester@192.168.2.78:5060</a> | <a href="http://sip:sip-tester@192.168.2.239:10802" target="_blank">sip:sip-tester@192.168.2.239:10802</a> | udp:<a href="http://192.168.2.177:5060" target="_blank">192.168.2.177:5060</a> | udp:<a href="http://192.168.2.177:5060" target="_blank">192.168.2.177:5060</a> |     4 | 1380805509 | 1380816310 | NULL | NULL     |            0 |    16 |<br>

+---------------+--------------------------------------+-----------------------------------+--------------------------------------+--------------------------------+--------------------------------------+------------------+----------------+-------------+-------------+------------------+------------------+------------------+------------------+----------------------------------+------------------------------------+------------------------+------------------------+-------+------------+------------+------+----------+--------------+-------+<br>

1 row in set (0.00 sec)<br><br><br>After opensips graceful shutdown:<br><br>mysql&gt; select * from dialog;<br>+---------------+--------------------------------------+-----------------------------------+--------------------------------------+--------------------------------+--------------------------------------+------------------+----------------+-------------+-------------+------------------+------------------+------------------+------------------+----------------------------------+------------------------------------+------------------------+------------------------+-------+------------+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------+--------------+-------+<br>

| dlg_id        | callid                               | from_uri                          | from_tag                             | to_uri                         | to_tag                               | mangled_from_uri | mangled_to_uri | caller_cseq | callee_cseq | caller_ping_cseq | callee_ping_cseq | caller_route_set | callee_route_set | caller_contact                   | callee_contact                     | caller_sock            | callee_sock            | state | start_time | timeout    | vars                                                                                                                                                                                                                                                                                                                                                                                                                                                           | profiles                     | script_flags | flags |<br>

+---------------+--------------------------------------+-----------------------------------+--------------------------------------+--------------------------------+--------------------------------------+------------------+----------------+-------------+-------------+------------------+------------------+------------------+------------------+----------------------------------+------------------------------------+------------------------+------------------------+-------+------------+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------+--------------+-------+<br>

| 9549462304683 | b583e688-f87b-4861-936f-7dc76e33004a | <a href="mailto:sip%3A53535353224123@somedomain.com" target="_blank">sip:53535353224123@somedomain.com</a> | d2ecbce5-9275-4788-a40c-509a23476e35 | <a href="mailto:sip%3A234223423423@192.168.2.177" target="_blank">sip:234223423423@192.168.2.177</a> | 39178165-9e29-4a31-af78-51e61e54920c | NULL             | NULL           | 0           | 21320       |                0 |                0 | NULL             | NULL             | <a href="http://sip:sip-tester@192.168.2.78:5060" target="_blank">sip:sip-tester@192.168.2.78:5060</a> | <a href="http://sip:sip-tester@192.168.2.239:10802" target="_blank">sip:sip-tester@192.168.2.239:10802</a> | udp:<a href="http://192.168.2.177:5060" target="_blank">192.168.2.177:5060</a> | udp:<a href="http://192.168.2.177:5060" target="_blank">192.168.2.177:5060</a> |     4 | 1380805509 | 1380816309 | accX_table#acc|accX_flags#   |accX_db  <a href="http://the_domain_sestts.com" target="_blank">the_domain_sestts.com</a> 1 53535353224123 234223423423 53535353224123 the_user_sfsfe   1|accX_log  <a href="http://the_domain_sestts.com" target="_blank">the_domain_sestts.com</a> 1 53535353224123 234223423423 53535353224123 the_user_sfsfe   1|accX_leg#    |accX_core# INVITE$ d2ecbce5-9275-4788-a40c-509a23476e35$ 39178165-9e29-4a31-af78-51e61e54920c$ b583e688-f87b-4861-936f-7dc76e33004a 200 O …kMR    |accX_created#…kMR    |rtpproxy_1#w |     | calls#<a href="http://the_domain_sestts.com" target="_blank">the_domain_sestts.com</a>| |            0 |    16 |<br>

+---------------+--------------------------------------+-----------------------------------+--------------------------------------+--------------------------------+--------------------------------------+------------------+----------------+-------------+-------------+------------------+------------------+------------------+------------------+----------------------------------+------------------------------------+------------------------+------------------------+-------+------------+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------+--------------+-------+<br>

1 row in set (0.00 sec)<br><br><br>I am not sure about the no cdr issue, but the problem with the limit is clearly due to the fact that periodic dialog db update doesn&#39;t save profile info (calls#<a href="http://the_domain_sestts.com" target="_blank">the_domain_sestts.com</a>)<br>

So, is this a bug, or am I missing some configuration option?<br><br></div><div>Obs:<br></div><div>I have confirmed this behavior on latest head commit af195e9ef5a07ae87b27047e7e33fab742011d99.</div></div></blockquote><div>
<br></div><div>I experimented changing dialog.db_mode from DELAYED (2) to REALTIME (1) and I verified that with this mode, dialog data is properly saved solving both issues.<br>So this is clearly a bug.<br></div><div>I will be opening a ticket at github.<br>
Regards,<br>Takeshi<br></div></div><br></div></div>