From miconda@gmail.com Mon Jan 8 10:01:00 2018 From: Daniel-Constantin Mierla To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] Error in parse json documents in kamailio with jansson module Date: Mon, 08 Jan 2018 10:00:48 +0100 Message-ID: <8d15dcc8-2984-3a80-84eb-b9b285e236f9@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1445934948==" --===============1445934948== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Hello, the issue is triggered by the fact that the JSON document has $xyz tokens (e.g., $oid), which match the kamailio variables format, and the jansson_get() tries to replace them, but no such variable is exported by kamailio, throwing an error. Try to replace $ with $$ inside the $var(data), something like: $var(m) = "$"; $var(r) = "$$"; $var(newdata) = $(var(data){s.replace,$var(m),$var(r)}); Let us know if works, if now, we have to look at the code of jansson module and see how it evaluates its parameters for functions. Cheers, Daniel On 08.01.18 08:33, Mojtaba wrote: > Hello, > I used ndbmongo module in kamailio, > I used mongodb_find command to get some data from mongo, like this: > > if(mongodb_find("sermongo", "Asterisk", "user", "{ \"number\" : > \"$fU\" }", "res")) { > xlog("L_INFO", "Data from mongodb is \" > $mongodb(res=>value) \" \n"); > $var(data) = $mongodb(res=>value); > } > The result in syslog is like this: > Jan 8 07:23:36 ubuntu14 /usr/local/sbin/kamailio[12127]: {1 2 INVITE > MDRlMjRlNGVjZGY1Y2JkYjA5OGM2ZTg1ZTFjZTk0Nzg.} INFO: