Browse code

modules: readme files regenerated - sworker ... [skip ci]

Kamailio Dev authored on 26/11/2020 12:46:28
Showing 1 changed files
... ...
@@ -10,7 +10,7 @@ Daniel-Constantin Mierla
10 10
 
11 11
    <miconda@gmail.com>
12 12
 
13
-   Copyright � 2020 asipto.com
13
+   Copyright © 2020 asipto.com
14 14
      __________________________________________________________________
15 15
 
16 16
    Table of Contents
... ...
@@ -51,10 +51,19 @@ Chapter 1. Admin Guide
51 51
 1. Overview
52 52
 
53 53
    This module can delegate processing of SIP requests to a group of
54
-   workers in the configuration file. The async workers have to defined
55
-   with the global parameter.
54
+   workers in the configuration file by using
55
+   event_route[core:pre-routing]. The async workers have to defined with
56
+   the global parameter. The worker process that received the message
57
+   internally does the usual execution of the config script, running
58
+   request_route or reply_route.
56 59
 
57
-   It does not create the transaction and nor suspend it.
60
+   Note: the behaviour is different than the async module, because it does
61
+   not create the transaction (obviously also not performing suspend).
62
+
63
+   Note: it does not propagate anything set in the event_route, therefore
64
+   any set flag, or avp, etc. are lost. The SIP message is processed by
65
+   the delegated worker as it was fresh received from the network
66
+   (including parsing).
58 67
 
59 68
 2. Dependencies
60 69
 
... ...
@@ -77,7 +86,7 @@ Chapter 1. Admin Guide
77 86
    3.1. sworker_active()
78 87
    3.2. swork_task(gname)
79 88
 
80
-3.1. sworker_active()
89
+3.1.  sworker_active()
81 90
 
82 91
    Return 1 (true) if the processing happens in an asyn process, or -1
83 92
    (false) if the processing is happening in a SIP receiving process.
... ...
@@ -94,24 +103,28 @@ request_route {
94 103
 }
95 104
 ...
96 105
 
97
-3.2. swork_task(gname)
106
+3.2.  swork_task(gname)
98 107
 
99
-   Delegate the processing of SIP message to a group of async workers.
108
+   Delegate the processing of SIP message to a group of async workers. The
109
+   function is restricted to be used inside event_route[core:pre-routing].
100 110
 
101 111
    The parameter gname provides the name of the group workers, it can
102 112
    contain pseudo-variables.
103 113
 
104
-   The function returns 0 (exit) in case the task is delegated.
114
+   The function returns 1 (true) in case the task is delegated. After
115
+   that, 'drop' must be used so processing of the message does not
116
+   continue to request_route or reply_route in the same process, it is
117
+   going to be done by the delegated group of workers. It returns -1
118
+   (false) in case there was a proble delegating the processing.
105 119
 
106 120
    This function can be used from REQUEST_ROUTE|CORE_REPLY_ROUTE.
107 121
 
108 122
    Example 1.2. sworker_task() usage
109 123
 ...
110
-request_route {
111
-        if(!sworker_active()) {
124
+event_route[core:pre-routing] {
125
+        if(sworker_task("default")) {
112 126
                 xinfo("===== delegate processing [$Tf] [$si:$sp]\n");
113
-                sworker_task("default");
114
-                exit;
127
+                drop;
115 128
         }
116 129
         xinfo("===== processing continues [$Tf] [$si:$sp]\n");
117 130
     ...