[asterisk-dev] [Code Review] Sorcery retrieve_by_regex support

Matt Jordan reviewboard at asterisk.org
Thu Feb 14 13:42:43 CST 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2329/#review7868
-----------------------------------------------------------


So this is close to what we need, but I'm not sure it captures all of it.

What we're going to have are objects that, in their configuration, have 'tables' of parameters. Take, for example, ConfBridge's DTMF menus. The configuration will look something like:

[menu]

1 = foo
2 = bar
3 = foobar

Currently, we register these configuration options to a custom handler, such that the custom handler parses out the key/value pair and stores it on the configuration object. The configuration framework does the job of matching the various configuration options in the menu type to the custom handler.

This patch lets you retrieve multiple objects that match a regex, but doesn't let you register the options as regular expressions themselves. Correct me if I'm wrong, but it looks like we'd still need to explicitly register a configuration option for '1', '2', '3', etc. - when in reality we want all [1-9] to just go call a custom handler and let the handler sort out the mapping.

If I'm wrong, disregard :-)

- Matt


On Feb. 14, 2013, 9:52 a.m., Joshua Colp wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2329/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2013, 9:52 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This change adds a retrieve_by_regex API call to sorcery. It allows searching for multiple objects using a regular expression on the object identifier. This is useful if you have related objects and want to efficiently find them.
> 
> 
> Diffs
> -----
> 
>   /trunk/include/asterisk/sorcery.h 381399 
>   /trunk/main/sorcery.c 381399 
>   /trunk/res/res_sorcery_config.c 381399 
>   /trunk/res/res_sorcery_memory.c 381399 
>   /trunk/tests/test_sorcery.c 381399 
> 
> Diff: https://reviewboard.asterisk.org/r/2329/diff
> 
> 
> Testing
> -------
> 
> Ran unit test, confirmed happy.
> 
> 
> Thanks,
> 
> Joshua
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130214/6aa69bc3/attachment.htm>


More information about the asterisk-dev mailing list