– Kamailio SIP Server –

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

old-content:how_to_use_attribute_value_pairs_avp_s_to_determine_if_both_the_caller_and_the_callee_are_in_the_same_group [2006/01/25 01:00]
old-content:how_to_use_attribute_value_pairs_avp_s_to_determine_if_both_the_caller_and_the_callee_are_in_the_same_group [2006/01/25 01:00] (current)
Line 1: Line 1:
 +How to use Attribute Value Pairs (AVP's) to determine if both the caller and the callee are in the same group.
 +
 +A real world example would be to limit friends to only calling friends that are in the same group of friends.
 +
 +1) Create two entries in the usr_preferences table.\\
 +One entry is associated with the caller and the other is associated with the callee.\\
 +Both entries use "friend" as the attribute and "groupa" as the value.
 +
 +2) Add the following AVP alias definition:
 +
 +modparam("avpops","avp_aliases", "temp=i:59;......)
 +
 +3) Add the following code to the INVITE section of your configuration:
 +
 +avp_db_load("$from/username", "s:friend");\\
 +avp_copy("s:friend", "$temp");\\
 +avp_db_load("$ruri/username", "s:friend");\\
 +
 +# xlog("L_NOTICE", "friend avp: ($avp(s:friend))\n");\\
 +# xlog("L_NOTICE", "temp avp: ($avp(i:59))\n");\\
 +
 +if (avp_check("s:friend", "eq/$temp") ) {\\
 +xlog("L_NOTICE", "friend avp: ($avp(s:friend))\n");\\
 +xlog("L_NOTICE", "temp avp: ($avp(i:59))\n");\\
 +};\\
 +pp