Skip to content

Commit

Permalink
modules: readme files regenerated - tcpops ... [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
kamailio-dev committed Feb 28, 2019
1 parent aab836d commit d726bd4
Showing 1 changed file with 40 additions and 14 deletions.
54 changes: 40 additions & 14 deletions src/modules/tcpops/README
Expand Up @@ -21,6 +21,7 @@ Olle E. Johansson
2. Parameters

2.1. closed_event (int)
2.2. event_callback (str)

3. Functions

Expand All @@ -42,13 +43,14 @@ Olle E. Johansson
List of Examples

1.1. Set closed_event parameter
1.2. tcp_conid_alive usage
1.3. tcp_conid_state usage
1.4. tcp_keepalive_enable usage
1.5. tcp_keepalive_disable usage
1.6. tcp_set_connection_lifetime usage
1.7. tcp_set_closed_event usage
1.8. tcp_get_conid usage
1.2. Set event_callback parameter
1.3. tcp_conid_alive usage
1.4. tcp_conid_state usage
1.5. tcp_keepalive_enable usage
1.6. tcp_keepalive_disable usage
1.7. tcp_set_connection_lifetime usage
1.8. tcp_set_closed_event usage
1.9. tcp_get_conid usage

Chapter 1. Admin Guide

Expand All @@ -58,6 +60,7 @@ Chapter 1. Admin Guide
2. Parameters

2.1. closed_event (int)
2.2. event_callback (str)

3. Functions

Expand Down Expand Up @@ -89,6 +92,7 @@ Chapter 1. Admin Guide
2. Parameters

2.1. closed_event (int)
2.2. event_callback (str)

2.1. closed_event (int)

Expand All @@ -109,6 +113,28 @@ Chapter 1. Admin Guide
modparam("tcpops", "closed_event", 0)
...

2.2. 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[...] blocks.

The function receives a string parameter with the name of the event,
the values are: 'tcp:closed', 'tcp:timeout', 'tcp:reset'.

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

Example 1.2. Set event_callback parameter
...
modparam("tcpops", "event_callback", "ksr_tcpops_event")
...
-- event callback function implemented in Lua
function ksr_tcpops_event(evname)
KSR.info("===== evapi module triggered event: " .. evname .. "\n");
return 1;
end
...

3. Functions

3.1. tcp_conid_alive(conid)
Expand All @@ -133,7 +159,7 @@ modparam("tcpops", "closed_event", 0)

-1: Connection has errors, does not exist or is about to be closed)

Example 1.2. tcp_conid_alive usage
Example 1.3. tcp_conid_alive usage
...
$var(conid) = $conid;
if(!tcp_conid_alive("$var(conid)")) {
Expand Down Expand Up @@ -165,7 +191,7 @@ modparam("tcpops", "closed_event", 0)

-4: Socket is in unknown bad state. Connection will likely close.

Example 1.3. tcp_conid_state usage
Example 1.4. tcp_conid_state usage
...
if(!tcp_conid_state("$var(conid)")) {
xlog("L_ERR", "Connection $conid is closed or malfunctional\n");
Expand All @@ -188,7 +214,7 @@ modparam("tcpops", "closed_event", 0)

Returns 1 on success, -1 on failure.

Example 1.4. tcp_keepalive_enable usage
Example 1.5. tcp_keepalive_enable usage
request_route {
if (is_method("INVITE")) {
$avp(caller_conid) = $conid;
Expand Down Expand Up @@ -219,7 +245,7 @@ onreply_route[foo] {

Returns 1 on success, -1 on failure.

Example 1.5. tcp_keepalive_disable usage
Example 1.6. tcp_keepalive_disable usage
request_route {
...
if (is_method("BYE")) {
Expand Down Expand Up @@ -250,7 +276,7 @@ onreply_route[foo] {

Returns 1 on success, -1 on failure.

Example 1.6. tcp_set_connection_lifetime usage
Example 1.7. tcp_set_connection_lifetime usage
...
# use 10s as default lifetime
tcp_connection_lifetime=10
Expand All @@ -276,7 +302,7 @@ request_route {

Returns 1 on success, -1 on failure.

Example 1.7. tcp_set_closed_event usage
Example 1.8. tcp_set_closed_event usage
...
# "tcp:closed" event route is "manual" mode
modparam("tcpops", "closed_event", 2)
Expand Down Expand Up @@ -312,7 +338,7 @@ event_route[tcp:closed] {

-1: connection was not found or an error occurred

Example 1.8. tcp_get_conid usage
Example 1.9. tcp_get_conid usage
...
if(tcp_conid_alive("127.0.0.1:5060", "$var(conid)")) {
xlog("connection id is: $var(conid)\n");
Expand Down

0 comments on commit d726bd4

Please sign in to comment.