|
@@ -26,15 +26,16 @@ Olle E. Johansson
|
|
|
3. Functions
|
|
|
|
|
|
3.1. tcp_conid_alive(conid)
|
|
|
- 3.2. tcp_conid_state(conid)
|
|
|
- 3.3. tcp_keepalive_enable([conid], idle, count, interval)
|
|
|
- 3.4. tcp_keepalive_disable([conid])
|
|
|
- 3.5. tcp_set_connection_lifetime([conid], lifetime)
|
|
|
- 3.6. tcp_enable_closed_event([conid])
|
|
|
- 3.7. tcp_get_conid(hostport, pvname)
|
|
|
- 3.8. tcp_set_otcpid(conid)
|
|
|
- 3.9. tcp_set_otcpid_flag(mode)
|
|
|
- 3.10. tcp_close_connection([conid])
|
|
|
+ 3.2. tcp_con_alive(hostport)
|
|
|
+ 3.3. tcp_conid_state(conid)
|
|
|
+ 3.4. tcp_keepalive_enable([conid], idle, count, interval)
|
|
|
+ 3.5. tcp_keepalive_disable([conid])
|
|
|
+ 3.6. tcp_set_connection_lifetime([conid], lifetime)
|
|
|
+ 3.7. tcp_enable_closed_event([conid])
|
|
|
+ 3.8. tcp_get_conid(hostport, pvname)
|
|
|
+ 3.9. tcp_set_otcpid(conid)
|
|
|
+ 3.10. tcp_set_otcpid_flag(mode)
|
|
|
+ 3.11. tcp_close_connection([conid])
|
|
|
|
|
|
4. Event routes
|
|
|
|
|
@@ -48,15 +49,16 @@ Olle E. Johansson
|
|
|
1.1. Set closed_event parameter
|
|
|
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
|
|
|
- 1.10. tcp_set_otcpid usage
|
|
|
- 1.11. tcp_set_otcpid_flag usage
|
|
|
- 1.12. tcp_close_connection usage
|
|
|
+ 1.4. tcp_con_alive usage
|
|
|
+ 1.5. tcp_conid_state usage
|
|
|
+ 1.6. tcp_keepalive_enable usage
|
|
|
+ 1.7. tcp_keepalive_disable usage
|
|
|
+ 1.8. tcp_set_connection_lifetime usage
|
|
|
+ 1.9. tcp_set_closed_event usage
|
|
|
+ 1.10. tcp_get_conid usage
|
|
|
+ 1.11. tcp_set_otcpid usage
|
|
|
+ 1.12. tcp_set_otcpid_flag usage
|
|
|
+ 1.13. tcp_close_connection usage
|
|
|
|
|
|
Chapter 1. Admin Guide
|
|
|
|
|
@@ -71,15 +73,16 @@ Chapter 1. Admin Guide
|
|
|
3. Functions
|
|
|
|
|
|
3.1. tcp_conid_alive(conid)
|
|
|
- 3.2. tcp_conid_state(conid)
|
|
|
- 3.3. tcp_keepalive_enable([conid], idle, count, interval)
|
|
|
- 3.4. tcp_keepalive_disable([conid])
|
|
|
- 3.5. tcp_set_connection_lifetime([conid], lifetime)
|
|
|
- 3.6. tcp_enable_closed_event([conid])
|
|
|
- 3.7. tcp_get_conid(hostport, pvname)
|
|
|
- 3.8. tcp_set_otcpid(conid)
|
|
|
- 3.9. tcp_set_otcpid_flag(mode)
|
|
|
- 3.10. tcp_close_connection([conid])
|
|
|
+ 3.2. tcp_con_alive(hostport)
|
|
|
+ 3.3. tcp_conid_state(conid)
|
|
|
+ 3.4. tcp_keepalive_enable([conid], idle, count, interval)
|
|
|
+ 3.5. tcp_keepalive_disable([conid])
|
|
|
+ 3.6. tcp_set_connection_lifetime([conid], lifetime)
|
|
|
+ 3.7. tcp_enable_closed_event([conid])
|
|
|
+ 3.8. tcp_get_conid(hostport, pvname)
|
|
|
+ 3.9. tcp_set_otcpid(conid)
|
|
|
+ 3.10. tcp_set_otcpid_flag(mode)
|
|
|
+ 3.11. tcp_close_connection([conid])
|
|
|
|
|
|
4. Event routes
|
|
|
|
|
@@ -146,15 +149,16 @@ end
|
|
|
3. Functions
|
|
|
|
|
|
3.1. tcp_conid_alive(conid)
|
|
|
- 3.2. tcp_conid_state(conid)
|
|
|
- 3.3. tcp_keepalive_enable([conid], idle, count, interval)
|
|
|
- 3.4. tcp_keepalive_disable([conid])
|
|
|
- 3.5. tcp_set_connection_lifetime([conid], lifetime)
|
|
|
- 3.6. tcp_enable_closed_event([conid])
|
|
|
- 3.7. tcp_get_conid(hostport, pvname)
|
|
|
- 3.8. tcp_set_otcpid(conid)
|
|
|
- 3.9. tcp_set_otcpid_flag(mode)
|
|
|
- 3.10. tcp_close_connection([conid])
|
|
|
+ 3.2. tcp_con_alive(hostport)
|
|
|
+ 3.3. tcp_conid_state(conid)
|
|
|
+ 3.4. tcp_keepalive_enable([conid], idle, count, interval)
|
|
|
+ 3.5. tcp_keepalive_disable([conid])
|
|
|
+ 3.6. tcp_set_connection_lifetime([conid], lifetime)
|
|
|
+ 3.7. tcp_enable_closed_event([conid])
|
|
|
+ 3.8. tcp_get_conid(hostport, pvname)
|
|
|
+ 3.9. tcp_set_otcpid(conid)
|
|
|
+ 3.10. tcp_set_otcpid_flag(mode)
|
|
|
+ 3.11. tcp_close_connection([conid])
|
|
|
|
|
|
3.1. tcp_conid_alive(conid)
|
|
|
|
|
@@ -178,7 +182,28 @@ end
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.2. tcp_conid_state(conid)
|
|
|
+3.2. tcp_con_alive(hostport)
|
|
|
+
|
|
|
+ Check the connection based on target host:port.
|
|
|
+
|
|
|
+ Meaning of the parameters is as follows:
|
|
|
+ * hostport - target "host:port" address, the port can be omitted
|
|
|
+ (default to 5060) and the parameter can contain variables.
|
|
|
+
|
|
|
+ Return values:
|
|
|
+
|
|
|
+ 1: connection was found
|
|
|
+
|
|
|
+ -1: connection was not found or an error occurred
|
|
|
+
|
|
|
+ Example 1.4. tcp_con_alive usage
|
|
|
+...
|
|
|
+ if(!tcp_con_alive("1.2.3.4:5060")) {
|
|
|
+ xlog("connection not found\n");
|
|
|
+ }
|
|
|
+...
|
|
|
+
|
|
|
+3.3. tcp_conid_state(conid)
|
|
|
|
|
|
Check the state of a TCP or WS connection ID
|
|
|
|
|
@@ -202,14 +227,14 @@ end
|
|
|
|
|
|
-4: Socket is in unknown bad state. Connection will likely close.
|
|
|
|
|
|
- Example 1.4. tcp_conid_state usage
|
|
|
+ Example 1.5. tcp_conid_state usage
|
|
|
...
|
|
|
if(!tcp_conid_state("$var(conid)")) {
|
|
|
xlog("L_ERR", "Connection $conid is closed or malfunctional\n");
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.3. tcp_keepalive_enable([conid], idle, count, interval)
|
|
|
+3.4. tcp_keepalive_enable([conid], idle, count, interval)
|
|
|
|
|
|
Enables keepalive on a TCP connection.
|
|
|
|
|
@@ -225,7 +250,7 @@ end
|
|
|
|
|
|
Returns 1 on success, -1 on failure.
|
|
|
|
|
|
- Example 1.5. tcp_keepalive_enable usage
|
|
|
+ Example 1.6. tcp_keepalive_enable usage
|
|
|
request_route {
|
|
|
if (is_method("INVITE")) {
|
|
|
$avp(caller_conid) = $conid;
|
|
@@ -244,7 +269,7 @@ onreply_route[foo] {
|
|
|
...
|
|
|
}
|
|
|
|
|
|
-3.4. tcp_keepalive_disable([conid])
|
|
|
+3.5. tcp_keepalive_disable([conid])
|
|
|
|
|
|
Disables keepalive on a TCP connection.
|
|
|
|
|
@@ -256,7 +281,7 @@ onreply_route[foo] {
|
|
|
|
|
|
Returns 1 on success, -1 on failure.
|
|
|
|
|
|
- Example 1.6. tcp_keepalive_disable usage
|
|
|
+ Example 1.7. tcp_keepalive_disable usage
|
|
|
request_route {
|
|
|
...
|
|
|
if (is_method("BYE")) {
|
|
@@ -275,7 +300,7 @@ onreply_route[foo] {
|
|
|
...
|
|
|
}
|
|
|
|
|
|
-3.5. tcp_set_connection_lifetime([conid], lifetime)
|
|
|
+3.6. tcp_set_connection_lifetime([conid], lifetime)
|
|
|
|
|
|
Sets the connection lifetime of a connection (TCP).
|
|
|
|
|
@@ -287,7 +312,7 @@ onreply_route[foo] {
|
|
|
|
|
|
Returns 1 on success, -1 on failure.
|
|
|
|
|
|
- Example 1.7. tcp_set_connection_lifetime usage
|
|
|
+ Example 1.8. tcp_set_connection_lifetime usage
|
|
|
...
|
|
|
# use 10s as default lifetime
|
|
|
tcp_connection_lifetime=10
|
|
@@ -302,7 +327,7 @@ request_route {
|
|
|
...
|
|
|
}
|
|
|
|
|
|
-3.6. tcp_enable_closed_event([conid])
|
|
|
+3.7. tcp_enable_closed_event([conid])
|
|
|
|
|
|
Explicitly enables the "tcp:closed" event route on a TCP connection.
|
|
|
|
|
@@ -313,7 +338,7 @@ request_route {
|
|
|
|
|
|
Returns 1 on success, -1 on failure.
|
|
|
|
|
|
- Example 1.8. tcp_set_closed_event usage
|
|
|
+ Example 1.9. tcp_set_closed_event usage
|
|
|
...
|
|
|
# "tcp:closed" event route is "manual" mode
|
|
|
modparam("tcpops", "closed_event", 2)
|
|
@@ -333,7 +358,7 @@ event_route[tcp:closed] {
|
|
|
xlog("connection $conid was closed");
|
|
|
}
|
|
|
|
|
|
-3.7. tcp_get_conid(hostport, pvname)
|
|
|
+3.8. tcp_get_conid(hostport, pvname)
|
|
|
|
|
|
Get the connection id based on target host:port. The connection id is
|
|
|
set in the variable named by pvname parameter.
|
|
@@ -349,14 +374,14 @@ event_route[tcp:closed] {
|
|
|
|
|
|
-1: connection was not found or an error occurred
|
|
|
|
|
|
- Example 1.9. tcp_get_conid usage
|
|
|
+ Example 1.10. tcp_get_conid usage
|
|
|
...
|
|
|
if(tcp_get_conid("127.0.0.1:5060", "$var(conid)")) {
|
|
|
xlog("connection id is: $var(conid)\n");
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.8. tcp_set_otcpid(conid)
|
|
|
+3.9. tcp_set_otcpid(conid)
|
|
|
|
|
|
Set the value for outbound tcp connection id.
|
|
|
|
|
@@ -368,13 +393,13 @@ event_route[tcp:closed] {
|
|
|
* 1: success
|
|
|
* -1: failure
|
|
|
|
|
|
- Example 1.10. tcp_set_otcpid usage
|
|
|
+ Example 1.11. tcp_set_otcpid usage
|
|
|
...
|
|
|
$var(conid) = 10;
|
|
|
tcp_set_otcpid("$var(conid)");
|
|
|
...
|
|
|
|
|
|
-3.9. tcp_set_otcpid_flag(mode)
|
|
|
+3.10. tcp_set_otcpid_flag(mode)
|
|
|
|
|
|
Set or reset the internal flag for using or not the outbound tcp
|
|
|
connection id for sending out. The outbound connection id can be set by
|
|
@@ -397,13 +422,13 @@ event_route[tcp:closed] {
|
|
|
unexpected destination. Reset the flag in such case, if you set it
|
|
|
previously.
|
|
|
|
|
|
- Example 1.11. tcp_set_otcpid_flag usage
|
|
|
+ Example 1.12. tcp_set_otcpid_flag usage
|
|
|
...
|
|
|
$var(cmode) = 1;
|
|
|
tcp_set_otcpid_flag("$var(cmode)");
|
|
|
...
|
|
|
|
|
|
-3.10. tcp_close_connection([conid])
|
|
|
+3.11. tcp_close_connection([conid])
|
|
|
|
|
|
Trigger a close of the connection corresponding to current SIP message
|
|
|
or to connection id 'conid'.
|
|
@@ -416,7 +441,7 @@ event_route[tcp:closed] {
|
|
|
* 1: success
|
|
|
* -1 (or other negative values): failure
|
|
|
|
|
|
- Example 1.12. tcp_close_connection usage
|
|
|
+ Example 1.13. tcp_close_connection usage
|
|
|
...
|
|
|
$var(conid) = 10;
|
|
|
tcp_close_connection("$var(conid)");
|