# &adminguide;

## Overview

This module can store and fetch SIP message content in an in-memory hash table.

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

Number of slots in the hash table. It should be power of 2.

Default value: 256.

#### `hash_size` usage

    ...
    modparam("siprepo", "hash_size", 1024)
    ...

### `expire (int)`

Number of seconds until the stored message content expires.

Default value: 180.

#### `expire` usage

    ...
    modparam("siprepo", "expire", 240)
    ...

### `timer_interval (int)`

Number of seconds to run the timer routine.

Default value: 10.

#### `timer_interval` usage

    ...
    modparam("siprepo", "timer_interval", 5)
    ...

### `timer_procs (int)`

Number of timer processes.

Default value: 1.

#### `timer_procs` usage

    ...
    modparam("siprepo", "timer_procs", 2)
    ...

## Functions

### `sr_msg_push(msgid, rmode)`

Push the message content to hash table and associate it with `msgid`. The Call-Id and msgid are needed to pull the message. The rmode is reserved for repo mode, use 0.

This function can be used from ANY_ROUTE.

#### `sr_msg_push()` usage

    ...
    request_route {
        ...
        $var(msgid) = $sruid;
        if(sr_msg_push("$var(msgid)", "0")) {
            ...
        }
        ...
    }
    ...

### `sr_msg_pull(callid, msgid, rname, rmode)`

Pull the message content and execute the route block 'rname'. If rmode is set to "1", the item of the message is removed from siprepo storage, use "0" to keep it.

This function can be used from ANY_ROUTE.

#### `sr_msg_pull()` usage

    ...
    request_route {
        ...
        if(sr_msg_pull("$var(callid)", "$var(msgid)", "REPOPULL", "1")) {
        }
        ...
    }
    ...

### `sr_msg_async_pull(callid, msgid, gname, rname, rmode)`

Pull the message content and execute the route block 'rname' via async group 'gname'. If rmode is set to "1", the item of the message is removed from siprepo storage, use "0" to keep it.

This function can be used from ANY_ROUTE.

#### `sr_msg_async_pull()` usage

    ...
    request_route {
        ...
        if(sr_msg_async_pull("$var(callid)", "$var(msgid)", "WG01", "REPOPULL", "1")) {
        }
        ...
    }
    ...

### `sr_msg_rm(callid, msgid)`

Remove the item of the message from the siprepo storage.

This function can be used from ANY_ROUTE.

#### `sr_msg_rm()` usage

    ...
    request_route {
        ...
        if(sr_msg_rm("$var(callid)", "$var(msgid)")) {
        }
        ...
    }
    ...

### `sr_msg_check()`

Check if the message is stored.

This function can be used from ANY_ROUTE.

#### `sr_msg_check()` usage

    ...
    request_route {
        ...
        if(sr_msg_check()) {
        }
        ...
    }
    ...