[OpenSIPS-Users] Dbtext and avp_db_query()

Bogdan-Andrei Iancu bogdan at opensips.org
Wed Feb 6 18:20:41 CET 2013


Hi Mike,

Some ideas :

1) I do not use the usr_preference like table as I do not like to do an 
extra query for the user profile - usually I put extra attrs in the 
subscriber table (as additional columns) and load them during auth (via 
load_credentials) or via avp_db_query or avp_db_load + db_schema

2) prefix the avp from caller and callee differently - after loading the 
avp, do a "move" with avp_copy().

Maybe the best think to do in the future is to make "avp_db_load" to 
take an optional prefix to use when loading the AVP, so same AVP from DB 
(like "inbound-CCL" ) would be loaded as "caller_inbound-CCL"  or 
"callee_inbound-CCL" .

Regards,

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


On 02/06/2013 11:23 AM, Michael Renzmann wrote:
> Hi.
>
>>> IIRC, avp_db_load() should work with dbtext:
>> yes, it does.
> Confirmed, we're using this combination successfully already. The reason
> why I want to also use avp_db_query() is the following:
>
> We have various attributes for every user in usr_preferences, among them
> two called "inbound_channels" and "outbound_channels" meant for limiting
> concurrent calls. We check for and apply concurrent call limitations in a
> separate route, which is called from REQUEST_ROUTE. This already works
> fine for outbound calls.
>
> Now I'm trying to implement inbound call limitations and face the
> following issue for user-to-user calls. The currently loaded AVPs describe
> various aspects (inbound_channels, outbound_channels and other stuff) of
> the caller. I need to get at least the callee's inbound_channels
> attribute. avp_load() cannot easily be used for this purpose, since it
> loads all attributes defined for the callee, overwriting those of the
> caller which are still required for call processing further down the road.
> Using avp_copy() to save/restore caller AVPs doesn't appear like a good
> idea, not only because it'd require to explicitly reference all possibly
> used attributes in the script (even those that are not necessarily set for
> each user). Throwing away all AVPs after the inbound-CCL followed by an
> avp_load() to restore the caller's attributes is an even worse idea, I
> think - it is additional database load, and it won't restore those AVPs
> which have been set dynamically during call processing before the
> CCL-route was called.
>
> With avp_db_query() it would have been possible to query the callee's
> inbound_channels attribute and store it in a differently named AVP (say,
> callee_inbound_channels). Collission avoided, all well - but unfortunately
> not possible with db_text. Switching to another database is no option at
> this point.
>
> If you have any ideas how I could solve this in a db_text-compatible way,
> I'm all ears.
>
>> The avp_db_query which used raw queries is the only one
>> not working.
> I'll try to deliver information on how to reproduce the crash.
>
> Bye, Mike
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>



More information about the Users mailing list