Skip to content

Commit

Permalink
modules: readme files regenerated - evapi ... [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
kamailio-dev committed Apr 4, 2017
1 parent 2706261 commit e564247
Showing 1 changed file with 45 additions and 18 deletions.
63 changes: 45 additions & 18 deletions src/modules/evapi/README
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Daniel-Constantin Mierla
3.1. workers (int)
3.2. bind_addr (str)
3.3. netstring_format (int)
3.4. event_callback (str)

4. Functions

Expand All @@ -53,15 +54,16 @@ Daniel-Constantin Mierla
1.1. Set workers parameter
1.2. Set bind_addr parameter
1.3. Set netstring_format parameter
1.4. evapi_relay usage
1.5. TCP message
1.6. evapi_async_relay usage
1.7. evapi_multicast usage
1.8. evapi_async_multicast usage
1.9. evapi_unicast usage
1.10. evapi_async_unicast usage
1.11. evapi_close usage
1.12. evapi_set_tag usage
1.4. Set event_callback parameter
1.5. evapi_relay usage
1.6. TCP message
1.7. evapi_async_relay usage
1.8. evapi_multicast usage
1.9. evapi_async_multicast usage
1.10. evapi_unicast usage
1.11. evapi_async_unicast usage
1.12. evapi_close usage
1.13. evapi_set_tag usage

Chapter 1. Admin Guide

Expand All @@ -78,6 +80,7 @@ Chapter 1. Admin Guide
3.1. workers (int)
3.2. bind_addr (str)
3.3. netstring_format (int)
3.4. event_callback (str)

4. Functions

Expand Down Expand Up @@ -131,6 +134,7 @@ Chapter 1. Admin Guide
3.1. workers (int)
3.2. bind_addr (str)
3.3. netstring_format (int)
3.4. event_callback (str)

3.1. workers (int)

Expand Down Expand Up @@ -167,6 +171,29 @@ modparam("evapi", "bind_addr", "1.2.3.4:8228")
modparam("evapi", "netstring_format", 0)
...

3.4. 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: 'evapi:connection-new', 'evapi:connection-closed',
'evapi:message-received'.

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

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

4. Functions

4.1. evapi_relay(evdata)
Expand All @@ -193,14 +220,14 @@ modparam("evapi", "netstring_format", 0)

This function can be used from ANY_ROUTE.

Example 1.4. evapi_relay usage
Example 1.5. evapi_relay usage
...
evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}");
...

The above exaple will send the following message over tcp:

Example 1.5. TCP message
Example 1.6. TCP message
...
47:{
"event": "test",
Expand All @@ -224,7 +251,7 @@ evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}");

This function can be used from REQUEST_ROUTE.

Example 1.6. evapi_async_relay usage
Example 1.7. evapi_async_relay usage
...
evapi_async_relay("{ \"event\": \"suspend\",\n \"data\":"
" { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}");
Expand All @@ -236,7 +263,7 @@ evapi_async_relay("{ \"event\": \"suspend\",\n \"data\":"
tag provided by etag value. The etag can be a variable. For more see
evapi_relay() and evapi_set_tag().

Example 1.7. evapi_multicast usage
Example 1.8. evapi_multicast usage
...
evapi_multicast("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}", "ta
gx");
Expand All @@ -248,7 +275,7 @@ gx");
the tag provided by etag value. The etag can be a variable. For more
see evapi_async_relay() and evapi_set_tag().

Example 1.8. evapi_async_multicast usage
Example 1.9. evapi_async_multicast usage
...
evapi_async_multicast("{ \"event\": \"suspend\",\n \"data\":"
" { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}", "tagx");
Expand All @@ -260,7 +287,7 @@ evapi_async_multicast("{ \"event\": \"suspend\",\n \"data\":"
match the tag provided by etag value. The etag can be a variable. For
more see evapi_relay() and evapi_set_tag().

Example 1.9. evapi_unicast usage
Example 1.10. evapi_unicast usage
...
evapi_unicast("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}", "tagx
");
Expand All @@ -272,7 +299,7 @@ evapi_unicast("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}", "tagx
that match the tag provided by etag value. The etag can be a variable.
For more see evapi_async_relay() and evapi_set_tag().

Example 1.10. evapi_async_unicast usage
Example 1.11. evapi_async_unicast usage
...
evapi_async_unicast("{ \"event\": \"suspend\",\n \"data\":"
" { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}", "tagx");
Expand All @@ -284,7 +311,7 @@ evapi_async_unicast("{ \"event\": \"suspend\",\n \"data\":"

This function can be used from ANY_ROUTE.

Example 1.11. evapi_close usage
Example 1.12. evapi_close usage
...
event_route[evapi:connection-new] {
if($evapi(srcaddr)!="127.0.0.1") {
Expand All @@ -302,7 +329,7 @@ event_route[evapi:connection-new] {

This function can be used from ANY_ROUTE.

Example 1.12. evapi_set_tag usage
Example 1.13. evapi_set_tag usage
...
event_route[evapi:connection-new] {
if($evapi(srcaddr)=="127.0.0.1") {
Expand Down

0 comments on commit e564247

Please sign in to comment.