# Functions

## `sl_send_reply(code, reason)`

For the current request, a reply is sent back having the given code and text reason. The reply is sent stateless, totally independent of the Transaction module and with no retransmission for the INVITE's replies.

Meaning of the parameters is as follows:

- code - Return code.

- reason - Reason phrase.

### `sl_send_reply` usage

    ...
    sl_send_reply("404", "Not found");
    ...

## `send_reply(code, reason)`

For the current request, a reply is sent back having the given code and text reason. The reply is sent stateful or stateless, depending of the TM module: if a transaction exists for the current request, then the reply is sent statefully, otherwise stateless.

Meaning of the parameters is as follows:

- code - Return code.

- reason - Reason phrase.

This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. It can be used on ONREPLY_ROUTE executed by tm module (upon a t_on_reply() callback).

### `send_reply` usage

    ...
    send_reply("404", "Not found");
    ...
    send_reply("403", "Invalid user - $fU");
    ...

## `sl_reply_error()`

Sends back an error reply describing the nature of the last internal error. Usually this function should be used after a script function that returned an error code.

### `sl_reply_error` usage

    ...
    sl_reply_error();
    ...

## `sl_forward _reply([ code, [ reason ] ])`

Forward statelessy the current received SIP reply, with the option to change the status code and reason text. The new code has to be in the same class. The received reply is forwarded as well by core when the config execution ended, unless it is dropped from config.

Meaning of the parameters is as follows:

- code - Status code.

- reason - Reason phrase.

This function can be used from ONREPLY_ROUTE.

### `send_reply` usage

    ...
    if(status=="408")
        sl_forward_reply("404", "Not found");
    ...