# &adminguide;

## Overview

This module provides reimplementation of a few very old functions that used to be in the core and supported only static string or integer parameters. The new versions bring support for dynamic parameters (allowing variables inside the parameters).

There are also brand new features, related to core internals, but controlled from configuration file or via control interfaces.

Contributions to this module must be done under the BSD license, to follow the requirements of the core contributions.

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

### `alias_subdomains` (string)

Register a domain and all its sub-domains to match the myself condition. It can be set many times. Its full format is: 'proto:domain:port', allowing to set restrictions on protocol and port as well. Protocol and port are optional.

Default value is NULL.

#### Set `alias_subdomains` parameter

    ...
    modparam("corex", "alias_subdomains", "kamailio.org")
    modparam("corex", "alias_subdomains", "udp:sip-router.org:5060")
    ...

## Functions

### `append_branch([ uri, [ q ] ])`

Append a new branch to the destination set, useful to build the set of destination addresses for parallel forking or redirect replies.

Both parameters are optional, If no uri parameter is provided, then the address from request URI (r-uri) is used to build the new branch.

Meaning of the parameters is as follows:

- uri - SIP address of the branch to be used as R-URI in the outgoing request.

- q - the Q value to set the priority of the branch based on Contact address specifications

This function can be used from REQUEST_ROUTE or FAILURE_ROUTE.

#### `append_branch` usage

    ...
        append_branch();
        append_branch("$avp(uri)", "0.5");
    ...

### `send([ host [ :port ] ])`

Send the original SIP message to a specific destination in stateless mode. No changes are applied to received message, no Via header is added. Host can be an IP address or hostname. Port is optional and defaults to 5060. Used protocol: UDP.

The parameter is optional and defaults to the destination URI from the SIP message if left out. Otherwise it's a string parameter (supporting pseudo-variables) in format "hostname" or "hostname:port", where hostname" can also be a numeric IP address.

This function can be used from REQUEST_ROUTE or FAILURE_ROUTE.

#### `send` usage

    ...
    	send();
    	send("10.20.15.10");
    	send("sip.example.com:5070");
    	send("$var(res)");
    ...

### `send_tcp([ host [ :port ] ])`

This function is identical to send() described above, except that it sends the SIP message using the TCP protocol instead of UDP.

## RPC Commands

### `corex.list_sockets`

Print the list of sockets the application is listening on.

Example:

    		&sercmd; corex.list_sockets

### `corex.list_aliases`

Print the list of hostname aliases used to match the myself condition.

Example:

    		&sercmd; corex.list_aliases