# Parameters

## `fr_timer` (integer)

This timer is used for all SIP requests. It hits if no reply for an request INVITE request or other request has been received within (F in milliseconds). If a provisional reply is received for an INVITE (any 1xx), then the fr_inv_timer will be used instead. And if no replies (at all) for an INVITE are received before fr_timer hits, the transaction is terminated with a 408 in failure route.

Default value is 30000 ms (30 seconds).

See also: `t_set_fr()`, `max_noninv_lifetime`.

### Set `fr_timer` parameter

    ...
    modparam("tm", "fr_timer", 10000)
    ...

## `fr_inv_timer` (integer)

Timer which hits if no final reply for an INVITE arrives after a provisional message was received (in milliseconds).

Note: This timer can be restarted when a provisional response is received. For more details see `restart_fr_on_each_reply`.

Default value is 120000 ms (120 seconds).

See also: `t_set_fr()`, `max_inv_lifetime`.

### Set `fr_inv_timer` parameter

    ...
    modparam("tm", "fr_inv_timer", 180000)
    ...

## `max_inv_lifetime` (integer)

Maximum time an INVITE transaction is allowed to be active (in milliseconds). After this interval has passed from the transaction creation, the transaction will be either moved into the wait state or in the final response retransmission state, irrespective of the transaction `fr_inv_timer` and `fr_timer` values.

An INVITE transaction will be kept in memory for maximum: `max_inv_lifetime`+`fr_timer`(from the ACK to the final reply wait)+`wt_timer`.

The main difference between this timer and `fr_inv_timer` is that the `fr_inv_timer` is per branch, while `max_inv_lifetime` is per the whole transaction. Even on a per branch basis `fr_inv_timer` could be restarted. For example, by default if `restart_fr_on_each_reply` is not cleared, the `fr_inv_timer` will be restarted for each received provisional reply. Even if `restart_fr_on_each_reply` is not set the `fr_inv_timer` will still be restarted for each increasing reply (e.g. 180, 181, 182, ...). Another example when a transaction can live substantially more than its `fr_inv_timer` and where `max_inv_lifetime` will help is when DNS failover is used (each failed DNS destination can introduce a new branch).

The default value is 180000 ms (180 seconds - the rfc3261 timer C value).

See also: `max_noninv_lifetime`, `t_set_max_lifetime()` (allows changing `max_inv_lifetime` on a per transaction basis), `t_reset_max_lifetime` `fr_timer`, `wt_timer`, `restart_fr_on_each_reply`.

### Set `max_inv_lifetime` parameter

    ...
    modparam("tm", "max_inv_lifetime", 150000)
    ...

## `max_noninv_lifetime` (integer)

Maximum time a non-INVITE transaction is allowed to be active (in milliseconds). After this interval has passed from the transaction creation, the transaction will be either moved into the wait state or in the final response retransmission state, irrespective of the transaction `fr_timer` value. It's the same as `max_inv_lifetime`, but for non-INVITEs.

A non-INVITE transaction will be kept in memory for a maximum of: `max_noninv_lifetime`+`wt_timer`.

The main difference between this timer and `fr_timer` is that the `fr_timer` is per branch, while `max_noninv_lifetime` is per the whole transaction. An example when a transaction can live substantially more than its `fr_timer` and where `max_noninv_lifetime` will help is when DNS failover is used (each failed DNS SRV destination can introduce a new branch).

The default value is 32000 ms (32 seconds - the RFC3261 timer F value).

See also: `max_inv_lifetime`, `t_set_max_lifetime()` (allows changing `max_noninv_lifetime` on a per transaction basis), `t_reset_max_lifetime` `fr_timer`, `wt_timer`.

### Set `max_noninv_lifetime` parameter

    ...
    modparam("tm", "max_noninv_lifetime", 30000)
    ...

## `wt_timer` (integer)

Time for which a transaction stays in memory to absorb delayed messages after it completed (in milliseconds); also, when this timer hits, retransmission of local CANCEL requests is stopped (a puristic but complex behavior would be not to enter wait state until local branches are finished by a final reply or FR timer--we simplified).

Default value is 5000 ms (5 seconds).

### Set `wt_timer` parameter

    ...
    modparam("tm", "wt_timer", 1000)
    ...

## `retr_timer1` (integer)

Initial retransmission period (in milliseconds).

Default value is 500 milliseconds.

### Set `retr_timer1` parameter

    ...
    modparam("tm", "retr_timer1", 1000)
    ...

## `retr_timer2` (integer)

Maximum retransmission period (in milliseconds). The retransmission interval starts with `retr_timer1` and increases until it reaches this value. After this it stays constant at `retr_timer2`.

Default value is 4000 milliseconds.

### Set `retr_timer2` parameter

    ...
    modparam("tm", "retr_timer2", 2000)
    ...

## `noisy_ctimer` (integer)

If set, INVITE transactions that time-out (FR INV timer) will be always replied. If it's not set, the transaction has only one branch and no response was ever received on this branch, it will be silently dropped (no 408 reply will be generated) This behavior is overridden if a request is forked, the transaction has a failure route or callback, or some functionality explicitly turned it on for a transaction (like the ACC module does to avoid unaccounted transactions due to expired timer). Turn this off only if you know the client UACs will timeout and their timeout interval for INVITEs is lower or equal than tm's `fr_inv_timer`.

Default value is 1 (on).

### Set `noisy_ctimer` parameter

    ...
    modparam("tm", "noisy_ctimer", 1)
    ...

## `restart_fr_on_each_reply` (integer)

If set (default), the `fr_inv_timer` for an INVITE transaction will be restarted for each provisional reply received (rfc3261 mandated behaviour). If not set, the `fr_inv_timer` will be restarted only for the first provisional replies and for increasing replies greater or equal 180 (e.g. 180, 181, 182, 185, ...).

Setting it to 0 is especially useful when dealing with bad UAs that continuously retransmit 180s, not allowing the transaction to timeout (and thus making impossible the implementation of certain services, like automatic voicemail after x seconds).

Default value is 1 (on).

See also: `fr_inv_timer`, `max_inv_lifetime`.

### Set `restart_fr_on_each_reply` parameter

    ...
    modparam("tm", "restart_fr_on_each_reply", 0)
    ...

## `auto_inv_100` (integer)

If set (default) tm will automatically send a 100 reply to INVITEs.

Setting it to 0 can be used to enable first running some tests or pre-processing on the INVITE and only if some conditions are met manually send a 100 (using `t_reply()`). Note however that in this case all the 100s have to be sent "by hand". `t_set_auto_inv_100()` might help to selectively turn off this feature only for some specific transactions.

Default value is 1 (on).

See also: `t_set_auto_inv_100()` `auto_inv_100_reason`.

### Set `auto_inv_100` parameter

    ...
    modparam("tm", "auto_inv_100", 0)
    ...

## `auto_inv_100_reason` (string)

Set reason text of the automatically sent 100 to an INVITE.

Default value is "trying -- your call is important to us".

See also: `auto_inv_100`.

### Set `auto_inv_100_reason` parameter

    ...
    modparam("tm", "auto_inv_100_reason", "Trying")
    ...

## `unix_tx_timeout` (integer)

Unix socket transmission timeout, in milliseconds.

If UNIX sockets are used (e.g.: to communicate with sems) and sending a message on a UNIX socket takes longer than `unix_tx_timeout`, the send will fail.

The default value is 500 milliseconds.

### Set `unix_tx_timeout` parameter

    ...
    modparam("tm", "unix_tx_timeout", 250)
    ...

## `aggregate_challenges` (integer)

If set (default), the final response is a 401 or a 407 and more than one branch received a 401 or 407, then all the WWW-Authenticate and Proxy-Authenticate headers from all the 401 and 407 replies will be aggregated in a new final response. If only one branch received the winning 401 or 407 then this reply will be forwarded (no new one will be built).

If disabled (set to 0) only the first 401, or if no 401 was received the first 407, will be forwarded (no header aggregation).

Default value is 1 (required by RFC 3261).

### Set `aggregate_challenges` parameter

    ...
    modparam("tm", "aggregate_challenges", 0)
    ...

## `reparse_invite` (integer)

If set (default), the CANCEL and negative ACK requests are constructed from the INVITE message which was sent out instead of building them from the received request. The disadvantage is that the outgoing INVITE has to be partially re-parsed, the advantage is that the CANCEL/ACK is always RFC 3261-compliant, it always contains the same route-set as the INVITE message. Do not disable the INVITE re-parsing for example in the following cases:

- The INVITE contains a preloaded route-set, and &kamailio; forwards the message to the next hop according to the "Route" header. The "Route" header is not removed in the CANCEL without `reparse_invite`=1.

- &kamailio; record-routes, thus an in-dialog INVITE contains a "Route" header which is removed during loose routing. If the in-dialog INVITE is rejected, the negative ACK still contains the "Route" header without `reparse_invite`=1.

Default value is 1.

### Set `reparse_invite` parameter

    ...
    modparam("tm", "reparse_invite", 0)
    ...

## `ac_extra_hdrs` (string)

Header fields prefixed by this parameter value are included in the CANCEL and negative ACK messages if they were present in the outgoing INVITE.

Note, that the parameter value effects only those headers which are not covered by RFC 3261 (which are neither mandatory nor prohibited in CANCEL and ACK), and the parameter can be used only together with `reparse_invite`=1.

Default value is "".

### Set `ac_extra_hdrs` parameter

    ...
    modparam("tm", "ac_extra_hdrs", "myfavoriteheaders-")
    ...

## `blst_503` (integer)

If set and the &kamailio; blocklist support is enabled, every 503 reply source is added to the blocklist. The initial blocklist timeout (or ttl) depends on the presence of a "Retry-After" header in the reply and the values of the following tm parameters: `blst_503_def_timeout`, `blst_503_min_timeout` and `blst_503_max_timeout`.

WARNING:blindly allowing 503 blocklisting could be very easily exploited for DOS attacks in most network setups.

The default value is 0 (disabled due to the reasons above).

### Set `blst_503` parameter

    ...
    modparam("tm", "blst_503", 1)
    ...

## `blst_503_def_timeout` (integer)

Blocklist interval in seconds for a 503 reply with no "Retry-After" header. See also `blst_503`, `blst_503_min_timeout` and `blst_503_max_timeout`.

The default value is 0, which means that if no "Retry-After" header is present, the 503 reply source will not be blocklisted (RFC 3261 conformant behaviour).

### Set `blst_503_def_timeout` parameter

    ...
    modparam("tm", "blst_503_def_timeout", 120)
    ...

## `blst_503_min_timeout` (integer)

Minimum blocklist interval in seconds for a 503 reply with a "Retry-After" header. It will be used if the "Retry-After" value is smaller than this value.

See also `blst_503`, `blst_503_def_timeout` and `blst_503_max_timeout`.

The default value is 0

### Set `blst_503_min_timeout` parameter

    ...
    modparam("tm", "blst_503_min_timeout", 30)
    ...

## `blst_503_max_timeout` (integer)

Maximum blocklist interval in seconds for a 503 reply with a "Retry-After header". It will be used if the "Retry-After" value is greater than this limit.

See also `blst_503`, `blst_503_def_timeout` and `blst_503_min_timeout`.

The default value is 3600

### Set `blst_503_max_timeout` parameter

    ...
    modparam("tm", "blst_503_max_timeout", 604800)
    ...

## `blst_methods_add` (unsigned integer)

Bitmap of method types that trigger blocklisting on transaction timeouts. (This setting has no effect on blocklisting because of send failures.)

The following values are associated to the request methods: INVITE=1, CANCEL=2, ACK=4 (not retransmitted, thus, never times-out), BYE=8, INFO=16, REGISTER=32, SUBSCRIBE=64, NOTIFY=126, OTHER=256 (all the unknown types). Check parser/msg_parser.h for farther details.

Change the value carefully, because requests that don't get a provisional response (everything but INVITE) can easily cause the next hop to be inserted into the blocklist by mistake. For example the next hop is a proxy, it is alive, but waiting for the response of the UAS, and has higher fr_timer value.

The default value is 1, only INVITEs trigger blocklisting

### Set `blst_methods_add` parameter

    ...
    # INVITEs and REGISTERs trigger blocklisting
    modparam("tm", "blst_methods_add", 33)
    ...

## `blst_methods_lookup` (unsigned integer)

Bitmap of method types that are looked-up in the blocklist before being forwarded statefully. See also `blst_methods_add`

The default value is 4294967287, every method type except BYE. (We try to deliver BYEs no matter what)

### Set `blst_methods_lookup` parameter

    ...
    # lookup only INVITEs
    modparam("tm", "blst_methods_lookup", 1)
    ...

## `cancel_b_method` (integer)

Method used when attempting to CANCEL an unreplied transaction branch (a branch where no response was received). The possible values are 0, 1, and 2.

- 0 will immediately stop the request (INVITE) retransmission on the branch and it will behave as if the branch was immediately replied with a 487 (a fake internal 487 reply). The advantage is the unreplied branches will be terminated immediately. However it introduces a race risk with a possible slightly delayed 2xx reply. In this case we could have an UA receiving a 2xx after a 487. Moreover this risk is greatly amplified by packet loss (e.g. if an 180 is lost the branch will look as unreplied and a CANCEL will silently drop the branch, but a 2xx can still come at a later time). This is the behaviour for SER versions older than 2.1.

- 1 will keep retransmitting the request on unreplied branches. If a provisional answer is received a CANCEL will be immediately sent back (attempting to quickly trigger a 487). This approach is race free and avoids the 2xx after 487 problem, but it's more resource intensive: faced with a branch towards and UA that doesn't answer, a CANCEL attempt will keep the transaction alive for the whole timeout interval (`fr_timer`).

- 2 will send and retransmit CANCEL even on unreplied branches, stopping the request retransmissions. This has the same advantages as 1 and also avoids the extra roundtrip in the case of the provisional reply, but it's not RFC 3261 conforming (the RFC allows sending CANCELs only on pending branches).

The default value is 1.

### Set `cancel_b_method` parameter

    ...
    modparam("tm", "cancel_b_method", 1)
    ...

## `reparse_on_dns_failover` (integer)

If set to 1, the SIP message after a DNS failover is constructed from the outgoing message buffer of the failed branch instead of from the received request.

It must be set if multiple branches are installed, the SIP message is modified differently in them, and at least one of them can result in DNS failover. If the parameter is not set the per-branch modifications are lost after the failover.

Note: If the parameter is set, branch route block and TMCB_REQUEST_FWDED callback are not called in case of the failover.

Disadvantage: only the via header is replaced in the message buffer, so the outgoing socket address is not corrected in any other part of the message. It is dangerous on multihomed hosts: when the new SIP request after the DNS failover is sent via different interface than the first request, the message can contain incorrect IP address in the Record-Route header.

Default value is 1.

### Set `reparse_on_dns_failover` parameter

    ...
    modparam("tm", "reparse_on_dns_failover", 0)
    ...

## `on_sl_reply` (string)

Sets reply route block, to which control is passed when a reply is received that has no associated transaction. The reply is passed to the core for stateless forwarding after the route block execution unless drop is executed (or it returns 0).

If KEMI is used, the parameter has to be the KEMI function name, which receives a string parameter with the event name, respectively "on_sl_reply".

### Set `on_sl_reply` parameter

    ...
    modparam("tm", "on_sl_reply", "stateless_replies")
    ...

    onreply_route["stateless_replies"] {
    	# do not allow stateless replies to be forwarded
    	return 0;
    }

### Set `on_sl_reply` parameter (KEMI javascript)

    ...
    modparam("tm", "on_sl_reply", "ksr_slreply")
    ...
    -- event callback function implemented in javascript
    function ksr_slreply(evname) {
    	# the evname is set to "on_sl_reply"
    	# do not allow stateless replies to be forwarded
    	KSR.x.drop();
    }

## `contacts_avp` (string)

This is the name of an XAVP that the `t_load_contacts()` function uses to store contacts of the destination set and that `t_next_contacts()` function uses to restore those contacts.

Default value is "NULL" (t_load_contacts()/t_next_contacts() functions are disabled).

### Set `contacts_avp` parameter

    ...
    modparam("tm", "contacts_avp", "tm_contacts")
    ...

## `contact_flows_avp` (string)

This is the name of an XAVP that the `t_next_contacts()` function uses to store contacts (if any) that it skipped, because they contained same +sip.instance value than some other contact, and that `t_next_contact_flows()` function uses to restore those contacts.

Default value is "NULL". This parameter MUST be set if variable contacts_avp is set.

### Set `contact_flows_avp` parameter

    ...
    modparam("tm", "contact_flows_avp", "tm_contact_flows")
    ...

## `fr_timer_avp` (string)

The value of fr_timer timer can be overridden on per-transaction basis. The administrator can provide a value to be used for a particular transaction in an AVP. This parameter contains the name of the AVP that will be checked. If the AVP exists then its value will be used for the fr_timer timer, effectively overriding the value configured in `fr_timer` parameter for the current transaction.

The value of the AVP is expected to be expressed in seconds and not milliseconds (unlike the rest of the timers).

This parameter is kept for backwards compatibility (hence its value expressed in seconds instead of milliseconds and its arcane way of specifying the avps). The recommended replacement is using `t_set_fr()` on a per transaction basis.

See also: `t_set_fr()`, `fr_timer`.

In Kamailio compatibility mode (defined by #!KAMAILIO, which is default), the value of the parameter must be the name of an AVP in pseudo-variable format: $avp(name). In SER compatibility mode (defined by #!SER) it must be just AVP name.

### Set `fr_timer_avp` parameter

    ...
    # default Kamailio compatibility mode
    modparam("tm", "fr_timer_avp", "$avp(frtimer)")
    # old SER compatibility mode
    modparam("tm", "fr_timer_avp", "frtimer")
    ...

## `fr_inv_timer_avp` (string)

The value of fr_inv_timer timer can be overridden on per-transaction basis. The administrator can provide a value to be used for a particular transaction in an AVP. This parameter contains the name of the AVP that will be checked. If the AVP exists, is non-empty and non-zero then its value will be used for the fr_inv_timer timer, effectively overriding the value configured in `fr_inv_timer` parameter for the current transaction.

The value of the AVP is expected to be expressed in seconds and not milliseconds (unlike the rest of the timers).

This parameter is kept for backwards compatibility (hence its value expressed in seconds instead of milliseconds and its arcane way of specifying the avps). The recommended replacement is using `t_set_fr()` on a per transaction basis.

See also: `t_set_fr()`, `fr_inv_timer`.

In Kamailio compatibility mode (defined by #!KAMAILIO, which is default), the value of the parameter must be the name of an AVP in pseudo-variable format: $avp(name). In SER compatibility mode (defined by #!SER) it must by just AVP name.

### Set `fr_inv_timer_avp` parameter

    ...
    # Kamailio compatibility mode
    modparam("tm", "fr_inv_timer_avp", "$avp(my_fr_inv_timer)")
    # old SER compatibility mode
    modparam("tm", "fr_inv_timer_avp", "my_fr_inv_timer")
    ...

## `unmatched_cancel` (integer)

This parameter selects between forwarding CANCELs that do not match any transaction statefully (0, default value), statelessly (1) or dropping them (2). Note that the stateful forwarding has an additional hidden advantage: the tm module will be able to recognize INVITEs that arrive after their CANCEL. Note also that this feature could be used to try a memory exhaustion DOS attack against a proxy that authenticates all requests, by continuously flooding the victim with CANCELs to random destinations (since the CANCEL cannot be authenticated, each received bogus CANCEL will create a new transaction that will live by default 30s).

Default value is 0.

### Set `unmatched_cancel` parameter

    ...
    modparam("tm", "unmatched_cancel", 2)
    ...

## `ruri_matching` (integer)

If set the TM module will try to match the request URI when doing SIP 1.0 (pre-RFC 3261) transaction matching (the "Via" header branch parameter does not contain the 3261 cookie).

The only reason to have it not set is for interoperability with old, broken implementations.

Default value is 1 (on).

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm ruri_matching 0

### Set `ruri_matching` parameter

    ...
    modparam("tm", "ruri_matching", 1)
    ...

## `via1_matching` (integer)

If set the TM module will try to match the topmost "Via" header when doing SIP 1.0 (pre-RFC 3261) transaction matching (the "Via" header branch parameter does not contain the 3261 cookie).

The only reason to have it not set is for interoperability with old, broken implementations.

Default value is 1 (on).

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm via1_matching 0

### Set `via1_matching` parameter

    ...
    modparam("tm", "via1_matching", 1)
    ...

## `callid_matching` (integer)

If set the TM module will try to match the callid when doing transaction matching.

Turn on if you don't want replies/requests from broken clients who send a mangled Call-ID to match the transaction. For example when the other side won't recognise the response anyway because of a changed Call-ID, this setting will prevent accounting records to be created or failure_route to be skipped.

Default value is 0 (off).

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm callid_matching 0

### Set `callid_matching` parameter

    ...
    modparam("tm", "callid_matching", 1)
    ...

## `callid_cseq_matching` (int)

If set to something other than 0, will do transaction matching using callid and cseq header values instead of via branch md5 value.

Note that this behavior is non-RFC conpliant!

Default value is 0.

### Set `callid_cseq_matching` parameter

    ...
    modparam("tm", "callid_cseq_matching", 0)
    ...

    kamctl rpc cfg.set_now_int tm callid_cseq_matching 1

## `pass_provisional_replies` (integer)

If set, TMCB_LOCAL_RESPONSE_OUT tm registered callbacks will be called also for provisional replies.

Default value is 0 (off).

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm pass_provisional_replies 1

### Set `pass_provisional_replies` parameter

    ...
    modparam("tm", "pass_provisional_replies", 1)
    ...

## `default_code` (integer)

Default response code sent by `t_reply()` if it cannot retrieve its parameters (e.g. inexistent avp). Valid values are between 400 and 699.

Default value is 500.

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm default_code 505

### Set `default_code` parameter

    ...
    modparam("tm", "default_code", 501)
    ...

## `default_reason` (string)

Default SIP reason phrase sent by `t_reply()` if it cannot retrieve its parameters (e.g. inexistent avp).

Default value is "Server Internal Error".

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_string tm default_reason "Unknown error"

### Set `default_reason` parameter

    ...
    modparam("tm", "default_reason", "Unknown reason")
    ...

## `disable_6xx_block` (integer)

If set the TM module will treat all the 6xx replies like normal replies (warning: this would be non-RFC conformant behaviour).

If not set (default) receiving a 6xx will cancel all the running parallel branches, will stop DNS failover and forking. However serial forking using `append_branch()` in the `failure_route` will still work.

It can be overwritten on a per transaction basis using `t_set_disable_6xx()`.

Default value is 0 (off, rfc conformant behaviour).

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm disable_6xx_block 0

See also: `t_set_disable_6xx()`.

### Set `disable_6xx_block` parameter

    ...
    modparam("tm", "disable_6xx_block", 1)
    ...

## `local_ack_mode` (integer)

This setting controls where locally generated ACKs for 2xx replies to local transactions (transactions created via `t_uac*()` either through the TM api or via RPC/mi/fifo) are sent.

It has 3 possible values:

- 0 - the ACK destination is choosen according to the RFC: the next hop is found using the contact and the route set and then DNS resolution is used on it.

- 1 - the ACK is sent to the same address as the corresponding INVITE branch.

- 2 - the ACK is sent to the source of the 2xx reply.

Modes 1 and 2 do not follow RFC 3261, but are useful to deal with some simple UAs behind a NAT (no different routing for the ACK and the contact contains an address behind the NAT).

The default value is 0 (RFC conformant behaviour).

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm local_ack_mode 0

### Set `local_ack_mode` parameter

    ...
    modparam("tm", "local_ack_mode", 1)
    ...

## `local_ack_branch_mode` (integer)

If set to 1, the Via branch value of the ACK for 200ok of a local INVITE has a slightly different value than the corresponding local INVITE. If set to 2, a new Via branch is attempted to be created.

Default 0.

### Set `local_ack_branch_mode` parameter

    ...
    modparam("tm", "local_ack_branch_mode", 1)
    ...

## `failure_reply_mode` (integer)

This parameter controls how branches are managed and replies are selected for failure_route handling: keep all, drop all, drop last branches in SIP serial forking handling.

To control per transaction see `t_drop_replies()`.

It has 4 possible values:

- 0 - all branches are kept, no matter a new leg of serial forking has been started. Beware that if the new leg fails, you may get in failure_route a reply code from a branch of previous serial forking legs (e.g., if in first leg you got a 3xx, then you handled the redirection in failure route, sent to a new destination and this one timeout, you will get again the 3xx). Use t_drop_replies() on per transaction fashion to control the behavior you want. It is the default behaviour coming from SER 2.1.x.

- 1 - all branches are discarded by default. You can still overwrite the behaviour via t_drop_replies()

- 2 - by default only the branches of previous leg of serial forking are discarded

- 3 - all previous branches are discarded if there is a new serial forking leg. This is the default behaviour coming from Kamailio 1.5.x. Use this mode if you don't want to handle in a per transaction fashion with t_drop_replies(). It ensures that you will get the winning reply from the branches of last serial forking step (e.g., if in first step you get 3xx, then you forward to a new destination, you will get in failure_route the reply coming from that destination or a local timeout).

The default value is 3.

### Set `failure_reply_mode` parameter

    ...
    modparam("tm", "failure_reply_mode", 0)
    ...

## `faked_reply_prio` (integer)

It controls how branch selection is done. It allows to give a penalty to faked replies such as the infamous 408 on branch timeout.

Internally, every reply is assigned a priority between 0 (high prio) and 32000 (low prio). With this parameter the priority of fake replies can be adjusted.

- 0 - disabled (default)

- < 0 - priority is increased by given amount.

- > 0 - priority is decreased by given amount. Do not make it higher than 10000 or faked replies will even loose from 1xx class replies.

The default value is 0.

To let received replies win from a locally generated 408, set this value to 2000.

### Set `faked_reply_prio` parameter

    ...
    modparam("tm", "faked_reply_prio", 2000)
    ...

## `local_cancel_reason` (boolean)

Enables/disables adding reason headers (RFC 3326) for CANCELs generated due to receiving a final reply. The reason header added will look like: "Reason: SIP;cause=<final_reply_code>".

Default value is 1 (enabled).

Can be set at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm local_cancel_reason 0

See also: `e2e_cancel_reason`.

### Set `local_cancel_reason` parameter

    ...
    modparam("tm", "local_cancel_reason", 0)
    ...

## `e2e_cancel_reason` (boolean)

Enables/disables adding reason headers (RFC 3326) for CANCELs generated due to a received CANCEL. If enabled the reason headers from received CANCELs will be copied into the generated hop-by-hop CANCELs.

Default value is 1 (enabled).

Can be changed at runtime, e.g.:

    	$ &sercmd; cfg.set_now_int tm e2e_cancel_reason 0

See also: `t_set_no_e2e_cancel_reason()` and `local_cancel_reason`.

### Set `e2e_cancel_reason` parameter

    ...
    modparam("tm", "e2e_cancel_reason", 0)
    ...

## `e2e_cancel_hop_by_hop` (int)

Enable/disable sending CANCEL in hop-by-hop mode.

Default value: 1 (hop-by-hop mode).

### Set `e2e_cancel_hop_by_hop` parameter

    ...
    modparam("tm", "e2e_cancel_hop_by_hop", 0)
    ...

## `headers_mode` (int)

Control how headers from incoming CANCEL should be propagated to hop-by-hop generated CANCEL. If bit (flag) 1 is set (value 1), propagate the headers that are not branch specific (e.g., From, To). If bit (flag) 2 is set, in case processing ends in stateless forwarding by tm, forward CANCEL with a single Via header (the one added by &kamailio;).

Default value: 0 (do not propagate).

### Set `headers_mode` parameter

    ...
    modparam("tm", "headers_mode", 1)
    ...

## `remap_503_500` (boolean)

Enables/disables conversion of 503 response code to 500. By default it is enabled, based on the SIP RFC requirement. This is global setting for all received replies handled by TM. To do it per transaction basis, let this option disabled, set a failure route and then do t_reply("500", "...") inside it.

Default value is 1 (enabled).

### Set `remap_503_500` parameter

    ...
    modparam("tm", "remap_503_500", 0)
    ...

## `failure_exec_mode` (boolean)

Add local failed branches in timer to be considered for failure routing blocks. If disabled, relay functions will return false in case the branch could not be forwarded (default behaviour before v4.1.0).

Default value is 0 (disabled).

### Set `failure_exec_mode` parameter

    ...
    modparam("tm", "failure_exec_mode", 1)
    ...

## `dns_reuse_rcv_socket` (boolean)

Control reuse of the receive socket for additional branches added by DNS failover. If set to 1, the receive socket is used for sending out the new branches, unless the socket is forced explicitely in configuration file. If set to 0, selected socket is done depending on value of global parameter "mhomed" (if mhomed=0, then the first listen socket is used, otherwise the socket is selected based on routing rules).

Do enable it with caution, it might create troubles on DNS results with different transport layer. Better let it be disabled and enable "mhomed".

Default value is 0 (disabled).

### Set `dns_reuse_rcv_socket` parameter

    ...
    modparam("tm", "dns_reuse_rcv_socket", 1)
    ...

## `xavp_contact` (string)

The name of XAVP storing the attributes per contact. This must be the same as the usrloc parameter `xavp_contact`.

Default value is NULL.

### Set `xavp_contact` parameter

    ...
    modparam("tm|usrloc", "xavp_contact", "ulattrs")
    ...

## `event_callback` (str)

The name of the function in the kemi configuration file (embedded scripting language such as Lua, Python, ...) to be executed instead of event_route[tm:local-request] block. The function receives a string parameter with the name of the event, respectively "tm:local-request".

Default value is 'empty' (no function is executed for events).

### Set `event_callback` parameter

    ...
    modparam("tm", "event_callback", "ksr_tm_event")
    ...
    -- event callback function implemented in Lua
    function ksr_tm_event(evname)
    	KSR.info("===== tm module triggered event: " .. evname .. "\n");
    	return 1;
    end
    ...

## `event_callback_lres_sent` (str)

The name of the function in the kemi configuration file (embedded scripting language such as Lua, Python, ...) to be executed instead of event_route[tm:local-response] block. The function receives a string parameter with the name of the event, respectively "tm:local-response".

Default value is 'empty' (no function is executed for events).

### Set `event_callback_lres_sent` parameter

    ...
    modparam("tm", "event_callback_lres_sent", "ksr_tm_event_response_sent")
    ...
    -- event callback function implemented in Lua
    function ksr_tm_event_response_sent(evname)
    	KSR.info("===== tm module triggered event: " .. evname .. "\n");
    	return 1;
    end
    ...

## `evcb_local_ack_sent` (str)

The name of the function in the kemi configuration file (embedded scripting language such as Lua, Python, ...) to be executed instead of event_route[tm:local-ack-sent] block. The function receives a string parameter with the name of the event, respectively "tm:local-ack-sent".

Default value is 'empty' (no function is executed for events).

### Set `evcb_local_ack_sent` parameter

    ...
    modparam("tm", "evcb_local_ack_sent", "ksr_tm_event_local_ack_sent")
    ...
    -- event callback function implemented in Lua
    function ksr_tm_event_local_ack_sent(evname)
    	KSR.info("===== tm module triggered event: " .. evname .. "\n");
    	return 1;
    end
    ...

## `relay_100` (str)

This parameter controls whether or not a SIP 100 response is proxied. Note that this is not valid behavior when operating in stateful mode per RFC 3261 Section 21.1.1, and therefore is useful only when operating as a stateless proxy. When using this feature, it is possible to control which 100 responses are proxied and which are not by detecting whether they are part of an existing transaction and setting up the appropriate logic in onreply_route.

Default value is 0 (disabled).

### Set `relay_100` parameter

    ...
    modparam("tm", "relay_100", 1)
    ...

## `rich_redirect` (int)

When sending a 3xx class reply, include additional branch info to the contacts such as path vector and branch flags.

- 0 - no extra info is added (default)

- 1 - include branch flags as contact header parameter

- 2 - include path as contact uri Route header

Values may be combined (added).

### rich_redirect example

    ...
    modparam("tm", "rich_redirect", 3)
    ....

## `exec_time_check` (int)

Duration in milliseconds for executing transaction failure callbacks and failure_route block after which to do a safety check if transaction is still active.

Set it to 0 in order to disable this check.

Default value is 5000 (5 seconds).

### Set `exec_time_check` parameter

    ...
    modparam("tm", "exec_time_check", 0)
    ...

## `reply_relay_mode` (int)

If set to 1, a received 200 OK response that was suspended is no longer forwarded in the transactional context if another final response was forwarded while 200 OK was suspended. Forwarding the 200 OK, even it was received first, results in overwriting the transaction response buffer that can impact matching of incoming ACKs.

Set it to 0 in order to disable this behaviour and attempt to forward suspended 200 OK in the transaction context. This was the behaviour before the commit 18410da0.

Default value is 1.

### Set `reply_relay_mode` parameter

    ...
    modparam("tm", "reply_relay_mode", 0)
    ...

## `enable_uac_fr` (int)

Enable failure route trigger, for uac. This will copy the tm uac into uas. Thus, failure route can be triggered even for uac messages. The default is 0 (disabled).

### enable_uac_fr example

    ...
    modparam("tm", "enable_uac_fr", 1)
    ....

## `failover_reply_codes` (string)

This parameter defines the response codes (only codes >= 300 and class >= 3), which enable dns failover to continue to try next ips when previous one fail. It is a list separated by colons, where you may define either a single code (e.g. "code=408" would accept 408 as an additional response code) or a class of responses, you want to accept (e.g. "class=3" would accept everything from 300 to 999 as valid response). (with default behaviour only 503 code or no response from previous one will try next ip).

Default value is

### Set the failover_reply_codes parameter

    ...
    modparam("tm", "failover_reply_codes", "code=403;code=488;class=5")
    ...

## `reply_408_code` (int)

Status code for internally generated timeout responses.

Default value is 408.

### reply_408_code example

    ...
    modparam("tm", "reply_408_code", 410)
    ....

## `reply_408_reason` (str)

Reason phrase for internally generated timeout responses.

Default value is Request Timeout.

### reply_408_reason example

    ...
    modparam("tm", "reply_408_reason", "Gone")
    ....

## `delayed_reply` (int)

If set to 1, the reply generation in case of request processing/forwarding error is delayed till the config script execution ends. This allows the script writer to send its own error reply. If set to 0, the transaction is replied and killed immediately.

Default value is 1.

### delayed_reply example

    ...
    modparam("tm", "delayed_reply", 0)
    ....

## `evlreq_mode` (int)

If bit 1 is set (value 1), the event_route[tm:local-request] is also executed for hop-by-hop CANCEL requests (for received INVITEs, not only for local generated ones).

Default value is 0.

### evlreq_mode example

    ...
    modparam("tm", "evlreq_mode", 1)
    ....