[OpenSIPS-Users] How to update table location, but directly on memory cache (RAM)?

Rodrigo Pimenta Carvalho pimenta at inatel.br
Fri Jun 10 19:07:26 CEST 2016


Hi Bogdan-Andrei.


You are right. I have been used the attr_avp, as you explained, to save a specific information in each new record for table location. It works very well and such information goes to column attr.


However, I have created today a new column for such table: column callerName. And I have to save $fn in this new column for each new record too.


So, what I have just tried today is something like this:


modparam("registrar", "attr_avp", "$avp(attr)")
modparam("registrar", "attr_avp", "$avp(callerName)")


...


is_method("REGISTER")) {
        $avp(attr) = "my_specific_information";
        $avp(callerName) = $fn;
}

...


But, in this case, the $fn overwrites the specific information, because it seems that attr_avp will pointer always to the same column Attr, no matter what the name I give to the AVP.


Do  you know how to put every information in its correct column?

Is it possble to have two attr_avps related to two different columns in table location?


Any hint will be very helpful!

Best regards.



RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979


________________________________
De: users-bounces at lists.opensips.org <users-bounces at lists.opensips.org> em nome de Bogdan-Andrei Iancu <bogdan at opensips.org>
Enviado: sexta-feira, 10 de junho de 2016 07:39
Para: OpenSIPS users mailling list
Cc: Cleide Aparecida Ribeiro do Prado; Daniel Lopes Fússia
Assunto: Re: [OpenSIPS-Users] How to update table location, but directly on memory cache (RAM)?

Hi Rodrigo,

What you try to do is not consistent.

Either you use db_mode 1 to be have immediate writting in DB from usrloc module (see http://www.opensips.org/html/docs/modules/1.11.x/usrloc.html#id294459) -> it will be safe to run your script query after the save().

Either push the extra info you want to save into DB (and memory cache) via the attr AVP (see http://www.opensips.org/html/docs/modules/1.11.x/registrar.html#id293909) and opensips will do everything for you.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 09.06.2016 17:42, Rodrigo Pimenta Carvalho wrote:


Hi.


My script has the configuration:


modparam("usrloc", "db_mode", 2)
modparam("usrloc", "timer_interval",3)

Always after receiving a new register in table location, I must to execute a code like this:


avp_db_query("UPDATE location...


That is, an update will complement data in the new register.


However, how could I immediately update table location if data might be in memory cache (RAM) for 3 seconds. It could fail obviously.

The command avp_db_query UPDATE is acting over the database on hard disc, not in obviously.

So, is there a way to update table location even still in cache (RAM)? If yes, when data from RAM is recorded into the database, the register will already be updated.


Any hint will be very helpful!


Best regards.


RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979



_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto: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/20160610/edb00f70/attachment-0001.htm>


More information about the Users mailing list