<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>iirc, dialog module is writing to database when the call is
      answered, before there should be no record in database for that
      call.</p>
    <p>Do you experience something different?</p>
    <p>In other words, if you tried with mysql, is something different
      in the behaviour for writing to storage when comparing with using
      db_redis?<br>
    </p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 19.11.18 10:53, David Escartín
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:fbe98744-6fbe-b136-b846-b946308fa515@bts.io">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <p>hello all</p>
      <pre>using version 5.2.0-rc0 of kamailio, we are trying to track the dialogs of dialog module using db_redis module with this setup
#!define DBURL_DIALOG "redis://127.0.0.1:6390/7"

# ----- dialog params -----
modparam("dialog", "db_url", DBURL_DIALOG)
modparam("dialog", "enable_stats", 1)
modparam("dialog", "hash_size", 16384)
modparam("dialog", "dlg_flag", 31)
modparam("dialog", "dlg_match_mode", 1)
modparam("dialog", "db_mode", 1)
modparam("dialog", "timer_procs", 1)
modparam("dialog", "db_update_period", 1)


# ----- db_redis params -----
modparam("db_redis", "schema_path", "/usr/local/kamailio/share/kamailio/db_redis/kamailio")
modparam("db_redis", "keys", "dialog=entry:hash_entry,hash_id,callid")
modparam("db_redis", "keys", "dialog_vars=entry:hash_entry,hash_id,dialog_key,dialog_value")


and we see it works and if a kamailio instance resets in the middle of a dialog it recovers all the dlg_vars and values because we have the db_skip_load to 0 in dialog module.

But we have noticed that the redis is being written with the information of the dlg_var assigned until that moment when we get a provisional response with SDP, and we dom see a set on the redis with the dialog entry and id untill call is connected.

Nov 16 13:22:55 proxy-1 /usr/local/kamailio/sbin/kamailio[22424]: INFO: Call-ID <a class="moz-txt-link-abbreviated" href="mailto:1-1511@9.7.8.1" moz-do-not-send="true">1-1511@9.7.8.1</a>: Status 180
Nov 16 13:22:55 proxy-1 /usr/local/kamailio/sbin/kamailio[22424]: WARNING: db_redis [redis_dbase.c:1489]: db_redis_perform_update(): performing full table scan on table 'dialog' while performing update
Nov 16 13:22:55 proxy-1 /usr/local/kamailio/sbin/kamailio[22424]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 0 is 'hash_entry'
Nov 16 13:22:55 proxy-1 /usr/local/kamailio/sbin/kamailio[22424]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 1 is 'hash_id'

on the redis (we only see hmset for dialog_vars key)
1542374575.721816 [7 127.0.0.1:56858] "HMSET" <a class="moz-txt-link-rfc2396E" href="mailto:dialog_vars:entry::13725:16494:_uac_funew:sip:1231215423@voda.interconnect.manxtelecom.im" moz-do-not-send="true">"dialog_vars:entry::13725:16494:_uac_funew:sip:1231215423@voda.interconnect.manxtelecom.im"</a> "hash_entry" "13725" "hash_id" "16494" "dialog_key" "_uac_funew" "dialog_value" <a class="moz-txt-link-rfc2396E" href="mailto:sip:1231215423@voda.interconnect.manxtelecom.im" moz-do-not-send="true">"sip:1231215423@voda.interconnect.manxtelecom.im"</a>
1542374575.722001 [7 127.0.0.1:56858] "HMSET" <a class="moz-txt-link-rfc2396E" href="mailto:dialog_vars:entry::13725:16494:_uac_fu:sip:anonymous@voda.interconnect.manxtelecom.im" moz-do-not-send="true">"dialog_vars:entry::13725:16494:_uac_fu:sip:anonymous@voda.interconnect.manxtelecom.im"</a> "hash_entry" "13725" "hash_id" "16494" "dialog_key" "_uac_fu" "dialog_value" <a class="moz-txt-link-rfc2396E" href="mailto:sip:anonymous@voda.interconnect.manxtelecom.im" moz-do-not-send="true">"sip:anonymous@voda.interconnect.manxtelecom.im"</a>
....
</pre>
      <pre>Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22425]: INFO: Call-ID <a class="moz-txt-link-abbreviated" href="mailto:1-1511@9.7.8.1" moz-do-not-send="true">1-1511@9.7.8.1</a>: Status 200
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22425]: WARNING: db_redis [redis_dbase.c:1489]: db_redis_perform_update(): performing full table scan on table 'dialog_vars' while performing update
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22425]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 0 is 'hash_entry'
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22425]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 1 is 'hash_id'
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22425]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 2 is 'dialog_key'
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22426]: WARNING: db_redis [redis_dbase.c:1489]: db_redis_perform_update(): performing full table scan on table 'dialog' while performing update
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22426]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 0 is 'hash_entry'
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22426]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 1 is 'hash_id'
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22426]: WARNING: db_redis [redis_dbase.c:1489]: db_redis_perform_update(): performing full table scan on table 'dialog' while performing update
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22426]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 0 is 'hash_entry'
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22426]: WARNING: db_redis [redis_dbase.c:1492]: db_redis_perform_update():   scan key 1 is 'hash_id'
Nov 16 13:23:05 proxy-1 /usr/local/kamailio/sbin/kamailio[22426]: INFO: Call-ID <a class="moz-txt-link-abbreviated" href="mailto:1-1511@9.7.8.1" moz-do-not-send="true">1-1511@9.7.8.1</a>: ACK received in A-Leg

on the redis
1542374585.810520 [7 127.0.0.1:56882] "SCAN" "0" "MATCH" "dialog:entry::*" "COUNT" "1000"
1542374585.810672 [7 127.0.0.1:56882] "EXISTS" <a class="moz-txt-link-rfc2396E" href="mailto:dialog:entry::13725:16494:1-1511@9.7.8.1" moz-do-not-send="true">"dialog:entry::13725:16494:1-1511@9.7.8.1"</a>
1542374585.810683 [7 127.0.0.1:56882] "HMGET" <a class="moz-txt-link-rfc2396E" href="mailto:dialog:entry::13725:16494:1-1511@9.7.8.1" moz-do-not-send="true">"dialog:entry::13725:16494:1-1511@9.7.8.1"</a> "hash_entry" "hash_id"
1542374585.810776 [7 127.0.0.1:56882] "HMSET" <a class="moz-txt-link-rfc2396E" href="mailto:dialog:entry::13725:16494:1-1511@9.7.8.1" moz-do-not-send="true">"dialog:entry::13725:16494:1-1511@9.7.8.1"</a> "state" "4" "timeout" "1542377585" "caller_cseq" "1" "callee_cseq" "0" "caller_contact" <a class="moz-txt-link-rfc2396E" href="mailto:sip:0000123456@9.7.8.1:5084" moz-do-not-send="true">"sip:0000123456@9.7.8.1:5084"</a> "callee_contact" <a class="moz-txt-link-rfc2396E" href="mailto:sip:50622959898@9.70.1.52:5060;transport=udp" moz-do-not-send="true">"sip:50622959898@9.70.1.52:5060;transport=udp"</a>
1542374585.810899 [7 127.0.0.1:56882] "SCAN" "0" "MATCH" "dialog:entry::*" "COUNT" "1000"
1542374585.810969 [7 127.0.0.1:56882] "EXISTS" <a class="moz-txt-link-rfc2396E" href="mailto:dialog:entry::13725:16494:1-1511@9.7.8.1" moz-do-not-send="true">"dialog:entry::13725:16494:1-1511@9.7.8.1"</a>
1542374585.810977 [7 127.0.0.1:56882] "HMGET" <a class="moz-txt-link-rfc2396E" href="mailto:dialog:entry::13725:16494:1-1511@9.7.8.1" moz-do-not-send="true">"dialog:entry::13725:16494:1-1511@9.7.8.1"</a> "hash_entry" "hash_id"
1542374585.811059 [7 127.0.0.1:56882] "HMSET" <a class="moz-txt-link-rfc2396E" href="mailto:dialog:entry::13725:16494:1-1511@9.7.8.1" moz-do-not-send="true">"dialog:entry::13725:16494:1-1511@9.7.8.1"</a> "state" "4" "timeout" "1542377585" "caller_cseq" "1" "callee_cseq" "0" "caller_contact" <a class="moz-txt-link-rfc2396E" href="mailto:sip:0000123456@9.7.8.1:5084" moz-do-not-send="true">"sip:0000123456@9.7.8.1:5084"</a> "callee_contact" <a class="moz-txt-link-rfc2396E" href="mailto:sip:50622959898@9.70.1.52:5060;transport=udp" moz-do-not-send="true">"sip:50622959898@9.70.1.52:5060;transport=udp"</a>


i don't see a redis set order to update the dialog entry key before the 200OK is received, to create and update state 1, etc. when created with dlg_manage command

could you please check if we might be missing something?

thanks a lot and regards
david

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a>
Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a></pre>
  </body>
</html>