Hello,

I have enhanced the way REDIS replied are accessed in the Kamailio config, to be able to access arrays that are members of other arrays. In the original code, we could access members of an array like this: $redis(reply=>value[0]).
But if that member was itself an array it was impossible to access it, as accessing an array directly returns (null). This case can happen if we use redis transactions with, and all commands are given between MULTI and EXEC commands. Then the EXEC command returns an array with the responses of the individual commands, so if any command returns an array, then we have an array within that array.

I have modified the syntax of the redis replies in the config, to be able to add other keys after value[n] keys. This way we can access members of the array within the first array.
For example after the following sequence:

redis_cmd("srvN", "MULTI", "r1");
redis_cmd("srvN", "SMEMBERS foo", "r2");
redis_cmd("srvN", "EXEC", "reply")

The PV to access the response will look like this


You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/1147

Commit Summary

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.