[SR-Users] db_mongodb_get_columns(): field [username] not found in result iterator

Denys Pozniak denys.pozniak at gmail.com
Tue Nov 6 11:02:35 CET 2018


Added also:
rs0:PRIMARY> db.getCollection("version").insert({table_name: "domain",
table_version: NumberInt(2) })

And now Kamailio works!
Thanks!


вт, 6 нояб. 2018 г. в 11:57, Denys Pozniak <denys.pozniak at gmail.com>:

> Hello!
>
> According to this tutorial (
> https://www.kamailio.org/wiki/tutorials/kamailio-and-mongodb ) I need to
> create table version only, but looks like Kamailio expects location table
> also:
>
> Nov  6 10:48:44 dev /usr/sbin/kamailio[2823]: ERROR: <core> [db.c:450]:
> db_check_table_version(): invalid version 0 for table location found,
> expected 9 (check table structure and table "version")
> Nov  6 10:48:44 dev /usr/sbin/kamailio[2823]: ERROR: usrloc [dlist.c:649]:
> register_udomain(): error during table version check.
> Nov  6 10:48:44 dev /usr/sbin/kamailio[2823]: ERROR: registrar
> [registrar.c:651]: domain_fixup(): failed to register domain
> Nov  6 10:48:44 dev /usr/sbin/kamailio[2823]: ERROR: <core>
> [core/route.c:1154]: fix_actions(): fixing failed (code=-1) at
> cfg:/etc/kamailio/routing.d/auth.cfg:53
> Nov  6 10:48:44 dev /usr/sbin/kamailio[2823]: ERROR: <core>
> [core/rvalue.c:3860]: fix_rval_expr(): failure in cfg at line: 53 col: 44
> Nov  6 10:48:44 dev /usr/sbin/kamailio[2823]: ERROR: <core>
> [core/rvalue.c:3860]: fix_rval_expr(): failure in cfg at line: 53 col: 44
> Nov  6 10:48:44 dev /usr/sbin/kamailio[2823]: ERROR: <core>
> [core/route.c:1154]: fix_actions(): fixing failed (code=-1) at
> cfg:/etc/kamailio/routing.d/auth.cfg:55
> Nov  6 10:48:44 dev /usr/sbin/kamailio[2823]: ERROR: <core>
> [core/route.c:1154]: fix_actions(): fixing failed (code=-1) at
> cfg:/etc/kamailio/routing.d/auth.cfg:86
>
>
>
>
>
> пн, 5 нояб. 2018 г. в 19:16, Daniel-Constantin Mierla <miconda at gmail.com>:
>
>> Hello,
>>
>> that file you get with wget is sort of schema definition, but doesn't
>> have to be imported in mongo. Delete it, only Kamailio should insert into
>> location table.
>>
>> Cheers,
>> Daniel
>>
>> On 05.11.18 16:23, Denys Pozniak wrote:
>>
>> My steps:
>> 1) wget
>> https://raw.githubusercontent.com/kamailio/kamailio/master/utils/kamctl/mongodb/kamailio/location.json
>>
>> 2)        [root at mongodb-1 root]# mongoimport --db test --collection
>> location --file location.json -vvvv
>>
>> 2018-11-05T16:17:30.422+0100    using 1 decoding workers
>> 2018-11-05T16:17:30.422+0100    using 1 insert workers
>> 2018-11-05T16:17:30.423+0100    filesize: 2131 bytes
>> 2018-11-05T16:17:30.423+0100    using fields:
>> 2018-11-05T16:17:30.424+0100    will listen for SIGTERM, SIGINT, and
>> SIGKILL
>> 2018-11-05T16:17:30.428+0100    connected to: localhost
>> 2018-11-05T16:17:30.428+0100    ns: test.location
>> 2018-11-05T16:17:30.428+0100    connected to node type: replset
>> 2018-11-05T16:17:30.428+0100    using write concern: w='majority',
>> j=false, fsync=false, wtimeout=0
>> 2018-11-05T16:17:30.428+0100    using write concern: w='majority',
>> j=false, fsync=false, wtimeout=0
>> 2018-11-05T16:17:30.428+0100    Failed: error processing document #1:
>> invalid character ':' after array element
>> 2018-11-05T16:17:30.428+0100    imported 0 documents
>>
>>
>> 3) Tested with JSON validator and the same:
>>
>> Results
>>
>> Error: Parse error on line 5:
>> ...	"columns": [		"id": {			"type": "int"
>> ----------------------^
>>
>> Expecting 'EOF', '}', ',', ']', got ':'
>>
>> 4) Changed  manually
>>
>> "columns": [  -->   "columns": {
>>  ] -- > }
>>
>>
>> 5)        [root at mongodb-1 root]# mongoimport --db test --collection
>> location --file location.json -vvvv
>>
>> 2018-11-05T16:21:11.454+0100    using 1 decoding workers
>> 2018-11-05T16:21:11.455+0100    using 1 insert workers
>> 2018-11-05T16:21:11.455+0100    filesize: 2132 bytes
>> 2018-11-05T16:21:11.456+0100    using fields:
>> 2018-11-05T16:21:11.456+0100    will listen for SIGTERM, SIGINT, and
>> SIGKILL
>> 2018-11-05T16:21:11.460+0100    connected to: localhost
>> 2018-11-05T16:21:11.460+0100    ns: test.location
>> 2018-11-05T16:21:11.461+0100    connected to node type: replset
>> 2018-11-05T16:21:11.461+0100    using write concern: w='majority',
>> j=false, fsync=false, wtimeout=0
>> 2018-11-05T16:21:11.461+0100    using write concern: w='majority',
>> j=false, fsync=false, wtimeout=0
>> 2018-11-05T16:21:11.463+0100    got line: [{name location} {version 9}
>> {columns [{id [{type int} {default <nil>} {null false}]} {ruid [{type
>> string} {default } {null false}]} {username [{type string} {default } {null
>> false}]} {domain [{type string} {default <nil>} {null true}]} {contact
>> [{type string} {default } {null false}]} {received [{type string} {default
>> <nil>} {null true}]} {path [{type string} {default <nil>} {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 <nil>} {null true}]} {methods
>> [{type int} {default <nil>} {null true}]} {instance [{type string} {default
>> <nil>} {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}]}]}]
>> 2018-11-05T16:21:11.464+0100    got extended line:
>> bson.D{bson.DocElem{Name:"name", Value:"location"},
>> bson.DocElem{Name:"version", Value:9}, bson.DocElem{Name:"columns",
>> Value:bson.D{bson.DocElem{Name:"id", Value:bson.D{bson.DocElem{Name:"type",
>> Value:"int"}, bson.DocElem{Name:"default", Value:interface {}(nil)},
>> bson.DocElem{Name:"null", Value:false}}}, bson.DocElem{Name:"ruid",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:""}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"username",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:""}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"domain",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:interface {}(nil)},
>> bson.DocElem{Name:"null", Value:true}}}, bson.DocElem{Name:"contact",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:""}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"received",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:interface {}(nil)},
>> bson.DocElem{Name:"null", Value:true}}}, bson.DocElem{Name:"path",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:interface {}(nil)},
>> bson.DocElem{Name:"null", Value:true}}}, bson.DocElem{Name:"expires",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"datetime"},
>> bson.DocElem{Name:"default", Value:"2030-05-28 21:32:15"},
>> bson.DocElem{Name:"null", Value:false}}}, bson.DocElem{Name:"q",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"double"},
>> bson.DocElem{Name:"default", Value:1}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"callid",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:"Default-Call-ID"},
>> bson.DocElem{Name:"null", Value:false}}}, bson.DocElem{Name:"cseq",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:1}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"last_modified",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"datetime"},
>> bson.DocElem{Name:"default", Value:"2000-01-01 00:00:01"},
>> bson.DocElem{Name:"null", Value:false}}}, bson.DocElem{Name:"flags",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:0}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"cflags",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:0}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"user_agent",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:""}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"socket",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:interface {}(nil)},
>> bson.DocElem{Name:"null", Value:true}}}, bson.DocElem{Name:"methods",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:interface {}(nil)},
>> bson.DocElem{Name:"null", Value:true}}}, bson.DocElem{Name:"instance",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"string"},
>> bson.DocElem{Name:"default", Value:interface {}(nil)},
>> bson.DocElem{Name:"null", Value:true}}}, bson.DocElem{Name:"reg_id",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:0}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"server_id",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:0}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"connection_id",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:0}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"keepalive",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:0}, bson.DocElem{Name:"null",
>> Value:false}}}, bson.DocElem{Name:"partition",
>> Value:bson.D{bson.DocElem{Name:"type", Value:"int"},
>> bson.DocElem{Name:"default", Value:0}, bson.DocElem{Name:"null",
>> Value:false}}}}}}
>> 2018-11-05T16:21:11.603+0100    imported 1 document
>>
>>
>> [root at mongodb-1 root]# mongo --version
>> MongoDB shell version v3.4.10
>> git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
>> OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
>> allocator: tcmalloc
>> modules: none
>> build environment:
>>     distmod: rhel70
>>     distarch: x86_64
>>     target_arch: x86_64
>>
>>
>>
>>
>>
>>
>>
>>
>> пн, 5 нояб. 2018 г. в 16:55, Daniel-Constantin Mierla <miconda at gmail.com
>> >:
>>
>>> Hello,
>>>
>>> how was the record (json document) inserted in the location table? It
>>> doesn't seem to have valid values...
>>>
>>> Cheers,
>>> Daniel
>>>
>>> On 05.11.18 13:13, Denys Pozniak wrote:
>>>
>>> Hello!
>>>
>>> I want to keep user location in mongodb, but Kamailio does not start
>>> well.
>>>
>>> Configuration:
>>>
>>> loadmodule "usrloc.so"
>>> loadmodule "db_mongodb.so"
>>> modparam("usrloc", "db_insert_null", 1)
>>> modparam("usrloc", "db_url", "mongodb://mongodb.test/kamailio")
>>> modparam("usrloc", "db_mode", 2)
>>> modparam("usrloc", "timer_interval", 30)
>>> modparam("usrloc", "desc_time_order", 1)
>>>
>>>
>>> Mongodb:
>>>
>>> rs0:PRIMARY> use kamailio
>>> switched to db kamailio
>>> rs0:PRIMARY> db.location.find()
>>> { "_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 } } }
>>> { "_id" : ObjectId("5be02a77175610be86a1a589"), "username" :
>>> "dummy_user" }
>>>
>>>
>>> Syslog:
>>>
>>> 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
>>> 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
>>> 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
>>> 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
>>> Nov  5 12:51:01 dev-rtpengine /usr/sbin/kamailio[21543]: ERROR: usrloc
>>> [udomain.c:457]: preload_udomain(): db_query failed
>>> 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'
>>> 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=10.10.10.10:5060])
>>> 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=10.10.10.10:5060"
>>> Nov  5 12:51:01 dev-rtpengine /usr/sbin/kamailio[21543]: CRITICAL:
>>> <core> [main.c:1607]: main_loop(): Cannot fork
>>>
>>>
>>> 2018-11-05T13:07:19.117+0100 D COMMAND  [conn367] run command
>>> kamailio.$cmd { find: "version", filter: { table_name: "location" },
>>> projection: { table_version: 1 } }
>>> 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
>>> 2018-11-05T13:07:19.118+0100 D COMMAND  [conn367] run command
>>> kamailio.$cmd { find: "location", filter: { username: "dummy_user" },
>>> projection: { username: 1 } }
>>> 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
>>> 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 } }
>>> 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
>>>
>>>
>>>
>>> [root at dev-rtpengine kamailio]# kamailio -v
>>> version: kamailio 5.1.6 (x86_64/linux) 7d1964
>>> 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
>>> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024,
>>> BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
>>> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
>>> id: 7d1964
>>> compiled on 11:10:15 Nov  4 2018 with gcc 4.8.5
>>>
>>>
>>>
>>>
>>> --
>>>
>>> BR,
>>> Denys Pozniak
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing Listsr-users at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>> --
>>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
>>> Kamailio World Conference -- www.kamailioworld.com
>>> Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- www.asipto.com
>>>
>>>
>>
>> --
>>
>> BR,
>> Denys Pozniak
>>
>>
>>
>> --
>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
>> Kamailio World Conference -- www.kamailioworld.com
>> Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- www.asipto.com
>>
>>
>
> --
>
> BR,
> Denys Pozniak
>
>
>

-- 

BR,
Denys Pozniak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181106/d18fd119/attachment.html>


More information about the sr-users mailing list