[SR-Users] avpops and mongo problem

Henning Westerholt hw at kamailio.org
Wed Mar 21 20:17:43 CET 2018


Am Mittwoch, 21. März 2018, 17:35:17 CET schrieb hdssdsdsdsfsdf 
hdssdsdsdsfsdf:
> I have kamailio setup that uses a mongo cluster, and everything works fine.
> Only I have problems with the avpops module. The avp_db_load fails with
> "field [attribute] not found in result iterator", even if the attribute
> field is present in the object in mongo. Does anybody know what could be
> going wrong?

Hello,

what version you are using? There has been some fixes beginning of march in 
db_mongodb related to result iteration. This might be your problem as well.

The 5.1 branch contains the fix I mentioned.

Best regards,

Henning


> ============================================================================
> === kamailio.cfg:
> ...
> # ---- avpops params ----
> modparam("avpops", "db_url", DBURL)
> modparam("avpops", "avp_table", "usr_preferences")
> 
> ...
> 
> xlog("trying avp_db_load\n");
> if (avp_db_load("$fu/username", "$avp(s:attributevalue)")) {
> xlog("if succeeded\n");
> }
> xlog("if not succeeded\n");
> ...
> ============================================================================
> === mongo:
> rs:SECONDARY> db.usr_preferences.find({"username":"1234567890"})
> { "_id" : ObjectId("5ab22a5b384cd2aa0d4cf403"), "attribute" :
> "attributevalue", "username" : "1234567890", "domain" : null, "value" :
> "750", "uuid" : "", "type" : 0 }
> ===========================================================================
> ==== syslog:
> ...
> Mar 21 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]: ERROR: <script>:
> trying avp_db_load Mar 21 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]:
> DEBUG: db_mongodb [mongodb_dbase.c:851]: db_mongodb_query(): query to
> collection [usr_preferences] Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: DEBUG: db_mongodb [mongodb_dbase.c:885]:
> db_mongodb_query(): query filter: { "username" : "1234567890", "attribute"
> : "attributevalue" } Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: DEBUG: db_mongodb [mongodb_dbase.c:904]:
> db_mongodb_query(): columns filter: { "value" : 1, "attribute" : 1, "type"
> : 1 } Mar 21 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]: DEBUG:
> <core> [db_res.c:116]: db_new_result(): allocate 56 bytes for result set at
> 0x7f43b613c480 Mar 21 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]:
> DEBUG: db_mongodb [mongodb_dbase.c:349]: db_mongodb_get_columns(): 3
> columns returned from the query Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: DEBUG: <core> [db_res.c:154]:
> db_allocate_columns(): allocate 24 bytes for result names at 0x7f43b613c318
> Mar 21 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]: DEBUG: <core>
> [db_res.c:165]: db_allocate_columns(): allocate 12 bytes for result types
> at 0x7f43b614d888 Mar 21 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]:
> DEBUG: db_mongodb [mongodb_dbase.c:377]: db_mongodb_get_columns(): Found a
> field[0] named: value Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: DEBUG: db_mongodb [mongodb_dbase.c:396]:
> db_mongodb_get_columns(): allocate 16 bytes for RES_NAMES[0] at
> 0x7f43b614d9b8 Mar 21 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]:
> DEBUG: db_mongodb [mongodb_dbase.c:431]: db_mongodb_get_columns(): use
> DB1_STRING result type Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: DEBUG: db_mongodb [mongodb_dbase.c:460]:
> db_mongodb_get_columns(): RES_NAMES(0x7f43b614d9b8)[0]=[value] (2) Mar 21
> 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]: DEBUG: db_mongodb
> [mongodb_dbase.c:377]: db_mongodb_get_columns(): Found a field[1] named:
> attribute Mar 21 17:15:16 ccccc /opt/kamailio/sbin/kamailio[2544]: ERROR:
> db_mongodb [mongodb_dbase.c:381]: db_mongodb_get_columns(): field
> [attribute] not found in result iterator Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: ERROR: db_mongodb [mongodb_dbase.c:739]:
> db_mongodb_store_result(): failed to set the columns Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: ERROR: db_mongodb [mongodb_dbase.c:918]:
> db_mongodb_query(): failed to store result Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: ERROR: db_mongodb [mongodb_dbase.c:927]:
> db_mongodb_query(): failed to do the query Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: DEBUG: <core> [db_res.c:79]:
> db_free_columns(): freeing 3 columns Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: DEBUG: <core> [db_res.c:83]:
> db_free_columns(): freeing RES_NAMES[0] at 0x7f43b614d9b8 Mar 21 17:15:16
> ccccc /opt/kamailio/sbin/kamailio[2544]: DEBUG: <core> [db_res.c:92]:
> db_free_columns(): freeing result names at 0x7f43b613c318 Mar 21 17:15:16
> ccccc /opt/kamailio/sbin/kamailio[2544]: DEBUG: <core> [db_res.c:97]:
> db_free_columns(): freeing result types at 0x7f43b614d888 Mar 21 17:15:16
> ccccc /opt/kamailio/sbin/kamailio[2544]: DEBUG: <core> [db_res.c:134]:
> db_free_result(): freeing result set at 0x7f43b613c480 Mar 21 17:15:16
> ccccc /opt/kamailio/sbin/kamailio[2544]: ERROR: avpops [avpops_impl.c:381]:
> ops_dbload_avps(): db_load failed Mar 21 17:15:16 ccccc
> /opt/kamailio/sbin/kamailio[2544]: ERROR: <script>: if not succeeded ...
> ============================================================================
> ===
> 
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users





More information about the sr-users mailing list