<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>how was the record (json document) inserted in the location
      table? It doesn't seem to have valid values...</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 05.11.18 13:13, Denys Pozniak wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+x3AxrZHdgt76mQLUgmUhYcAWb35PURmkqC=8b64f-OOz=qEw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div>Hello!</div>
                      <div><br>
                      </div>
                      <div>I want to keep user location in mongodb, but
                        Kamailio does not start well.</div>
                      <div><br>
                      </div>
                      <div>Configuration:<br>
                      </div>
                      <div><br>
                      </div>
                      <div>loadmodule "usrloc.so"<br>
                      </div>
                      <div>
                        <div>loadmodule "db_mongodb.so"</div>
                        <div>modparam("usrloc", "db_insert_null", 1)</div>
                        <div>modparam("usrloc", "db_url",
                          "mongodb://mongodb.test/kamailio")</div>
                      </div>
                      <div>
                        <div>modparam("usrloc", "db_mode", 2)<br>
                        </div>
                        <div>modparam("usrloc", "timer_interval", 30)<br>
                        </div>
                        <div>modparam("usrloc", "desc_time_order", 1)<br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                      <div><br>
                      </div>
                      <div>
                        <div>Mongodb:</div>
                        <div><br>
                        </div>
                        <div>
                          <div>rs0:PRIMARY> use kamailio</div>
                          <div>switched to db kamailio</div>
                        </div>
                        <div>rs0:PRIMARY> db.location.find()<br>
                        </div>
                        <div>
                          <div>{ "_id" :
                            ObjectId("5be024d6b9d8febf4ae19681"), "name"
                            : "location", "version" : 9, "columns" : {
                            "id" : { "type" : "int", "default" : null,
                            "null" : false }, "ruid" : { "type" :
                            "string", "default" : "", "null" : false },
                            "username" : { "type" : "string", "default"
                            : "", "null" : false }, "domain" : { "type"
                            : "string", "default" : null, "null" : true
                            }, "contact" : { "type" : "string",
                            "default" : "", "null" : false }, "received"
                            : { "type" : "string", "default" : null,
                            "null" : true }, "path" : { "type" :
                            "string", "default" : null, "null" : true },
                            "expires" : { "type" : "datetime", "default"
                            : "2030-05-28 21:32:15", "null" : false },
                            "q" : { "type" : "double", "default" : 1,
                            "null" : false }, "callid" : { "type" :
                            "string", "default" : "Default-Call-ID",
                            "null" : false }, "cseq" : { "type" : "int",
                            "default" : 1, "null" : false },
                            "last_modified" : { "type" : "datetime",
                            "default" : "2000-01-01 00:00:01", "null" :
                            false }, "flags" : { "type" : "int",
                            "default" : 0, "null" : false }, "cflags" :
                            { "type" : "int", "default" : 0, "null" :
                            false }, "user_agent" : { "type" : "string",
                            "default" : "", "null" : false }, "socket" :
                            { "type" : "string", "default" : null,
                            "null" : true }, "methods" : { "type" :
                            "int", "default" : null, "null" : true },
                            "instance" : { "type" : "string", "default"
                            : null, "null" : true }, "reg_id" : { "type"
                            : "int", "default" : 0, "null" : false },
                            "server_id" : { "type" : "int", "default" :
                            0, "null" : false }, "connection_id" : {
                            "type" : "int", "default" : 0, "null" :
                            false }, "keepalive" : { "type" : "int",
                            "default" : 0, "null" : false }, "partition"
                            : { "type" : "int", "default" : 0, "null" :
                            false } } }</div>
                          <div>{ "_id" :
                            ObjectId("5be02a77175610be86a1a589"),
                            "username" : "dummy_user" }</div>
                        </div>
                        <br class="gmail-Apple-interchange-newline">
                      </div>
                      <div><br>
                      </div>
                      <div>Syslog:</div>
                      <div><br>
                      </div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: ERROR: db_mongodb
                        [mongodb_dbase.c:416]: db_mongodb_get_columns():
                        field [username] not found in result iterator</div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: ERROR: db_mongodb
                        [mongodb_dbase.c:815]:
                        db_mongodb_store_result(): failed to set the
                        columns</div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: ERROR: db_mongodb
                        [mongodb_dbase.c:1018]: db_mongodb_query():
                        failed to store result</div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: ERROR: db_mongodb
                        [mongodb_dbase.c:1027]: db_mongodb_query():
                        failed to do the query</div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: ERROR: usrloc
                        [udomain.c:457]: preload_udomain(): db_query
                        failed</div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: ERROR: usrloc
                        [usrloc_mod.c:430]: child_init(): child(1):
                        failed to preload domain 'location'</div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: ERROR: <core>
                        [core/sr_module.c:946]: init_mod_child(): error
                        while initializing module usrloc
                        (/usr/lib64/kamailio/modules/usrloc.so) (idx: 1
                        rank: 1 desc: [udp receiver child=0 sock=<a
                          href="http://10.10.10.10:5060"
                          moz-do-not-send="true">10.10.10.10:5060</a>])</div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: ERROR: <core>
                        [core/pt.c:340]: fork_process(): init_child
                        failed for process 1, pid 21543, "udp receiver
                        child=0 sock=<a href="http://10.10.10.10:5060"
                          moz-do-not-send="true">10.10.10.10:5060</a>"</div>
                      <div>Nov  5 12:51:01 dev-rtpengine
                        /usr/sbin/kamailio[21543]: CRITICAL:
                        <core> [main.c:1607]: main_loop(): Cannot
                        fork</div>
                      <div><br>
                      </div>
                      <div>
                        <div><br>
                        </div>
                      </div>
                      <div>2018-11-05T13:07:19.117+0100 D COMMAND 
                        [conn367] run command kamailio.$cmd { find:
                        "version", filter: { table_name: "location" },
                        projection: { table_version: 1 } }<br>
                      </div>
                      <div>
                        <div>2018-11-05T13:07:19.118+0100 I COMMAND 
                          [conn367] command kamailio.version command:
                          find { find: "version", filter: { table_name:
                          "location" }, projection: { table_version: 1 }
                          } planSummary: COLLSCAN keysExamined:0
                          docsExamined:2 cursorExhausted:1 numYields:0
                          nreturned:1 reslen:148 locks:{ Global: {
                          acquireCount: { r: 2 } }, Database: {
                          acquireCount: { r: 1 } }, Collection: {
                          acquireCount: { r: 1 } } } protocol:op_query
                          0ms</div>
                        <div>2018-11-05T13:07:19.118+0100 D COMMAND 
                          [conn367] run command kamailio.$cmd { find:
                          "location", filter: { username: "dummy_user"
                          }, projection: { username: 1 } }</div>
                        <div>2018-11-05T13:07:19.119+0100 I COMMAND 
                          [conn367] command kamailio.location command:
                          find { find: "location", filter: { username:
                          "dummy_user" }, projection: { username: 1 } }
                          planSummary: COLLSCAN keysExamined:0
                          docsExamined:2 cursorExhausted:1 numYields:0
                          nreturned:1 reslen:155 locks:{ Global: {
                          acquireCount: { r: 2 } }, Database: {
                          acquireCount: { r: 1 } }, Collection: {
                          acquireCount: { r: 1 } } } protocol:op_query
                          0ms</div>
                        <div>2018-11-05T13:07:19.178+0100 D COMMAND 
                          [conn368] run command kamailio.$cmd { find:
                          "location", filter: {}, projection: {
                          username: 1, contact: 1, expires: 1, q: 1,
                          callid: 1, cseq: 1, flags: 1, cflags: 1,
                          user_agent: 1, received: 1, path: 1, socket:
                          1, methods: 1, last_modified: 1, ruid: 1,
                          instance: 1, reg_id: 1, server_id: 1,
                          connection_id: 1, keepalive: 1 } }</div>
                        <div>2018-11-05T13:07:19.179+0100 I COMMAND 
                          [conn368] command kamailio.location command:
                          find { find: "location", filter: {},
                          projection: { username: 1, contact: 1,
                          expires: 1, q: 1, callid: 1, cseq: 1, flags:
                          1, cflags: 1, user_agent: 1, received: 1,
                          path: 1, socket: 1, methods: 1, last_modified:
                          1, ruid: 1, instance: 1, reg_id: 1, server_id:
                          1, connection_id: 1, keepalive: 1 } }
                          planSummary: COLLSCAN keysExamined:0
                          docsExamined:2 cursorExhausted:1 numYields:0
                          nreturned:2 reslen:180 locks:{ Global: {
                          acquireCount: { r: 2 } }, Database: {
                          acquireCount: { r: 1 } }, Collection: {
                          acquireCount: { r: 1 } } } protocol:op_query
                          0ms</div>
                        <div><br>
                        </div>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div>
                        <div>[root@dev-rtpengine kamailio]# kamailio -v</div>
                        <div>version: kamailio 5.1.6 (x86_64/linux)
                          7d1964</div>
                        <div>flags: STATS: Off, USE_TCP, USE_TLS,
                          USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS,
                          DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK,
                          SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC,
                          F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY,
                          USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT,
                          USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR,
                          USE_DST_BLACKLIST, HAVE_RESOLV_RES</div>
                        <div>ADAPTIVE_WAIT_LOOPS=1024,
                          MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024,
                          BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB</div>
                        <div>poll method support: poll, epoll_lt,
                          epoll_et, sigio_rt, select.</div>
                        <div>id: 7d1964</div>
                        <div>compiled on 11:10:15 Nov  4 2018 with gcc
                          4.8.5</div>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      -- <br>
                      <div dir="ltr" class="gmail_signature">
                        <div dir="ltr"><br>
                          <div>
                            <div>BR,</div>
                            <div>Denys Pozniak<br>
                            </div>
                            <div><br>
                            </div>
                            <div><br>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <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>
    <br>
    <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>