[OpenSIPS-Users] Dbtext and avp_db_query()

Michael Renzmann mrenzmann at otaku42.de
Wed Feb 6 10:23:16 CET 2013


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



More information about the Users mailing list