# &adminguide;

## Overview

The module adds user location (usrloc) records replication between multiple servers via DMQ module.

## Dependencies

### &kamailio; Modules

The following modules must be loaded before this module:

- DMQ module..

- USRLOC module..

## Parameters

### `enable` (int)

The parameter controls whether the replication is active or not. The value can be:

- 0 - replication is disabled

- 1 - replication is enabled

Default value is 0.

#### Set `enable` parameter

    ...
    modparam("dmq_usrloc", "enable", 1)
    ...

### `sync` (int)

The parameter controls whether to request synchronization of all usrloc records at startup. The value can be:

- 0 - disabled

- 1 - enabled

Default value is 1.

#### Set `sync` parameter

    ...
    modparam("dmq_usrloc", "sync", 0)
    ...

### `batch_size` (int)

The parameter controls whether to throttle synchronization of all contacts in batches. Once a batch of SIP requests is sent out, then sleep for 'batch_usleep' microseconds. The value can be:

- <=0 - disabled (no batching)

- >0 - how many records to be sent in a batch

Default value is 0.

#### Set `batch_size` parameter

    ...
    modparam("dmq_usrloc", "batch_size", 4000)
    ...

### `batch_usleep` (int)

The parameter controls whether to throttle synchronization of all contacts in batches. Once a batch of SIP requests is sent out, then sleep for 'batch_usleep' microseconds. The value can be:

- <=0 - no sleep (it disables the batching)

- >0 - how many microseconds to sleep before sending out another batch of usrloc records.

Default value is 0.

#### Set `batch_usleep` parameter

    ...
    modparam("dmq_usrloc", "batch_usleep", 1000)
    ...

### `batch_msg_size` (int)

The parameter controls the size of the messages during a sync. This is to make sure the messages are never larger than 65536 (the maximum datagram size).

Note that batch_msg_contacts will also be checked.

Default value is 60000. Maximum value is 60000.

#### Set `batch_msg_size` parameter

    ...
    modparam("dmq_usrloc", "batch_msg_contacts", 50)  # 50 contacts / message
    modparam("dmq_usrloc", "batch_msg_size", 500000)
    # with this config, when doing a full sync, each message will be sent a soon as the body is larger 50K or contains 50 contacts
    ...

### `batch_msg_contacts` (int)

The parameter controls the amount of contact per message/transaction during a sync.

Note that batch_msg_size will also be checked.

Default value is 1. Maximum value is 150.

#### Set `batch_msg_contacts` parameter

    ...
    modparam("dmq_usrloc", "batch_msg_contacts", 50)  # 50 contacts / message
    modparam("dmq_usrloc", "batch_size", 10000)       # 10000 contacts / batch
    modparam("dmq_usrloc", "batch_usleep", 500000)    # one batch every 500ms
    # syncing 20K contacts/second with 50 contacts/message
    ...

### `usrloc_domain` (string)

The usrloc domain to synchronize.

Default value is location.

#### Set `usrloc_domain` parameter

    ...
    modparam("dmq_usrloc", "usrloc_domain", "my_domain")
    ...

### `replicate_socket_info` (int)

The parameter controls whether the socket replication is active or not. This is important for anycast scenarios. The value can be:

- 0 - disabled

- 1 - enabled, replicate socket by proto:host:port

- 2 - enabled, replicate socket by socket name

- 3 - enabled, use local socket from dmq server_socket modparam

Default value is 0.

#### Set `replicate_socket_info` parameter

    ...
    modparam("dmq_usrloc", "replicate_socket_info", 1)
    ...

### `replicate_cflags` (int)

The parameter controls whether the cflags replication is active or not. This is important for anycast scenarios. The value can be:

- 0 - disabled

- 1 - enabled, replicate cflags

- > 1 - enabled, set cflags corresponding to this value, on replicated peers

Default value is 1.

#### Set `replicate_cflags` parameter

    ...
    modparam("dmq_usrloc", "replicate_cflags", 97) # will set cflags corresponding to 1 + 32 + 64
    ...

### `usrloc_delete` (int)

Enable (1) or disable (0) synchronizing usrloc delete actions. Disabling delete actions can be useful when user location data is ephemeral.

Default value is 1.

#### Set `usrloc_delete` parameter

    ...
    modparam("dmq_usrloc", "usrloc_delete", 0)
    ...

### `usrloc_delete_expired` (int)

Enable (1) or disable (0) synchronizing usrloc expire actions using delete actions. In other words, sync delete of (UL_CONTACT_EXPIRE) expired contacts.

Default value is 0.

#### Set `usrloc_delete_expired` parameter

    ...
    modparam("dmq_usrloc", "usrloc_delete_expired", 1)
    ...