[OpenSER-Users] Direct (Postgres) SQL queries.

Mik Cheez michael_bulk at wildgate.com
Fri Oct 5 23:04:32 CEST 2007


Try using Perl (to query the database and set an AVP value), and AVPops 
(to modify the URI or whatever).

In your perl script (sets avp alias 39 to the value in $outuri:
	OpenSER::AVP::add(39, "$outuri");

In your openser config file:

modparam("perl", "filename", "script_name.pl") # enables perl script
avp_aliases="ouri=i:39" # define avp alias 39 (alias ouri)

route {
	..
	..
	perl_exec("script_name.pl");
	avp_pushto("$ru","$avp(ouri)"; # set your URI to ouri
}

Of course, you'll have to setup your perl script to do a meaningful 
database query.  There are some good samples in the source code to 
understand the perl scripts.

Alex Balashov wrote:
> 
> Is there a better way to talk to a database directly than to use 
> avp_db_query()?   I need to use my own schemas;  I have a platform
> that absolutely does not lend itself to storing data in the avpops'
> schema.  Luckily, avp_db_query() saved the day.  Is there anything
> even easier, or is this the definitive and methodologically correct
> way to go?
> 
> -- 
> Alex Balashov
> Evariste Systems
> Web    : http://www.evaristesys.com/
> Tel    : +1-678-954-0670
> Direct : +1-678-954-0671
> 
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
> 
> 




More information about the Users mailing list