[OpenSIPS-Users] For-Each Example

Liviu Chircu liviu at opensips.org
Wed Sep 9 13:16:56 CEST 2015


Hi Kneeoh,

The $json(contact) iterators are only available for the upcoming 
OpenSIPS 2.2, or current *master* branch on GitHub [1], which is the 
version specifically addressed by the documentation page you followed on 
opensips.org [2]

[1]: https://github.com/OpenSIPS/opensips
[2]: http://www.opensips.org/Documentation/Script-Statements-2-2

Best regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 09.09.2015 00:01, Kneeoh wrote:
> I'm trying to figure out how to iterate through an indexed $avp that 
> holds json query results. The docs are kind of spotty. Can someone 
> share a working snippet of code that iterates through an $avp ? This 
> one isn't quite working for me. First off it says only $var and $avp 
> can be iterated, but this example has a $json var.
>
> # iterate through all JSON documents returned by a MongoDB query
>      cache_raw_query("mongodb:location", "{... find ...}", "$avp(res)");
>      for ($json(contact) in $(avp(res)[*]))
>          xlog("Found: $json(contact/phone) $json(contact/email)\n");
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150909/04fb4fd8/attachment.htm>


More information about the Users mailing list