# avp_db Module

Jiri
Kuthan
FhG Fokus
jiri@iptel.org
2004
2005
FhG FOKUS
$Revision: 1.1.2.2 $
$Date: 2005/06/23 11:31:25 $

## User's Guide

### Overview

This module contains several functions that can be used to manipulate the contents of AVPs (Attribute-Value pairs). The AVPs are variables attached to the SIP message being processed. Each variable has its name and value. AVPs can be used to store arbitrary data or as a means of inter-module comminication.

You may also want to check the avpops module which is more flexible and contains more functions. In future SER releases the avp module will be probably deprecated in favor of avpops module.

### Dependencies

A database module, such as mysql, postgres, or dbtext.

### Exported Parameters

#### `caller_uuid_avp` (integer)

Number of the AVP that contains the UUID of caller.

Default value is 1.

#### `callee_uuid_avp` (integer)

Number of the AVP that contains the UUID of callee.

Default value is 2.

#### `db_url` (string)

The URL of the database to be used.

Default value is "mysql://ser:heslo@localhost/ser".

#### `pref_table` (string)

Name of the user preferences table from which the contents of AVPs will be loaded.

Default value is "usr_preferences".

#### `pref_table` (string)

Name of the user preferences table from which the contents of AVPs will be loaded.

Default value is "usr_preferences".

#### `uuid_column` (string)

Name of the column that stores UUID in the preferences table.

Default value is "uuid".

#### `username_column` (string)

Name of the column containing the username of the subscriber.

Default value is "username".

#### `domain_column` (string)

Name of the column containing the domain that the subscriber belongs to. This is useful when SER is running in multi-domain mode.

Default value is "domain".

#### `attr_column` (string)

The name of the column containing attribute names.

Default value is "attribute".

#### `val_column` (string)

The name of the column containing attribute value.

Default value is "value".

#### `use_domain` (int)

This parameter controls where the module should use also the domain part, in addition to the username, as the key. This parameter should be set to 1 in multi-domain mode.

Default value is 0.

### Exported Functions

#### `avp_load(type)`

Load AVPs from the database.

Meaning of the parameters is as follows:

- type - One of:

  - caller_uuid - Load AVPs for caller identified by UUID. All AVP names will have "caller_" prefix.

  - callee_uuid - Load AVPs for callee identified by UUID. All AVP names will have "callee_" prefix.

  - caller - Load AVPs for caller based on the URI of the caller (From). All AVP names will have "caller_" prefix.

  - callee - Load AVPs for callee based on the URI of the callee (Request-URI). All AVP names will have "callee_" prefix.