# &adminguide;

## Overview

This module serves as a storage engine for PCSCF contacts, much like the standard Kamailio module, usrloc, is a storage engine for standard SIP contacts. The concept of a contact in IMS, PCSCF specifically, is very different to that of std. SIP and as a result we have built this new module. A lot of the design has been borrowed from the std. usrloc module. For example. An IMS contact, in PCSCF, needs things like:

- Diameter Rx session for signalling bearer status. i.e. this is effectively QoS from the network to make sure the signalling link can be 'trusted'

- IPSEC Security Association for secure signalling between UE and PCSCF (first point of contact)

- IMPU, each contact can have a number of associated public identities (IMPU).

## Dependencies

### &kamailio; Modules

The following modules must be loaded before this module:

- None.

### External Libraries or Applications

The following libraries or applications must be installed before running &kamailio; with this module loaded:

- None.

## Parameters

### hash_size (int)

The number of entries of the hash table used by to store the contact records is 2^hash_size. For hash_size=4, the number of entries of the hash table is 16.

Default value is 9.

#### Set `hash_size` parameter

    ...
    modparam("ims_usrloc_pcscf", "hash_size", 10)
    ...

### timer_interval (int)

Number of seconds between two timer runs. The module uses timer to delete expired contacts.

Default value is 60.

#### Set timer_interval parameter

    ...
    modparam("ims_usrloc_pcscf", "timer_interval", 30)
    ...

### `db_url` (string)

Database URL.

Default value is "&defaultdb;".

#### Set db_url parameter

    ...
    modparam("ims_usrloc_pcscf", "db_url", "&exampledb;")
    ...

### db_mode (int)

This is the database mode to be used for the PCSCF usrloc data persistent storage. Currently this module supports the Write-Through scheme only.

- 0 - This disables DB mode. Only memory will be used for usrloc and data will not survive a restart.

- 1 - Write-Through Scheme. All changes to usrloc are immediately reflected in the database. This is slow but very reliable. This mode will ensure that no registration data is lost as a result of a restart or crash.

- 3 - DB_ONLY Scheme. All changes to usrloc are immediately reflected in the database and additionally PCSCF usrloc data are downloaded from db and inserted into PCSCF usrloc cache if required - i.e. If contact data cannot be found in cache a db query for the contact is done in table location and when contact is found there its respective data are inserted in PCSCF usrloc cache. Also an audit had been added for removal of long expired PCSCF usrloc data in table location. This mode will ensure that no registration data is lost as a result of a restart or crash.

Default value is 0.

#### Set db_mode parameter

    ...
    modparam("ims_usrloc_pcscf", "db_mode", 1)
    ...

### match_contact_host_port (int)

If set to 1 (default), the contact is matched using only host and port in the contact URI.

- 0 - When matching contact do full contact match procedure.

- 1 - When matching contact compare only host and port of the contact URI.

Default value is 1.

#### Set match_contact_host_port parameter

    ...
    modparam("ims_usrloc_pcscf", "match_contact_host_port", 0)
    ...

### expires_grace (int)

Specify a grace time for keeping the contacts until they are finally deleted. The value of the parameter is defined in seconds.

Default value is 3600.

#### Set expires_grace parameter

    ...
    modparam("ims_usrloc_pcscf", "expires_grace", 1800)
    ...

### audit_expired_pcontacts_interval (int)

Number of seconds between two audit runs. Note: audit is used for db_mode DB_ONLY (3) only. The module uses this audit to delete expired contacts found in db table location which are expired at least as the audit_expired_pcontacts_timeout value. Such expired contacts in location may appear when these contacts are not present in usrloc cache because PCSCF crashed before contact expiry.

Default value is 60.

#### Set audit_expired_pcontacts_interval parameter

    ...
    modparam("ims_usrloc_pcscf", "audit_expired_pcontacts_interval", 120)
    ...

### audit_expired_pcontacts_timeout (int)

Number of seconds the contacts must be already expired before the audit starts working on them. It is recommended to set only values greater than the Default value 40. The module uses this audit to delete expired contacts found in db table location which are expired at least as many seconds as the sum of this timeout parameter value plus the value of the expires_grace parameter.

Default value is 40.

#### Set audit_expired_pcontacts_timeout parameter

    ...
    modparam("ims_usrloc_pcscf", "audit_expired_pcontacts_timeout", 120)
    ...

## RPC Commands

exported RPC commands.

### ulpcscf.status

Status of pcscf_usrloc, AORs, max slots, etc.

## Statistics

Exported statistics are listed in the next sections.

### registered contacts

Number of AOR contacts in registered state - cannot be reset.

### impus

Number of IMPUs - cannot be reset.

### expired contacts

Number of expired contacts - can be reset.