[OpenSIPS-Users] MongoDB bug
Vlad Paiu
vladpaiu at opensips.org
Mon May 13 11:43:43 CEST 2013
Hello,
First of all, if you are trying to fetch the username that's registered,
you need to query for the $tU.
About the actual MongoDB issue, the phone field is number long ? Looking
at the code, seems the cachedb_mongodb does not yet support NumberLong
fields. Will prepare a patch for this and send it to you.
Best Regards,
Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com
On 05/13/2013 12:03 PM, kamika wrote:
> Ok. This is a small peace that triggers MongoDB according to documentation
>
> if(is_method("REGISTER")){
> xlog("Making raw query to mongo server for $fU");
> cache_raw_query("mongodb","{ \"op\" : \"find\", \"query\": {\"phone\":$fU},
> \"fields\": {\"password\":1,\"email\":1}}","$avp(mongo_result)");
> $var(it) = 0;
>
> while ($(avp(mongo_result)[$var(it)]) != NULL) {
> $json(json_res) := $(avp(mongo_result)[$var(it)]);
> xlog("Fetched a new mongo result=$json(json_res).
> entry1=$json(json_res/entry1) \n");
> $var(it) = $var(it) + 1;
> $json(json_res) = NULL;
> }
> exit;
> }
>
>
> Now I am trying top register with $fU=77072517003
>
> and I am getting the following debug log
>
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_msg:
> SIP Request:
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_msg:
> method: <REGISTER>
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_msg:
> uri: <sip:jabber.govoruntel.ru>
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_msg:
> version: <SIP/2.0>
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:parse_headers: flags=2
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:get_hdr_field: cseq <CSeq>: <1446> <REGISTER>
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:parse_via_param: found param type 232, <branch> =
> <z9hG4bKd7a90c51-e509-1910-8d13-001a4d3818cf>; state=6
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:parse_via_param: found param type 235, <rport> = <n/a>; state=17
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_via:
> end of header reached, state=5
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:parse_headers: via found, flags=2
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:parse_headers: this is the first via
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:receive_msg: After parse_msg...
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:receive_msg: preparing to run routing scripts...
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:parse_headers: flags=100
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_to:
> end of header reached, state=10
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_to:
> display={}, ruri={sip:77072517003 at jabber.govoruntel.ru}
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:get_hdr_field: <To> [40];
> uri=[sip:77072517003 at jabber.govoruntel.ru]
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:get_hdr_field: to body
> [<sip:77072517003 at jabber.govoruntel.ru>#015#012]
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:get_hdr_field: content_length=0
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:maxfwd:is_maxfwd_present: value = 70
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:parse_to_param: tag=eee1b5da-e409-1910-8d12-001a4d3818cf
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_to:
> end of header reached, state=29
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:parse_to:
> display={}, ruri={sip:77072517003 at jabber.govoruntel.ru}
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: Making raw query to
> mongo server for 77072517003
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]: DBG:core:do_action:
> The query expects 1 results back
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:cachedb_raw_query: from script [mongodb] - no grp
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:cachedb_mongodb:mongo_con_raw_query: Get operation on namespace
> govorun.users
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:cachedb_mongodb:json_to_bson: Trying to convert [{ "op" : "find",
> "query": {"phone":77072517003}, "fields": {"password":1,"email":1}}]
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:cachedb_mongodb:mongo_cursor_to_json: Fetched 0 results
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:destroy_avp_list: destroying list (nil)
> May 13 09:01:39 presence /usr/local/sbin/opensips[9641]:
> DBG:core:receive_msg: cleaning up
>
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/MongoDB-bug-tp7586282p7586292.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list