[OpenSIPS-Users] feature request feedback

Brett Nemeroff brett at nemeroff.com
Tue May 26 18:29:12 CEST 2009

Well,I think for best_match, I think it's main use is routing lookups. I
could see a variant of it that can handle subnet matching as well. After
all, the whole point is to detect and rewrite, right?

So in general, I don't see best_match doing a whole lot other than routing..
I can tell you, I'd probably also use it for rating and costing in realtime.
But likewise, it'd be the kind of thing I take a dialed number or the ANI
and look for a best match pattern to retrieve the route, cost, or rate. For
ANI, you could use it for RPID pattern enforcement. I think it would be a
good addition. It would allow for the creation of a lot of applications
based on the memory caching backend.

As for using an external store, I think it's a great idea. However,
scriptwriters need to remember that memcache isn't meant to be
a reliable data store. So it's important that people write their scripts
with that in mind. In other words, you always check the cache for a value,
and if it isn't there, then load the cache with the value from the database.
It's got to be ok for the cache to be empty. Preloading the cache should
always be an option as well (especially for larger datastores with higher

I suppose best_match could be done in a while loop in script.. but honestly,
I think that's pretty messy. I think it would be a good addition.

Thanks for your consideration. :)

On Tue, May 26, 2009 at 10:54 AM, Bogdan-Andrei Iancu <
bogdan at voice-system.ro> wrote:

> Hi Brett,
> The idea of having "families / classes/ groups" for cached values is indeed
> a nice and useful one. I will love to have this in the next release.
> But regarding the "best_match" do you think there is any other application
> for it except the routing part?
> An idea that I would like to explore is how to use an external cache server
> (like memcached) during t restarts to avoid the penalty of going through the
> db (save and load) - like you restart opensips, but the memory content stays
> the same.
> Regards,
> Bogdan
> Brett Nemeroff wrote:
>> Hey All,
>> I just had this revelation today about a potential feature and I wanted to
>> run it by the group to see if there was any interest in it. I tried posting
>> it to the tracker, but sf.net <http://sf.net> keeps failing (I'm getting
>> server busy messages.. grumble..)
>> So I had talked before about "memcache families". This is where you can
>> store data into separate memcache namespaces. This would be useful to store
>> and purge large sets for data at one time..
>> Think for a minute about routes being loaded into memcache....
>> Say for example, if I had 10 customers. Each with their own unique route
>> table with 3 million records each. As one table, that would be 30 million
>> total routes.. Which may be slow to traverse (not sure, haven't tested).
>> However if each route table is in it's own family (ie: namespace in
>> memcache) it would only be 3 million. Which should be very fast. Also, if
>> I'm changing just one route, I wouldn't have to purge my entire memcache
>> store to update it.. just the one route table effected.. Also, I use
>> memcache to store my IP to account relationships.. so we don't need those to
>> reload either.. That's the idea of memcache families; only update the family
>> that makes sense. It would only add one additional option to the cache_store
>> and cache_fetch functions (family). And would also add a function
>> cache_family_purge, which would delete an entire family of data.
>> Now building on that idea is my next feature request (which really doesn't
>> depend on memcache families, but it makes sense to combine the two):
>> This is a request for the ability to "find_best_match" in memcache family.
>> This is a function that you'd pass a memcache family to and it would take
>> the input value (say $rU for example) and keep removing a character from it
>> until it hit a match and then return the cached value. Of course, this also
>> depends on preloaded cache values. Which I'd load from an external script
>> upon startup.
>> Function usage would be like this:
>> find_best_match("<memcache_storage_engine>","<memcache_family_name>","<value_to_search_with>",<avp_to_recieve_results>)
>> There is a *ton* that can be done with this.. My mind is spinning. :) ie:
>> return<prefix> Then use the transformations to pull the prefix out
>> and push it into the $rU.. Very powerful.. And you wouldn't even need custom
>> modules anymore for routing.
>> So if the dialed number is 5125551212 and in memcache I have: 512555 ->
>> It would hit memcache like this: if
>> (find_best_match("local","$avp(s:routetable)","$rU",$avp(s:routestring))) {
>> $rD = $(avp(s:routestring){s.select,0,_}); # rewrite destination $rU = $rU +
>> $(avp(s:routestring){s.select,1,_}); # add prefix if defined } else {
>> sl_send_reply("404","No Route"); exit; } 5125551212 -> No Match 512555121 ->
>> No Match 51255512 -> No Match 5125551 -> No Match 512555 ->
>>  Thanks for your consideration and feedback!!
>> -Brett
>> ------------------------------------------------------------------------
>> _______________________________________________
>> 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/20090526/365ef3d0/attachment-0001.htm 

More information about the Users mailing list