forked from OpenSIPS/opensips
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
309 lines (230 loc) · 9.94 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
mysql Module
__________________________________________________________
Table of Contents
1. Admin Guide
1.1. Overview
1.2. Dependencies
1.2.1. OpenSIPS Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
1.3.1. exec_query_threshold (integer)
1.3.2. timeout_interval (integer)
1.3.3. max_db_queries (integer)
1.3.4. max_db_retries (integer)
1.3.5. ps_max_col_size (integer)
1.3.6. use_tls (integer)
1.4. Exported Functions
1.5. Installation
1.6. Exported Events
1.6.1. E_MYSQL_CONNECTION
2. Contributors
2.1. By Commit Statistics
2.2. By Commit Activity
3. Documentation
3.1. Contributors
List of Tables
2.1. Top contributors by DevScore^(1), authored commits^(2) and
lines added/removed^(3)
2.2. Most recently active contributors^(1) to this module
List of Examples
1.1. Set exec_query_threshold parameter
1.2. Set timeout_interval parameter
1.3. Set max_db_queries parameter
1.4. Set max_db_retries parameter
1.5. Set ps_max_col_size parameter
1.6. Set the use_tls parameter
Chapter 1. Admin Guide
1.1. Overview
This is a module which provides MySQL connectivity for
OpenSIPS. It implements the DB API defined in OpenSIPS.
1.2. Dependencies
1.2.1. OpenSIPS Modules
The following modules must be loaded before this module:
* If a use_tls is defined, the tls_mgm module will need to be
loaded as well.
1.2.2. External Libraries or Applications
The following libraries or applications must be installed
before running OpenSIPS with this module loaded:
* libmysqlclient-dev - the development libraries of
mysql-client.
1.3. Exported Parameters
1.3.1. exec_query_threshold (integer)
If queries take longer than 'exec_query_threshold'
microseconds, warning messages will be written to logging
facility.
Default value is 0 - disabled.
Example 1.1. Set exec_query_threshold parameter
...
modparam("db_mysql", "exec_query_threshold", 60000)
...
1.3.2. timeout_interval (integer)
Time interval after which a connection attempt (read or write
request) is aborted. The value counts three times, as several
retries are done from the driver before it gives up.
The read timeout parameter is ignored on driver versions prior
to “5.1.12”, “5.0.25” and “4.1.22”. The write timeout parameter
is ignored on version prior to “5.1.12” and “5.0.25”, the “4.1”
release don't support it at all.
Default value is 2 (6 sec).
Example 1.2. Set timeout_interval parameter
...
modparam("db_mysql", "timeout_interval", 2)
...
1.3.3. max_db_queries (integer)
The maximum number of retries to execute a failed query due to
connections problems. If this parameter is set improperly, it
is set to default value.
Default value is 2.
Example 1.3. Set max_db_queries parameter
...
modparam("db_mysql", "max_db_queries", 2)
...
1.3.4. max_db_retries (integer)
The maximum number of database connection retries. If this
parameter is set improperly, it is set to default value.
Default value is 3.
Example 1.4. Set max_db_retries parameter
...
modparam("db_mysql", "max_db_retries", 2)
...
1.3.5. ps_max_col_size (integer)
The maximum size of a column's data, when fetched using
prepared statements. Particularly relevant for variable-length
data, such as CHAR, BLOB, etc.
NOTE: Should a column's data exceed this limit, the value will
be silently truncated to fit the buffer, without reporting any
errors!
Default value is 1024 (bytes).
Example 1.5. Set ps_max_col_size parameter
...
modparam("db_mysql", "ps_max_col_size", 4096)
...
1.3.6. use_tls (integer)
Setting this parameter will allow you to use TLS for MySQL
connections. In order to enable TLS for a specific connection,
you can use the "tls_domain=dom_name" URL parameter in the
db_url of the respective OpenSIPS module. This should be placed
at the end of the URL after the '?' character. Additionally,
the query string may include the "tls_opts=
PKEY,CERT,CA,CA_DIR,CIPHERS" CSV parameter, in order to
control/limit the amount of TLS options passed to the TLS
library.
When using this parameter, you must also ensure that tls_mgm is
loaded and properly configured. Refer to the the module for
additional info regarding TLS client domains.
Note that if you want to use this feature, the TLS domain must
be provisioned in the configuration file, NOT in the database.
In case you are loading TLS certificates from the database, you
must at least define one domain in the configuration script, to
use for the initial connection to the DB.
Also, you can NOT enable TLS for the connection to the database
of the tls_mgm module itself.
Default value is 0 (not enabled)
Example 1.6. Set the use_tls parameter
...
modparam("tls_mgm", "client_domain", "dom1")
modparam("tls_mgm", "certificate", "[dom1]/etc/pki/tls/certs/opensips.pe
m")
modparam("tls_mgm", "private_key", "[dom1]/etc/pki/tls/private/opensips.
key")
modparam("tls_mgm", "ca_list", "[dom1]/etc/pki/tls/certs/ca.pem")
...
modparam("db_mysql", "use_tls", 1)
...
modparam("usrloc", "db_url", "mysql://root:1234@localhost/opensips?tls_d
omain=dom1")
...
modparam("usrloc", "db_url", "mysql://root:1234@localhost/opensips?tls_d
omain=dom1&tls_opts=PKEY,CERT,CA,CA_DIR,CIPHERS")
...
1.4. Exported Functions
No function exported to be used from configuration file.
1.5. Installation
Because it dependes on an external library, the mysql module is
not compiled and installed by default. You can use one of the
next options.
* - edit the "Makefile" and remove "db_mysql" from
"excluded_modules" list. Then follow the standard procedure
to install OpenSIPS: "make all; make install".
* - from command line use: 'make all
include_modules="db_mysql"; make install
include_modules="db_mysql"'.
1.6. Exported Events
1.6.1. E_MYSQL_CONNECTION
This event is raised when a MySQL connection is lost or
recovered.
Parameters:
* url - the URL of the connection as specified by the db_url
parameter.
* status - connected if the connection recovered, or
disconnected if the connection was lost.
Chapter 2. Contributors
2.1. By Commit Statistics
Table 2.1. Top contributors by DevScore^(1), authored
commits^(2) and lines added/removed^(3)
Name DevScore Commits Lines ++ Lines --
1. Jan Janak (@janakj) 150 53 5336 3190
2. Bogdan-Andrei Iancu (@bogdan-iancu) 99 72 1574 793
3. Henning Westerholt (@henningw) 57 30 693 1239
4. Liviu Chircu (@liviuchircu) 44 35 582 207
5. Razvan Crainea (@razvancrainea) 29 24 246 66
6. Daniel-Constantin Mierla (@miconda) 28 20 571 154
7. Andrei Pelinescu-Onciul 16 14 52 49
8. Vlad Paiu (@vladpaiu) 15 12 185 25
9. Vlad Patrascu (@rvlad-patrascu) 12 8 179 78
10. Jiri Kuthan (@jiriatipteldotorg) 11 6 393 2
All remaining contributors: Nils Ohlmeier, Maksym Sobolyev
(@sobomax), Norman Brandinger (@NormB), Peter Lemenkov
(@lemenkov), Eseanu Marius Cristian (@eseanucristian), Dan
Pascu (@danpascu), Walter Doekes (@wdoekes), Ionut Ionita
(@ionutrazvanionita), Ovidiu Sas (@ovidiusas), Konstantin
Bokarius, Andreas Heise, Razvan Pistolea, Saúl Ibarra Corretgé
(@saghul), Sergio Gutierrez, Edson Gellert Schubert, Augusto
Caringi.
(1) DevScore = author_commits + author_lines_added /
(project_lines_added / project_commits) + author_lines_deleted
/ (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding
merge commits. Regarding imported patches/code, we do our best
to count the work on behalf of the proper owner, as per the
"fix_authors" and "mod_renames" arrays in
opensips/doc/build-contrib.sh. If you identify any
patches/commits which do not get properly attributed to you,
please submit a pull request which extends "fix_authors" and/or
"mod_renames".
(3) ignoring whitespace edits, renamed files and auto-generated
files
2.2. By Commit Activity
Table 2.2. Most recently active contributors^(1) to this module
Name Commit Activity
1. Liviu Chircu (@liviuchircu) Mar 2014 - Dec 2024
2. Razvan Crainea (@razvancrainea) Oct 2011 - Nov 2024
3. Bogdan-Andrei Iancu (@bogdan-iancu) Aug 2002 - Mar 2024
4. Vlad Paiu (@vladpaiu) Feb 2011 - Jul 2023
5. Maksym Sobolyev (@sobomax) Feb 2023 - Feb 2023
6. Vlad Patrascu (@rvlad-patrascu) Apr 2017 - May 2021
7. Walter Doekes (@wdoekes) Apr 2021 - Apr 2021
8. Peter Lemenkov (@lemenkov) Nov 2017 - Jun 2018
9. Augusto Caringi Jul 2017 - Jul 2017
10. Ovidiu Sas (@ovidiusas) Mar 2017 - Mar 2017
All remaining contributors: Ionut Ionita (@ionutrazvanionita),
Eseanu Marius Cristian (@eseanucristian), Saúl Ibarra Corretgé
(@saghul), Razvan Pistolea, Norman Brandinger (@NormB), Sergio
Gutierrez, Henning Westerholt (@henningw), Daniel-Constantin
Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert,
Andreas Heise, Jan Janak (@janakj), Andrei Pelinescu-Onciul,
Dan Pascu (@danpascu), Jiri Kuthan (@jiriatipteldotorg), Nils
Ohlmeier.
(1) including any documentation-related commits, excluding
merge commits
Chapter 3. Documentation
3.1. Contributors
Last edited by: Liviu Chircu (@liviuchircu), Vlad Patrascu
(@rvlad-patrascu), Razvan Crainea (@razvancrainea), Peter
Lemenkov (@lemenkov), Eseanu Marius Cristian (@eseanucristian),
Bogdan-Andrei Iancu (@bogdan-iancu), Vlad Paiu (@vladpaiu),
Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson
Gellert Schubert, Henning Westerholt (@henningw), Jan Janak
(@janakj).
Documentation Copyrights:
Copyright © 2006 Voice Sistem SRL