maxfwd Module

Bogdan-Andrei Iancu

Edited by

Bogdan-Andrei Iancu


Table of Contents
1. User's Guide
1.1. Overview
1.2. Dependencies
1.2.1. OpenSER Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
1.3.1. max_limit (integer)
1.4. Exported Functions
1.4.1. mf_process_maxfwd_header(max_value)
2. Developer's Guide
3. Frequently Asked Questions
List of Examples
1-1. Set max_limit parameter
1-2. mx_process_maxfwd_header usage

Chapter 1. User's Guide

1.1. Overview

The module implements all the operations regarding MaX-Forward header field, like adding it (if not present) or decrementing and checking the value of the existent one.


1.2. Dependencies

1.2.1. OpenSER Modules

The following modules must be loaded before this module:

  • No dependencies on other OpenSER modules.


1.2.2. External Libraries or Applications

The following libraries or applications must be installed before running OpenSER with this module loaded:

  • None.


1.3. Exported Parameters

1.3.1. max_limit (integer)

Set an upper limit for the max-forward value in the outgoing requests. If the header is present, the decremented value is not allowed to exceed this max_limits - if it does, the header value will by decreased to "max_limit".

The range of values stretches from 1 to 256, which is the maximum MAX-FORWARDS value allowed by RFC 3261.

Default value is "256".

Example 1-1. Set max_limit parameter

...
modparam("maxfwd", "max_limit", 32)
...

1.4. Exported Functions

1.4.1. mf_process_maxfwd_header(max_value)

If no Max-Forward header is present in the received request, a header will be added having the original value equal with "max_value". An OK code is returned by the function.

If a Max-Forward header is already present, its value will be decremented. If after this operation its value will be positive non-zero, an OK code will be returned. Otherwise (for a zero value) an error code will be returned. Note that an error code will be also returned if the SIP message couldn't be parsed or if the Max-Forward header's body invalid (non numerical string or negative numerical value).

Meaning of the parameters is as follows:

  • max_value - Value to be added if there is no Max-Forwards header field in the message.

This function can be used from REQUEST_ROUTE.

Example 1-2. mx_process_maxfwd_header usage

...
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
	sl_send_reply("483","Too Many Hops");
	break;
};
...

Chapter 2. Developer's Guide

The module does not provide any API to use in other OpenSER modules.


Chapter 3. Frequently Asked Questions

3.1. Where can I find more about OpenSER?
3.2. Where can I post a question about this module?
3.3. How can I report a bug?

3.1. Where can I find more about OpenSER?

Take a look at http://openser.org/.

3.2. Where can I post a question about this module?

First at all check if your question was already answered on one of our mailing lists:

E-mails regarding any stable OpenSER release should be sent to and e-mails regarding development versions should be sent to .

If you want to keep the mail private, send it to .

3.3. How can I report a bug?

Please follow the guidelines provided at: http://openser.org/bugs.