# avp Module

Jiri
Kuthan
FhG Fokus
jiri@iptel.org
2004
2005
FhG FOKUS
$Revision: 1.1.2.1 $
$Date: 2005/06/22 23:16:51 $

## 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

None.

### Exported Parameters

The module exports no parameters.

### Exported Functions

#### `set_iattr(attribute,value)`

Create an AVP of type integer.

Meaning of the parameter is as follows:

- attribute - The name of of the AVP to be created.

- value - Integer value of the AVP.

##### `set_iattr` usage

    ...
    set_iattr("fr_inv_timer", "60")
    ...

#### `flags2attr()`

Store the current state of SER flags into AVP called "flags".

##### `flags2attr` usage

    ...
    flags2attr()
    ...

#### `set_sattr(attribute,value)`

Create an AVP of type string.

Meaning of the parameter is as follows:

- attribute - The name of of the AVP to be created.

- value - String value of the AVP.

##### `set_sattr` usage

    ...
    set_sattr("called_number", "1234")
    ...

#### `uri2attr(attribute)`

Store the Request-URI of the message being processed in an AVP. The new value of the Request-URI will be used if it has been already rewritten by some other function or module.

Meaning of the parameter is as follows:

- attribute - The name of of the AVP.

##### `uri2attr` usage

    ...
    uri2attr("saved_ruri")
    ...

#### `print_sattr(attribute)`

Print the value of an AVP to syslog.

Meaning of the parameter is as follows:

- attribute - The name of of the AVP.

#### `attr2uri(attribute)`

Rewrite the Request-URI of the message being processed with the value of an AVP.

Meaning of the parameter is as follows:

- attribute - The name of of the AVP.

#### `is_sattr_set(attribute)`

Test for the existence of AVP with given name. The function returns 1 if given AVP exists and 0 if not.

Meaning of the parameter is as follows:

- attribute - The name of of the AVP.

##### `is_sattr_set` usage

    ...
    if (is_sattr_set("saved_ruri")) {
      uri2attr("saved_uri");
    } else {
      rewriteuri("sip:a@iptel.org");
    };
    ...

#### `avp_exists(attribute, value)`

Test whether an AVP with given name and value exists. The functio returns 1 if the AVP with given name and value exists and 0 if not. The value of the AVP is compared string-wise. The comparison is case sensitive.

Meaning of the parameter is as follows:

- attribute - The name of of the AVP.

- value - The AVP value to look for.