[Serusers] avpops

Elena Ramona Modroiu ramona at voice-system.ro
Sat Nov 6 11:56:41 CET 2004


Hi Richard,

thanks for your review. Indeed, flexibility it was one of the most 
important criteria when we decided to implement this module.  Please 
find my comments inline.

Richard wrote:

>Hi,
>
>Thanks for the great work on avpops. It is really an existing module which
>opens lots of opportunities. I read some document, just want to make sure I
>understood it correctly...
>
>. Every avp type should be saved in a different table. For example, I have
>two caller id settings for each subscriber, inter-domain and intra-domain. I
>should use one table for each setting. To load them, should I just use
>"avp_db_load" with their respective table name? Another question is, since
>the table name is optional, what happens if it is not given? When is it
>loading from?
>  
>
Dispersing the AVPs between multiple tables is not a must; you can place 
them all in the same table. But in the case you have a considerable 
number of AVPs, it should be better (from database access point of view) 
to split them (usually on type / functionality criteria) between several 
table. This is just a suggestion for a more efficient way of using the 
DB support (you gain some boost by reducing the query time by reducing 
the number of AVPs per table).
So, to load AVPs from a specific table, use "avp_db_load" with the table 
name:
    avp_db_load("$ruri","i:123/db_table");
if the table is missing (is optional) the default table will be used - 
it's a module parameter.

>. It looks like that one avp can have multiple values. For example, you can
>have avp_write("sip:addr1 at test.com", "i:2") and
>avp_write("sip:addr2 at test.com", "i:2"). So avp name i:2 has both values.
>  
>
Yes, you can have more AVPs with the same NAME/ID and different values. 
In your example you will end with a list of two AVPs with same ID.
IMPORTANT: note that the AVP core (in SER core) keeps the avp list in 
revert order (it does insert at the beginning), so last added avp will 
be the first to be used.

>. If an avp has multiple values, I can use avp_pushto() to do a parallel
>forking.
>  
>
yes, correct. But be sure you use the 'g' (global) flag. Without it, 
only the first AVP will be used.
You can do parallel forking, by pushing whole RURIs or by pushing only 
usernames (the domain part will be the same as original in all branches) 
or by pushing only domains (the username part will be the same as 
original in all branches).

>. Can I use an avp for the existing function? For example, I'd like to use
>different caller id inside "Remote-Party-ID". If I already load avp name
>i:10 with the right caller id, can I use append_hf() to add a new field with
>the avp?
>  
>
To add an AVP as header you need to use also avp_pushto() like:
    avp_pushto("Remote-Party-ID/request","i:10");
this will push into the request the header:
    Remote-Party-ID: value_of_i10_avp
Be sure you have the entire header body in the AVP.

>. In the example of Trusted IPs, what if I don't care about any username or
>domain? For example, I have a PSTN gateway shared by all domains. Should I
>put "" in uuid, username and domain columns? 
>
No - at least one of this db filed is required to be able to load an avp .

>Then what do I put in source
>for avp_db_load()? It seems that source can only take either username or
>domain or both. Maybe define a uuid value and associate all gateways with
>the same uuid.
>  
>
For loading, the AVP source can be either username or domain or both or 
uuid.
In your situation, there are two cases:
A. if all PSTN GWs are shared
    1. use a fixed "uuid" to load them; for the moment avp_db_load 
accepts for uuid only an avp alias containing the uuid. So do:
    define as "avp_aliases=gw_uuid=i:4" and do
    avp_write("some_uuid","$gw_uuid");
    avp_db_load("$gw_uuid",".....");

B. if you have some PSTN GWs shared and some per domain:
    1. use "domain" as source and put the shared GWs for all domains.
    2. use to AVP types - for shared and for per domain GW; use a double 
load, for shared and per domain avps - for shared ones, put in DB only 
the uuuid field and for per domain ones put only the domain:
    define as "avp_aliases=gw_uuid=i:4" and do
    avp_write("some_uuid","$gw_uuid");
    # load shared GW to AVP i:10
    avp_db_load("$gw_uuid","i:10");
    #load per domain GW also to AVP i:10
    avp_db_load("$ruri/domain","i:10");
    So, you will have in AVPs i:10 both the shared and per domain GW.

Hope this helps,
Ramona

>Thanks again for the great work,
>
>Richard
>
>
>_______________________________________________
>Serusers mailing list
>serusers at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serusers
>  
>




More information about the sr-users mailing list