README
1Statistics Module
2
3Bogdan Iancu
4
5 Voice Sistem SRL
6
7Edited by
8
9Bogdan Iancu
10
11 Copyright © 2006 Voice Sistem SRL
12 __________________________________________________________________
13
14 Table of Contents
15
16 1. Admin Guide
17
18 1. Overview
19 2. Dependencies
20
21 2.1. Kamailio Modules
22 2.2. External Libraries or Applications
23
24 3. Parameters
25
26 3.1. variable (string)
27
28 4. Functions
29
30 4.1. update_stat(variable,value)
31 4.2. reset_stat(variable)
32
33 List of Examples
34
35 1.1. variable example
36 1.2. update_stat usage
37 1.3. reset_stat usage
38
39Chapter 1. Admin Guide
40
41 Table of Contents
42
43 1. Overview
44 2. Dependencies
45
46 2.1. Kamailio Modules
47 2.2. External Libraries or Applications
48
49 3. Parameters
50
51 3.1. variable (string)
52
53 4. Functions
54
55 4.1. update_stat(variable,value)
56 4.2. reset_stat(variable)
57
581. Overview
59
60 The Statistics module is a wrapper over the internal statistics
61 manager, allowing the script writer to dynamically define and use of
62 statistic variables.
63
64 By bringing the statistics support into the script, it takes advantage
65 of the script flexibility in defining logics, making possible
66 implementation of any kind of statistic scenario.
67
682. Dependencies
69
70 2.1. Kamailio Modules
71 2.2. External Libraries or Applications
72
732.1. Kamailio Modules
74
75 The following modules must be loaded before this module:
76 * No dependencies on other Kamailio modules.
77
782.2. External Libraries or Applications
79
80 The following libraries or applications must be installed before
81 running Kamailio with this module loaded:
82 * None.
83
843. Parameters
85
86 3.1. variable (string)
87
883.1. variable (string)
89
90 Name of a new statistic variable. The name may be followed by
91 additional flag which describe the variable behavior:
92 * no_reset : variable cannot be reset.
93
94 Example 1.1. variable example
95modparam("statistics", "variable", "register_counter")
96modparam("statistics", "variable", "active_calls/no_reset")
97
984. Functions
99
100 4.1. update_stat(variable,value)
101 4.2. reset_stat(variable)
102
1034.1. update_stat(variable,value)
104
105 Updates the value of the statistic variable with the new value.
106
107 Meaning of the parameters is as follows:
108 * variable - variable to be updated (it can be a string or a
109 pseudovariable);
110 * value - value to update with; it may be also negative (it can be a
111 string or pseudovariable).
112
113 This function can be used from ANY_ROUTE.
114
115 Example 1.2. update_stat usage
116...
117update_stat("register_counter", "+1");
118...
119$var(a_calls) = "active_calls";
120update_stat("$var(a_calls)", "-1");
121...
122
1234.2. reset_stat(variable)
124
125 Resets to zero the value of the statistic variable.
126
127 Meaning of the parameters is as follows:
128 * variable - variable to be reset (it can be a string or a
129 pseudovariable).
130
131 This function can be used from REQUEST_ROUTE, BRANCH_ROUTE,
132 FAILURE_ROUTE and ONREPLY_ROUTE.
133
134 Example 1.3. reset_stat usage
135...
136reset_stat("register_counter");
137...
138$var(reg_counter) = "register_counter";
139update_stat("$var(reg_counter)");
140...
141