Kamailio module tm: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
(Created page with "== Overview == Kamailio module tm 내용 정리. == Functions == === t_relay([host, port]) === Relay a message statefuly either to the destination in the current URI (if call...")
 
Line 3: Line 3:


== Functions ==
== Functions ==
=== t_is_set(target) ===
Return true if the attribute specified by 'target' is set for transaction.
The target parameter can be:
* branch_route: the function returns true if a branch route is set to be executed.
* failure_route: the function returns true if a failure route is set to be executed.
* onreply_route: the function returns true if an onreply route is set to be executed.
<pre>
if(!t_is_set("failure_route")) {
    LM_DBG("no failure route will be executed for current transaction\n");
}
</pre>
=== t_relay([host, port]) ===
=== t_relay([host, port]) ===
Relay a message statefuly either to the destination in the current URI (if called without any parameters) or to the specified host and port. In the later case (host and port specified) the protocol used is the same protocol on which the message was received.
Relay a message statefuly either to the destination in the current URI (if called without any parameters) or to the specified host and port. In the later case (host and port specified) the protocol used is the same protocol on which the message was received.

Revision as of 10:14, 18 March 2020

Overview

Kamailio module tm 내용 정리.

Functions

t_is_set(target)

Return true if the attribute specified by 'target' is set for transaction.

The target parameter can be:

  • branch_route: the function returns true if a branch route is set to be executed.
  • failure_route: the function returns true if a failure route is set to be executed.
  • onreply_route: the function returns true if an onreply route is set to be executed.
if(!t_is_set("failure_route")) {
    LM_DBG("no failure route will be executed for current transaction\n");
}

t_relay([host, port])

Relay a message statefuly either to the destination in the current URI (if called without any parameters) or to the specified host and port. In the later case (host and port specified) the protocol used is the same protocol on which the message was received.

t_relay() is the stateful version for forward() while t_relay(host, port) is similar to forward(host, port).

In the forward to uri case (t_relay()), if the original URI was rewritten (by UsrLoc, RR, strip/prefix, etc.) the new URI will be taken. The destination (including the protocol) is determined from the uri, using SIP specific DNS resolving if needed (NAPTR, SRV a.s.o depending also on the dns options).

Returns a negative value on failure -- you may still want to send a negative reply upstream statelessly not to leave upstream UAC in lurch.

if (!t_relay()) 
{ 
    sl_reply_error(); 
    break; 
};

See also