Browse code

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

Kamailio Dev authored on 24/11/2017 14:16:53
Showing 1 changed files
... ...
@@ -26,11 +26,13 @@ Carlos Ruiz Díaz
26 26
 
27 27
         4. Functions
28 28
 
29
-              4.1. cnxcc_set_max_credit()
30
-              4.2. cnxcc_set_max_time()
31
-              4.3. cnxcc_update_max_time()
32
-              4.4. cnxcc_set_max_channel()
33
-              4.5. cnxcc_terminate_all()
29
+              4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse,
30
+                      fpulse)
31
+
32
+              4.2. cnxcc_set_max_time(customer, maxtime)
33
+              4.3. cnxcc_update_max_time(customer, maxtime)
34
+              4.4. cnxcc_set_max_channel(customer, maxchan)
35
+              4.5. cnxcc_terminate_all(customer)
34 36
 
35 37
         5. RPC Commands
36 38
 
... ...
@@ -45,8 +47,8 @@ Carlos Ruiz Díaz
45 45
 
46 46
    List of Examples
47 47
 
48
-   1.1.
49
-   1.2. credit_check_period
48
+   1.1. redis parameter
49
+   1.2. credit_check_period parameter
50 50
    1.3. cnxcc_set_max_credit()
51 51
    1.4. cnxcc_set_max_time()
52 52
    1.5. cnxcc_update_max_time()
... ...
@@ -71,11 +73,13 @@ Chapter 1. Admin Guide
71 71
 
72 72
    4. Functions
73 73
 
74
-        4.1. cnxcc_set_max_credit()
75
-        4.2. cnxcc_set_max_time()
76
-        4.3. cnxcc_update_max_time()
77
-        4.4. cnxcc_set_max_channel()
78
-        4.5. cnxcc_terminate_all()
74
+        4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse,
75
+                fpulse)
76
+
77
+        4.2. cnxcc_set_max_time(customer, maxtime)
78
+        4.3. cnxcc_update_max_time(customer, maxtime)
79
+        4.4. cnxcc_set_max_channel(customer, maxchan)
80
+        4.5. cnxcc_terminate_all(customer)
79 81
 
80 82
    5. RPC Commands
81 83
 
... ...
@@ -142,7 +146,7 @@ Chapter 1. Admin Guide
142 142
 
143 143
    Redis datasource connection information
144 144
 
145
-   Example 1.1.
145
+   Example 1.1. redis parameter
146 146
 ...
147 147
 modparam("cnxcc", "redis", "addr=127.0.0.1;port=6379;db=1")
148 148
 ...
... ...
@@ -156,24 +160,34 @@ modparam("cnxcc", "redis", "addr=127.0.0.1;port=6379;db=1")
156 156
 
157 157
    Values greater than 1 leads to precision lost but less CPU consumption.
158 158
 
159
-   Example 1.2. credit_check_period
159
+   Example 1.2. credit_check_period parameter
160 160
 ...
161 161
 modparam("cnxcc", "credit_check_period", 1)
162 162
 ...
163 163
 
164 164
 4. Functions
165 165
 
166
-   4.1. cnxcc_set_max_credit()
167
-   4.2. cnxcc_set_max_time()
168
-   4.3. cnxcc_update_max_time()
169
-   4.4. cnxcc_set_max_channel()
170
-   4.5. cnxcc_terminate_all()
166
+   4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse, fpulse)
167
+   4.2. cnxcc_set_max_time(customer, maxtime)
168
+   4.3. cnxcc_update_max_time(customer, maxtime)
169
+   4.4. cnxcc_set_max_channel(customer, maxchan)
170
+   4.5. cnxcc_terminate_all(customer)
171
+
172
+4.1.  cnxcc_set_max_credit(customer, maxcredit, cps, ipulse, fpulse)
173
+
174
+   Associates the call with a customer id and sets the max credit, cost
175
+   per second, initial pulse and final pulse. The discount is calculated
176
+   in pulses (30/6, 1/1, etc) and sustracted from the pool of credit.
171 177
 
172
-4.1.  cnxcc_set_max_credit()
178
+   The customer value can be provided as a string or a variable holding a
179
+   string.
173 180
 
174
-   Specifies the initial pulse, final pulse, max credit and cost per
175
-   second of a call. The discount is calculated in pulses (30/6, 1/1, etc)
176
-   and sustracted from the pool of credit.
181
+   The maxcredit and cps can be double (float) or integer values, they
182
+   have to be provided as static string values of variables holding string
183
+   values.
184
+
185
+   The ipulse and fpulse values are integer values, they can be also given
186
+   via variables holding integers.
177 187
 
178 188
    Return code:
179 189
      * 1 - successful
... ...
@@ -182,59 +196,75 @@ modparam("cnxcc", "credit_check_period", 1)
182 182
 
183 183
    Example 1.3. cnxcc_set_max_credit()
184 184
 ...
185
-$var(customer) = "john-doe-123-premium";
186
-$var(credit) = "100";
187
-$var(cps)   = "2.00";         # cost per second
188
-$var(initial_p)   = "030";    # intial pulse
189
-$var(final_p)   = "006";      # final pulse
190
-
191
-cnxcc_set_max_credit("$var(customer)", "$var(credit)", "$var(cps)", "$var(initia
192
-l_p)", "$var(final_p)");
185
+cnxcc_set_max_credit("john-doe", "100.5", "0.5", "20", "10");
186
+...
187
+$var(customer) = "john-doe-premium"; # customer id
188
+$var(credit) = "100";       # max credit
189
+$var(cps)   = "2.00";       # cost per second
190
+$var(initial_p)   = 30;     # intial pulse
191
+$var(final_p)     = 6;      # final pulse
192
+cnxcc_set_max_credit("$var(customer)", "$var(credit)", "$var(cps)",
193
+        "$var(initial_p)", "$var(final_p)");
193 194
 ...
194 195
 
195
-4.2.  cnxcc_set_max_time()
196
+4.2.  cnxcc_set_max_time(customer, maxtime)
196 197
 
197 198
    Specifies the amount of time the call should last at most.
198 199
 
200
+   The customer value can be provided as a string or a variable holding a
201
+   string.
202
+
203
+   The maxtime value is an integer values, it can be also given via a
204
+   variable holding an integer.
205
+
199 206
    Return code:
200 207
      * 1 - successful
201 208
      * -1 - failed, error logged
202 209
 
203 210
    Example 1.4. cnxcc_set_max_time()
204 211
 ...
205
-$var(customer) = "john-doe-123-basic";
212
+$var(customer) = "john-doe-basic";
206 213
 $var(max_time) = 120;
207
-
208 214
 cnxcc_set_max_time("$var(customer)", "$var(max_time)");
209 215
 ...
210 216
 
211
-4.3.  cnxcc_update_max_time()
217
+4.3.  cnxcc_update_max_time(customer, maxtime)
212 218
 
213 219
    Updates max-time of an established and monitored call. This can be used
214 220
    to grant minimum values and to update them every short periods on time
215 221
    as a mean to prevent frauds and/or to mimic requested/granted units of
216 222
    time of Credit Control Application behavior.
217 223
 
224
+   The customer value can be provided as a string or a variable holding a
225
+   string.
226
+
227
+   The maxtime value is an integer values, it can be also given via a
228
+   variable holding an integer.
229
+
218 230
    Return code:
219 231
      * 1 - successful
220 232
      * -1 - failed, error logged
221 233
 
222 234
    Example 1.5. cnxcc_update_max_time()
223 235
 ...
224
-        $var(update_time)  = 5;
225
-        $var(client)       = "john-doe-123-basic";
236
+$var(client)       = "john-doe-basic";
237
+$var(update_time)  = 5;
226 238
 
227
-        if (!cnxcc_update_max_time("$var(client)",
228
-                                  "$var(update_time)")) {
229
-                xlog("Error updating max-time");
230
-                return;
239
+if (!cnxcc_update_max_time("$var(client)", "$var(update_time)")) {
240
+        xlog("Error updating max-time");
241
+        return;
231 242
         }
232
-
233 243
 ...
234 244
 
235
-4.4.  cnxcc_set_max_channel()
245
+4.4.  cnxcc_set_max_channel(customer, maxchan)
236 246
 
237
-   Specifies a limit for the number of simultaneous calls
247
+   Specifies a limit for the number of simultaneous calls.
248
+
249
+   The customer value can be provided as a string or a variable holding a
250
+   string.
251
+
252
+   The maxchan value is an integer values, it can be also given via a
253
+   variable holding an integer.
238 254
 
239 255
    Return code:
240 256
      * 1 - successful
... ...
@@ -265,12 +295,14 @@ if ($var(retcode) < -1) {
265 265
 
266 266
         exit;
267 267
 }
268
-
269 268
 ...
270 269
 
271
-4.5.  cnxcc_terminate_all()
270
+4.5.  cnxcc_terminate_all(customer)
271
+
272
+   Terminates all calls of the specified customer/profile.
272 273
 
273
-   Terminates all calls of the specified customer/profile
274
+   The customer value can be provided as a string or a variable holding a
275
+   string.
274 276
 
275 277
    Return code:
276 278
      * 1 - successful
... ...
@@ -299,7 +331,9 @@ if (!cnxcc_terminate_all("$var(customer)")) {
299 299
    Parameters: none
300 300
 
301 301
    Example:
302
-            kamcmd cnxcc.active_clients
302
+...
303
+kamcmd cnxcc.active_clients
304
+...
303 305
 
304 306
 5.2. cnxcc.check_client
305 307
 
... ...
@@ -308,7 +342,9 @@ if (!cnxcc_terminate_all("$var(customer)")) {
308 308
    Parameters: client/customer identifier
309 309
 
310 310
    Example:
311
-            kamcmd cnxcc.check_client john-doe-123-premium
311
+...
312
+kamcmd cnxcc.check_client john-doe-premium
313
+...
312 314
 
313 315
 5.3. cnxcc.kill_call
314 316
 
... ...
@@ -317,7 +353,9 @@ if (!cnxcc_terminate_all("$var(customer)")) {
317 317
    Parameters: Call-ID
318 318
 
319 319
    Example:
320
-            kamcmd cnxcc.kill_call qumojlaahitafih@carlosrdcnx-laptop.site
320
+....
321
+kamcmd cnxcc.kill_call test@carlosrdcnx-laptop.site
322
+...
321 323
 
322 324
 5.4. cnxcc.stats
323 325
 
... ...
@@ -326,7 +364,9 @@ if (!cnxcc_terminate_all("$var(customer)")) {
326 326
    Parameters: none
327 327
 
328 328
    Example:
329
-            kamcmd cnxcc.stats
329
+...
330
+kamcmd cnxcc.stats
331
+...
330 332
 
331 333
 6. Events
332 334
 
... ...
@@ -360,25 +400,23 @@ event_route[cnxcc:call-shutdown]
360 360
 ...
361 361
 route[CNXCC]
362 362
 {
363
-        $var(client)              = "test-client-0-123-01";
363
+        $var(client)              = "test-client";
364 364
         $var(credit)              = "50";
365 365
         $var(cost_per_sec)        = "0.5";
366
-        $var(i_pulse)             = "30";
367
-        $var(f_pulse)             = "6";
366
+        $var(i_pulse)             = 30;
367
+        $var(f_pulse)             = 6;
368 368
 
369 369
         if (!cnxcc_set_max_credit("$var(client)",
370
-                          "$var(credit)",
371
-                          "$var(cost_per_sec)",
372
-                          "$var(i_pulse)",
373
-                          "$var(f_pulse)")) {
374
-                 xlog("Error setting up credit control");
370
+                        "$var(credit)",
371
+                        "$var(cost_per_sec)",
372
+                        "$var(i_pulse)",
373
+                        "$var(f_pulse)")) {
374
+                xlog("Error setting up credit control");
375 375
         }
376 376
 }
377 377
 
378 378
 event_route[cnxcc:call-shutdown]
379 379
 {
380 380
         xlog("L_INFO", "[$ci]: call killed");
381
-
382
-
383 381
 }
384 382
 ...