# &adminguide;

## Overview

This module performs destinations monitoring either for itself, or on the behalf of other modules. The monitoring is done by sending SIP OPTIONS requests, more or less in the same fashion as the dispatcher module (which was the initial source for this module).

As an example of usage by other modules, see drouting, which was enhanced to use this module to monitor its gateways.

## Dependencies

### &kamailio; Modules

The following modules must be loaded before this module:

- tm - Transaction module

### External Libraries or Applications

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

- none

### Parameters

#### `ping_interval` (integer)

Define the interval (in seconds) ping requests are sent to destinations

Default value is 30 seconds.

##### Set `ping_interval` parameter

    ...
    modparam("keepalive", "ping_interval", 10)
    ...

#### `destination` (string)

Allows to statically define destinations you want to monitor

##### Set `destination` parameter

    ...
    modparam("keepalive", "destination", "192.168.10.20")
    modparam("keepalive", "destination", "sip.provider.com")
    ...

### Functions

#### `is_alive(destination)`

Get destination status.

The Parameter destination is destination you want to check status

Returned value:

- 1 if destination is up
- 2 if destination is down
- -1 on error

This function can be used from ANY_ROUTE.

##### `is_alive()` usage

    ...
    if(is_alive("192.168.10.20") == 1) {
      // do stuff
    };
    ...