<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>I don't know if you can see the result sent back by mongodb in
      its logs, it doesn't show it there. Maybe you can sniff the
      traffic on the network and see if mongodb sends the proper
      response back. Kamailio logs like nothing was retrieved.<br>
    </p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 22.02.18 18:02, Stephane Focant
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+UObvk4draAziGyWES6PEQh+rAOEL6moeZPTAbKLYoLr4J12Q@mail.gmail.com">
      <div dir="ltr">
        <div>Hello,</div>
        <div>I have an issue when I try to use kamailio 5.1 with usrloc
          and db_mongdb modules.</div>
        <div>When I try to start kamailio, I get the following error:</div>
        <div><br>
        </div>
        <div>0(22216) DEBUG: <core> [db.c:314]: db_do_init2():
          connection 0x7f735b5c4100 not found in pool</div>
        <div> 0(22216) DEBUG: db_mongodb [mongodb_connection.c:55]:
          db_mongodb_new_connection(): connection open to: mongodb://<a
            href="http://10.0.12.149" moz-do-not-send="true">10.0.12.149</a>,10.0.12.150,<a
href="http://10.0.12.151/kamailio?replicaSet=sre_location&slaveOk=true&readPreference=primaryPreferred"
            moz-do-not-send="true">10.0.12.151/kamailio?replicaSet=sre_location&slaveOk=true&readPreference=primaryPreferred</a></div>
        <div> 0(22216) DEBUG: db_mongodb [mongodb_dbase.c:864]:
          db_mongodb_query(): query to collection [version]</div>
        <div> 0(22216) DEBUG: db_mongodb [mongodb_dbase.c:898]:
          db_mongodb_query(): query filter: { "table_name" : "location"
          }</div>
        <div> 0(22216) DEBUG: db_mongodb [mongodb_dbase.c:917]:
          db_mongodb_query(): columns filter: { "table_version" : 1 }</div>
        <div> 0(22216) DEBUG: <core> [db_res.c:120]:
          db_new_result(): allocate 56 bytes for result set at
          0x7f735b5c4450</div>
        <div> 0(22216) DEBUG: db_mongodb [mongodb_dbase.c:746]:
          db_mongodb_store_result(): no result from mongodb</div>
        <div> 0(22216) DEBUG: <core> [db.c:404]:
          db_table_version(): no row for table location found</div>
        <div> 0(22216) ERROR: <core> [db.c:450]:
          db_check_table_version(): invalid version 0 for table location
          found, expected 9 (check table structure and table "version")</div>
        <div> 0(22216) ERROR: usrloc [dlist.c:659]: register_udomain():
          error during table version check.</div>
        <div> 0(22216) DEBUG: <core> [db_pool.c:100]:
          pool_remove(): removing connection from the pool</div>
        <div> 0(22216) ERROR: registrar [registrar.c:651]:
          domain_fixup(): failed to register domain</div>
        <div> 0(22216) ERROR: <core> [core/route.c:1154]:
          fix_actions(): fixing failed (code=-1) at
          cfg:/usr/local/kamailio-5.1/etc/kamailio/kamailio.cfg:660</div>
        <div> 0(22216) ERROR: <core> [core/rvalue.c:3860]:
          fix_rval_expr(): failure in cfg at line: 660 col: 22</div>
        <div> 0(22216) ERROR: <core> [core/rvalue.c:3860]:
          fix_rval_expr(): failure in cfg at line: 660 col: 22</div>
        <div> 0(22216) ERROR: <core> [core/route.c:1154]:
          fix_actions(): fixing failed (code=-1) at
          cfg:/usr/local/kamailio-5.1/etc/kamailio/kamailio.cfg:663</div>
        <div>ERROR: error -1 while trying to fix configuration</div>
        <div> 0(22216) DEBUG: tm [t_funcs.c:85]: tm_shutdown(): start</div>
        <div> 0(22216) DEBUG: tm [t_funcs.c:88]: tm_shutdown(): emptying
          hash table</div>
        <div> 0(22216) DEBUG: tm [t_funcs.c:90]: tm_shutdown(): removing
          semaphores</div>
        <div> 0(22216) DEBUG: tm [t_funcs.c:92]: tm_shutdown():
          destroying tmcb lists</div>
        <div> 0(22216) DEBUG: tm [t_funcs.c:95]: tm_shutdown(): done</div>
        <div> 0(22216) INFO: <core> [core/sctp_core.c:53]:
          sctp_core_destroy(): SCTP API not initialized</div>
        <div> 0(22216) DEBUG: <core> [core/mem/shm.c:261]:
          shm_destroy_manager(): destroying memory manager: q_malloc</div>
        <div> 0(22216) DEBUG: <core> [core/mem/q_malloc.c:1165]:
          qm_shm_lock_destroy(): destroying the shared memory lock</div>
        <div> 0(22216) DEBUG: <core> [core/mem/pkg.c:91]:
          pkg_destroy_manager(): destroying memory manager: q_malloc</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>In mongoDB, I have the collection "version" in the db
          kamailio, and the entries needed for usrloc (location and
          location_attrs):</div>
        <div>sre_location:PRIMARY> use kamailio</div>
        <div>switched to db kamailio</div>
        <div>sre_location:PRIMARY> db.getCollection("version").find()</div>
        <div>{ "_id" : ObjectId("5a8ec43c601b262bef82a595"),
          "table_name" : "location", "table_version" : 9 }</div>
        <div>{ "_id" : ObjectId("5a8edb72a3ec40427577b8d0"),
          "table_name" : "location_attrs", "table_version" : 1 }</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>And logs in mongo show the following info when kamailio
          starts:</div>
        <div><br>
        </div>
        <div>2018-02-22T17:13:02.604+0100 I NETWORK  [conn90] received
          client metadata from <a href="http://10.0.12.180:56320"
            moz-do-not-send="true">10.0.12.180:56320</a> conn: { driver:
          { name: "mongoc", version: "1.9.2" }, os: { type: "Linux",
          name: "CentOS", version: "6.9 (Final)", architecture: "x86_64"
          }, platform: "cfg=0x1563000 posix=200809 CC=GCC 4.4.7 20120313
          (Red Hat 4.4.7-18) CFLAGS="" LDFLAGS=""" }</div>
        <div>2018-02-22T17:13:02.604+0100 I COMMAND  [conn90] command
          admin.$cmd command: isMaster { isMaster: 1, client: { driver:
          { name: "mongoc", version: "1.9.2" }, os: { type: "Linux",
          name: "CentOS", version: "6.9 (Final)", architecture: "x86_64"
          }, platform: "cfg=0x1563000 posix=200809 CC=GCC 4.4.7 20120313
          (Red Hat 4.4.7-18) CFLAGS="" LDFLAGS=""" }, compression: [],
          $readPreference: { mode: "secondaryPreferred" }, $db: "admin"
          } numYields:0 reslen:716 locks:{} protocol:op_query 0ms</div>
        <div>2018-02-22T17:13:02.604+0100 I COMMAND  [conn90] command
          kamailio.$cmd command: find { find: "version", filter: {
          table_name: "location" }, table_version: 1, $db: "kamailio",
          $readPreference: { mode: "primaryPreferred" }, $clusterTime: {
          clusterTime: Timestamp(1519315979, 1), signature: { hash:
          BinData(0, 0000000000000000000000000000000000000000), keyId: 0
          } } } numYields:0 reslen:531 locks:{} protocol:op_msg 0ms</div>
        <div>2018-02-22T17:13:02.605+0100 I NETWORK  [conn90] end
          connection <a href="http://10.0.12.180:56320"
            moz-do-not-send="true">10.0.12.180:56320</a> (9 connections
          now open)</div>
        <div><br>
        </div>
        <div>I probably miss something: it is not clear to me why
          kamailio is not able to retrieve the value of table_version
          for the table_name location. Any idea would be very welcome !</div>
        <div><br>
        </div>
        <div>I use mongo-c-driver 1.9.2 and mongodb 3.6</div>
        <div><br>
        </div>
        <div>Thank you.</div>
        <div>Stephane</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.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 Advanced Training - March 5-7, 2018, Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>