... | ... |
@@ -1,1444 +1 @@ |
1 |
-registrar Module |
|
2 | 1 |
|
3 |
-Jan Janak |
|
4 |
- |
|
5 |
- FhG FOKUS |
|
6 |
- <jan@iptel.org> |
|
7 |
- |
|
8 |
-Daniel-Constantin Mierla |
|
9 |
- |
|
10 |
- <miconda@gmail.com> |
|
11 |
- |
|
12 |
-Juha Heinanen |
|
13 |
- |
|
14 |
- <jh@tutpro.com> |
|
15 |
- |
|
16 |
-Olle E. Johansson |
|
17 |
- |
|
18 |
- Edvina AB |
|
19 |
- <oej@edvina.net> |
|
20 |
- |
|
21 |
-Edited by |
|
22 |
- |
|
23 |
-Jan Janak |
|
24 |
- |
|
25 |
- <jan@iptel.org> |
|
26 |
- |
|
27 |
-Bogdan-Andre Iancu |
|
28 |
- |
|
29 |
- Copyright © 2003 FhG FOKUS |
|
30 |
- __________________________________________________________________ |
|
31 |
- |
|
32 |
- Table of Contents |
|
33 |
- |
|
34 |
- 1. Admin Guide |
|
35 |
- |
|
36 |
- 1. Overview |
|
37 |
- |
|
38 |
- 1.1. PATH support |
|
39 |
- 1.2. GRUU Support |
|
40 |
- |
|
41 |
- 2. Dependencies |
|
42 |
- |
|
43 |
- 2.1. Kamailio Modules |
|
44 |
- 2.2. External Libraries or Applications |
|
45 |
- |
|
46 |
- 3. Parameters |
|
47 |
- |
|
48 |
- 3.1. default_expires (integer) |
|
49 |
- 3.2. default_expires_range (integer) |
|
50 |
- 3.3. expires_range (integer) |
|
51 |
- 3.4. min_expires (integer) |
|
52 |
- 3.5. min_expires_mode (integer) |
|
53 |
- 3.6. max_expires (integer) |
|
54 |
- 3.7. default_q (integer) |
|
55 |
- 3.8. realm_prefix (string) |
|
56 |
- 3.9. append_branches (integer) |
|
57 |
- 3.10. aor_avp (str) |
|
58 |
- 3.11. case_sensitive (integer) |
|
59 |
- 3.12. received_avp (str) |
|
60 |
- 3.13. received_param (string) |
|
61 |
- 3.14. max_contacts (integer) |
|
62 |
- 3.15. retry_after (integer) |
|
63 |
- 3.16. sock_flag (integer) |
|
64 |
- 3.17. sock_hdr_name (string) |
|
65 |
- 3.18. sock_mode (integer) |
|
66 |
- 3.19. method_filtering (integer) |
|
67 |
- 3.20. use_path (integer) |
|
68 |
- 3.21. path_mode (integer) |
|
69 |
- 3.22. path_use_received (integer) |
|
70 |
- 3.23. path_check_local (integer) |
|
71 |
- 3.24. reg_callid_avp (string) |
|
72 |
- 3.25. xavp_cfg (string) |
|
73 |
- 3.26. xavp_rcd (string) |
|
74 |
- 3.27. xavp_rcd_mask (int) |
|
75 |
- 3.28. gruu_enabled (integer) |
|
76 |
- 3.29. outbound_mode (integer) |
|
77 |
- 3.30. regid_mode (integer) |
|
78 |
- 3.31. flow_timer (integer) |
|
79 |
- 3.32. contact_max_size (integer) |
|
80 |
- 3.33. event_callback (str) |
|
81 |
- 3.34. lookup_filter_mode (int) |
|
82 |
- 3.35. use_expired_contacts (int) |
|
83 |
- |
|
84 |
- 4. Functions |
|
85 |
- |
|
86 |
- 4.1. save(domain, [, flags [, uri]]) |
|
87 |
- 4.2. lookup(domain [, uri]) |
|
88 |
- 4.3. lookup_to_dset(domain [, uri]) |
|
89 |
- 4.4. lookup_branches(domain) |
|
90 |
- 4.5. registered(domain [, uri [, match_option [, |
|
91 |
- match_action]]]) |
|
92 |
- |
|
93 |
- 4.6. add_sock_hdr(hdr_name) |
|
94 |
- 4.7. unregister(domain, uri[, ruid]) |
|
95 |
- 4.8. reg_fetch_contacts(domain, uri, profile) |
|
96 |
- 4.9. reg_free_contacts(profile) |
|
97 |
- 4.10. reg_send_reply() |
|
98 |
- |
|
99 |
- 5. Event Routes |
|
100 |
- |
|
101 |
- 5.1. event_route[usrloc:contact-expired] |
|
102 |
- |
|
103 |
- 6. Statistics |
|
104 |
- |
|
105 |
- 6.1. max_expires |
|
106 |
- 6.2. max_contacts |
|
107 |
- 6.3. default_expires |
|
108 |
- 6.4. accepted_regs |
|
109 |
- 6.5. rejected_regs |
|
110 |
- |
|
111 |
- 7. Pseudo Variables |
|
112 |
- |
|
113 |
- 7.1. $ulc(profile=>attr) |
|
114 |
- |
|
115 |
- 2. Frequently Asked Questions |
|
116 |
- |
|
117 |
- List of Examples |
|
118 |
- |
|
119 |
- 1.1. Set default_expires parameter |
|
120 |
- 1.2. Set default_expires_range parameter |
|
121 |
- 1.3. Set expires_range parameter |
|
122 |
- 1.4. Set min_expires parameter |
|
123 |
- 1.5. Set min_expires_mode parameter |
|
124 |
- 1.6. Set max_expires parameter |
|
125 |
- 1.7. Set default_q parameter |
|
126 |
- 1.8. Set realm_prefix parameter |
|
127 |
- 1.9. Set append_branches parameter |
|
128 |
- 1.10. Set case_sensitive parameter |
|
129 |
- 1.11. Set received_avp parameter |
|
130 |
- 1.12. Set received_param parameter |
|
131 |
- 1.13. Set max_contacts parameter |
|
132 |
- 1.14. Set retry_after parameter |
|
133 |
- 1.15. Set sock_flag parameter |
|
134 |
- 1.16. Set sock_hdr_name parameter |
|
135 |
- 1.17. Set sock_mode parameter |
|
136 |
- 1.18. Set method_filtering parameter |
|
137 |
- 1.19. Set use_path parameter |
|
138 |
- 1.20. Set path_mode parameter |
|
139 |
- 1.21. Set path_use_received parameter |
|
140 |
- 1.22. Set path_check_local parameter |
|
141 |
- 1.23. Set reg_callid_avp parameter |
|
142 |
- 1.24. Set xavp_cfg parameter |
|
143 |
- 1.25. Set xavp_rcd parameter |
|
144 |
- 1.26. Set xavp_rcd_mask parameter |
|
145 |
- 1.27. Set gruu_enabled parameter |
|
146 |
- 1.28. Set outbound_mode parameter |
|
147 |
- 1.29. Set regid_mode parameter |
|
148 |
- 1.30. Set flow_timer parameter |
|
149 |
- 1.31. Set contact_max_size parameter |
|
150 |
- 1.32. Set event_callback parameter |
|
151 |
- 1.33. Set xavp_cfg parameter |
|
152 |
- 1.34. Set use_expired_contacts parameter |
|
153 |
- 1.35. save usage |
|
154 |
- 1.36. lookup usage |
|
155 |
- 1.37. lookup_to_dset usage |
|
156 |
- 1.38. lookup_branches usage |
|
157 |
- 1.39. registered usage |
|
158 |
- 1.40. add_sock_hdr usage |
|
159 |
- 1.41. unregister usage |
|
160 |
- 1.42. reg_fetch_contacts usage |
|
161 |
- 1.43. reg_free_contacts usage |
|
162 |
- 1.44. reg_send_reply usage |
|
163 |
- 1.45. event_route[usrloc:contact-expired] usage |
|
164 |
- 1.46. $ulc(name) usage |
|
165 |
- |
|
166 |
-Chapter 1. Admin Guide |
|
167 |
- |
|
168 |
- Table of Contents |
|
169 |
- |
|
170 |
- 1. Overview |
|
171 |
- |
|
172 |
- 1.1. PATH support |
|
173 |
- 1.2. GRUU Support |
|
174 |
- |
|
175 |
- 2. Dependencies |
|
176 |
- |
|
177 |
- 2.1. Kamailio Modules |
|
178 |
- 2.2. External Libraries or Applications |
|
179 |
- |
|
180 |
- 3. Parameters |
|
181 |
- |
|
182 |
- 3.1. default_expires (integer) |
|
183 |
- 3.2. default_expires_range (integer) |
|
184 |
- 3.3. expires_range (integer) |
|
185 |
- 3.4. min_expires (integer) |
|
186 |
- 3.5. min_expires_mode (integer) |
|
187 |
- 3.6. max_expires (integer) |
|
188 |
- 3.7. default_q (integer) |
|
189 |
- 3.8. realm_prefix (string) |
|
190 |
- 3.9. append_branches (integer) |
|
191 |
- 3.10. aor_avp (str) |
|
192 |
- 3.11. case_sensitive (integer) |
|
193 |
- 3.12. received_avp (str) |
|
194 |
- 3.13. received_param (string) |
|
195 |
- 3.14. max_contacts (integer) |
|
196 |
- 3.15. retry_after (integer) |
|
197 |
- 3.16. sock_flag (integer) |
|
198 |
- 3.17. sock_hdr_name (string) |
|
199 |
- 3.18. sock_mode (integer) |
|
200 |
- 3.19. method_filtering (integer) |
|
201 |
- 3.20. use_path (integer) |
|
202 |
- 3.21. path_mode (integer) |
|
203 |
- 3.22. path_use_received (integer) |
|
204 |
- 3.23. path_check_local (integer) |
|
205 |
- 3.24. reg_callid_avp (string) |
|
206 |
- 3.25. xavp_cfg (string) |
|
207 |
- 3.26. xavp_rcd (string) |
|
208 |
- 3.27. xavp_rcd_mask (int) |
|
209 |
- 3.28. gruu_enabled (integer) |
|
210 |
- 3.29. outbound_mode (integer) |
|
211 |
- 3.30. regid_mode (integer) |
|
212 |
- 3.31. flow_timer (integer) |
|
213 |
- 3.32. contact_max_size (integer) |
|
214 |
- 3.33. event_callback (str) |
|
215 |
- 3.34. lookup_filter_mode (int) |
|
216 |
- 3.35. use_expired_contacts (int) |
|
217 |
- |
|
218 |
- 4. Functions |
|
219 |
- |
|
220 |
- 4.1. save(domain, [, flags [, uri]]) |
|
221 |
- 4.2. lookup(domain [, uri]) |
|
222 |
- 4.3. lookup_to_dset(domain [, uri]) |
|
223 |
- 4.4. lookup_branches(domain) |
|
224 |
- 4.5. registered(domain [, uri [, match_option [, match_action]]]) |
|
225 |
- 4.6. add_sock_hdr(hdr_name) |
|
226 |
- 4.7. unregister(domain, uri[, ruid]) |
|
227 |
- 4.8. reg_fetch_contacts(domain, uri, profile) |
|
228 |
- 4.9. reg_free_contacts(profile) |
|
229 |
- 4.10. reg_send_reply() |
|
230 |
- |
|
231 |
- 5. Event Routes |
|
232 |
- |
|
233 |
- 5.1. event_route[usrloc:contact-expired] |
|
234 |
- |
|
235 |
- 6. Statistics |
|
236 |
- |
|
237 |
- 6.1. max_expires |
|
238 |
- 6.2. max_contacts |
|
239 |
- 6.3. default_expires |
|
240 |
- 6.4. accepted_regs |
|
241 |
- 6.5. rejected_regs |
|
242 |
- |
|
243 |
- 7. Pseudo Variables |
|
244 |
- |
|
245 |
- 7.1. $ulc(profile=>attr) |
|
246 |
- |
|
247 |
-1. Overview |
|
248 |
- |
|
249 |
- 1.1. PATH support |
|
250 |
- 1.2. GRUU Support |
|
251 |
- |
|
252 |
- The module contains REGISTER processing logic. The actual location |
|
253 |
- database is managed by the USRLOC module. |
|
254 |
- |
|
255 |
-1.1. PATH support |
|
256 |
- |
|
257 |
- The Register module includes Path support (according to RFC 3327) for |
|
258 |
- usage in registrars and home-proxies. |
|
259 |
- |
|
260 |
- If path support is enabled in the registrar module, a call to save(...) |
|
261 |
- stores the values of the Path Header(s) along with the contact into |
|
262 |
- usrloc. There are three modes regarding the reply to a REGISTER |
|
263 |
- including one or more Path header fields: |
|
264 |
- * off - stores the value of the Path headers into usrloc without |
|
265 |
- passing it back to the UAC in the reply. |
|
266 |
- * lazy - stores the Path header and passes it back to the UAC if |
|
267 |
- Path-support is indicated by the “path” param in the Supported |
|
268 |
- header field. |
|
269 |
- * strict - rejects the registration with “420 Bad Extension” if |
|
270 |
- there's a Path header but no support for it is indicated by the |
|
271 |
- UAC. Otherwise it's stored and passed back to the UAC. |
|
272 |
- |
|
273 |
- A call to lookup(...) always uses the path header if found, and inserts |
|
274 |
- it as Route header field either in front of the first Route header |
|
275 |
- field, or after the last Via header field if no Route is present. It |
|
276 |
- also sets the destination uri to the first Path uri, thus overwriting |
|
277 |
- the received-uri, because NAT has to be handled at the outbound-proxy |
|
278 |
- of the UAC (the first hop after client's NAT). |
|
279 |
- |
|
280 |
- The whole process is transparent to the user, so no config changes are |
|
281 |
- required beside setting the registrar-parameters “use_path” and |
|
282 |
- “path_mode”. |
|
283 |
- |
|
284 |
-1.2. GRUU Support |
|
285 |
- |
|
286 |
- GRUU (RFC5627) is supported with both public and temporary addresses. |
|
287 |
- |
|
288 |
- The public GRUU is build based on the '+sip.instance' UUID parameter as |
|
289 |
- recommended by RFC. |
|
290 |
- |
|
291 |
- The temporary GRUU is built based on internal SRUID (unique id |
|
292 |
- generator) and it is kept the same for the duration of contact |
|
293 |
- validity. |
|
294 |
- |
|
295 |
-2. Dependencies |
|
296 |
- |
|
297 |
- 2.1. Kamailio Modules |
|
298 |
- 2.2. External Libraries or Applications |
|
299 |
- |
|
300 |
-2.1. Kamailio Modules |
|
301 |
- |
|
302 |
- The following modules must be loaded before this module: |
|
303 |
- * usrloc - User Location Module. |
|
304 |
- * sl - Stateless Replies. |
|
305 |
- |
|
306 |
-2.2. External Libraries or Applications |
|
307 |
- |
|
308 |
- The following libraries or applications must be installed before |
|
309 |
- running Kamailio with this module loaded: |
|
310 |
- * None. |
|
311 |
- |
|
312 |
-3. Parameters |
|
313 |
- |
|
314 |
- 3.1. default_expires (integer) |
|
315 |
- 3.2. default_expires_range (integer) |
|
316 |
- 3.3. expires_range (integer) |
|
317 |
- 3.4. min_expires (integer) |
|
318 |
- 3.5. min_expires_mode (integer) |
|
319 |
- 3.6. max_expires (integer) |
|
320 |
- 3.7. default_q (integer) |
|
321 |
- 3.8. realm_prefix (string) |
|
322 |
- 3.9. append_branches (integer) |
|
323 |
- 3.10. aor_avp (str) |
|
324 |
- 3.11. case_sensitive (integer) |
|
325 |
- 3.12. received_avp (str) |
|
326 |
- 3.13. received_param (string) |
|
327 |
- 3.14. max_contacts (integer) |
|
328 |
- 3.15. retry_after (integer) |
|
329 |
- 3.16. sock_flag (integer) |
|
330 |
- 3.17. sock_hdr_name (string) |
|
331 |
- 3.18. sock_mode (integer) |
|
332 |
- 3.19. method_filtering (integer) |
|
333 |
- 3.20. use_path (integer) |
|
334 |
- 3.21. path_mode (integer) |
|
335 |
- 3.22. path_use_received (integer) |
|
336 |
- 3.23. path_check_local (integer) |
|
337 |
- 3.24. reg_callid_avp (string) |
|
338 |
- 3.25. xavp_cfg (string) |
|
339 |
- 3.26. xavp_rcd (string) |
|
340 |
- 3.27. xavp_rcd_mask (int) |
|
341 |
- 3.28. gruu_enabled (integer) |
|
342 |
- 3.29. outbound_mode (integer) |
|
343 |
- 3.30. regid_mode (integer) |
|
344 |
- 3.31. flow_timer (integer) |
|
345 |
- 3.32. contact_max_size (integer) |
|
346 |
- 3.33. event_callback (str) |
|
347 |
- 3.34. lookup_filter_mode (int) |
|
348 |
- 3.35. use_expired_contacts (int) |
|
349 |
- |
|
350 |
-3.1. default_expires (integer) |
|
351 |
- |
|
352 |
- If the processed message contains neither Expires header fields nor |
|
353 |
- expires contact parameters, this value will be used for newly created |
|
354 |
- usrloc records. The parameter contains number of second to expire (for |
|
355 |
- example use 3600 for one hour). If it is set to a lower value than the |
|
356 |
- “min_expires” parameter then it will be ignored. This parameter can be |
|
357 |
- modified via ser config framework. A random value in a specific |
|
358 |
- interval can be selected by using the default_expires_range parameter |
|
359 |
- |
|
360 |
- Default value is 3600. |
|
361 |
- |
|
362 |
- Example 1.1. Set default_expires parameter |
|
363 |
-... |
|
364 |
-modparam("registrar", "default_expires", 1800) |
|
365 |
-... |
|
366 |
- |
|
367 |
-3.2. default_expires_range (integer) |
|
368 |
- |
|
369 |
- This parameter specifies that the expiry used for newly created usrloc |
|
370 |
- records are not fixed, but a random value in the interval |
|
371 |
- “[default_expires-default_expires_range%, default_expires]”. The value |
|
372 |
- is between 0 and 100 and represent the maximum percentage from expires |
|
373 |
- that will be subtracted when computing the value. Default is 0, meaning |
|
374 |
- default_expires is left unmodified. This parameter can be modified via |
|
375 |
- the Kamailio config framework. |
|
376 |
- |
|
377 |
- Default value is 0. |
|
378 |
- |
|
379 |
- Example 1.2. Set default_expires_range parameter |
|
380 |
-... |
|
381 |
-modparam("registrar", "default_expires_range", 30) # +- 30% from default_expires |
|
382 |
-... |
|
383 |
- |
|
384 |
-3.3. expires_range (integer) |
|
385 |
- |
|
386 |
- Similar to default_expires_range, but it applies to the incoming |
|
387 |
- expires value. Default in 0, meaning the expires is left unmodified. |
|
388 |
- This parameter can be modified via the Kamailio config framework. |
|
389 |
- |
|
390 |
- Default value is 0. |
|
391 |
- |
|
392 |
- Example 1.3. Set expires_range parameter |
|
393 |
-... |
|
394 |
-modparam("registrar", "expires_range", 30) # expires within [0.7*expires .. expi |
|
395 |
-res] |
|
396 |
-... |
|
397 |
- |
|
398 |
-3.4. min_expires (integer) |
|
399 |
- |
|
400 |
- The minimum expires value of a “Contact”. Values lower than this |
|
401 |
- minimum will be either set to the minimum or 423 response is sent back. |
|
402 |
- Value 0 disables the checking. This parameter can be modified via the |
|
403 |
- Kamailio config framework. |
|
404 |
- |
|
405 |
- Default value is 60. |
|
406 |
- |
|
407 |
- Example 1.4. Set min_expires parameter |
|
408 |
-... |
|
409 |
-modparam("registrar", "min_expires", 60) |
|
410 |
-... |
|
411 |
- |
|
412 |
-3.5. min_expires_mode (integer) |
|
413 |
- |
|
414 |
- Control what to do when expires value in REGISTER request is lower than |
|
415 |
- min_expires parameter. If set to 0, expires is set to min_expires. If |
|
416 |
- set to 1, then 423 Interval Too Brief is sent back. |
|
417 |
- |
|
418 |
- Default value is 0. |
|
419 |
- |
|
420 |
- Example 1.5. Set min_expires_mode parameter |
|
421 |
-... |
|
422 |
-modparam("registrar", "min_expires_mode", 1) |
|
423 |
-... |
|
424 |
- |
|
425 |
-3.6. max_expires (integer) |
|
426 |
- |
|
427 |
- The maximum accepted expires value of a “Contact”, values higher than |
|
428 |
- this maximum will be automatically set to the maximum. Value 0 disables |
|
429 |
- the checking. This parameter can be modified via the Kamailio config |
|
430 |
- framework. |
|
431 |
- |
|
432 |
- Default value is 0. |
|
433 |
- |
|
434 |
- Example 1.6. Set max_expires parameter |
|
435 |
-... |
|
436 |
-modparam("registrar", "max_expires", 120) |
|
437 |
-... |
|
438 |
- |
|
439 |
-3.7. default_q (integer) |
|
440 |
- |
|
441 |
- The parameter represents default “q” value for new contacts. Because |
|
442 |
- Kamailio doesn't support float parameter types, the value in the |
|
443 |
- parameter is divided by 1000 and stored as float. For example, if you |
|
444 |
- want default_q to be 0.38, use value 380 here. This parameter can be |
|
445 |
- modified via the Kamailio config framework. |
|
446 |
- |
|
447 |
- Default value is 0. |
|
448 |
- |
|
449 |
- Example 1.7. Set default_q parameter |
|
450 |
-... |
|
451 |
-modparam("registrar", "default_q", 1000) |
|
452 |
-... |
|
453 |
- |
|
454 |
-3.8. realm_prefix (string) |
|
455 |
- |
|
456 |
- Prefix to be automatically stripped from realm. As an alternative to |
|
457 |
- SRV records (not all SIP clients support SRV lookup), a subdomain of |
|
458 |
- the master domain can be defined for SIP purposes (like |
|
459 |
- sip.mydomain.net pointing to same IP address as the SRV record for |
|
460 |
- mydomain.net). By ignoring the realm_prefix "sip.", at registration, |
|
461 |
- sip.mydomain.net will be equivalent to mydomain.net. This parameter can |
|
462 |
- be modified via the Kamailio config framework. |
|
463 |
- |
|
464 |
- Default value is NULL (none). |
|
465 |
- |
|
466 |
- Example 1.8. Set realm_prefix parameter |
|
467 |
-... |
|
468 |
-modparam("registrar", "realm_prefix", "sip.") |
|
469 |
-... |
|
470 |
- |
|
471 |
-3.9. append_branches (integer) |
|
472 |
- |
|
473 |
- The parameter controls how lookup function processes multiple contacts. |
|
474 |
- If there are multiple contacts for the given username in usrloc and |
|
475 |
- this parameter is set to 1, Request-URI will be overwritten with the |
|
476 |
- highest-q rated contact and the rest will be appended to sip_msg |
|
477 |
- structure and can be later used by tm for forking. If the parameter is |
|
478 |
- set to 0, only Request-URI will be overwritten with the highest-q rated |
|
479 |
- contact and the rest will be left unprocessed. This parameter can be |
|
480 |
- modified via Kamailio config framework. |
|
481 |
- |
|
482 |
- Default value is 1. |
|
483 |
- |
|
484 |
- Example 1.9. Set append_branches parameter |
|
485 |
-... |
|
486 |
-modparam("registrar", "append_branches", 0) |
|
487 |
-... |
|
488 |
- |
|
489 |
-3.10. aor_avp (str) |
|
490 |
- |
|
491 |
- This module parameter has been removed. Use the 'uri' parameter from |
|
492 |
- functions (e.g., save, lookup, registered). |
|
493 |
- |
|
494 |
-3.11. case_sensitive (integer) |
|
495 |
- |
|
496 |
- If set to 1 then AOR comparison and also storing will be case |
|
497 |
- sensitive, if set to 0 then AOR comparison and storing will be case |
|
498 |
- insensitive. This is recommended. This parameter can be modified via |
|
499 |
- Kamailio config framework. |
|
500 |
- |
|
501 |
- Default value is 0. |
|
502 |
- |
|
503 |
- Example 1.10. Set case_sensitive parameter |
|
504 |
-... |
|
505 |
-modparam("registrar", "case_sensitive", 1) |
|
506 |
-... |
|
507 |
- |
|
508 |
-3.12. received_avp (str) |
|
509 |
- |
|
510 |
- Registrar will store the value of the AVP configured by this parameter |
|
511 |
- in the received column in the user location database. It will leave the |
|
512 |
- column empty if the AVP is empty. The AVP should contain a SIP URI |
|
513 |
- consisting of the source IP, port, and transport protocol of the |
|
514 |
- REGISTER message being processed. |
|
515 |
- |
|
516 |
-Note |
|
517 |
- |
|
518 |
- The value of this parameter should be the same as the value of |
|
519 |
- corresponding parameter of nathelper module. |
|
520 |
- |
|
521 |
- Default value is "NULL" (disabled). |
|
522 |
- |
|
523 |
- Example 1.11. Set received_avp parameter |
|
524 |
-... |
|
525 |
-modparam("registrar", "received_avp", "$avp(s:rcv)") |
|
526 |
-... |
|
527 |
- |
|
528 |
-3.13. received_param (string) |
|
529 |
- |
|
530 |
- The name of the parameter that will be appended to Contact URI's of 200 |
|
531 |
- OK when the received URI was set by the “nathelper” module. If the |
|
532 |
- value is an empty string, then the parameter is not appended anymore. |
|
533 |
- |
|
534 |
- Default value is "received". |
|
535 |
- |
|
536 |
- Example 1.12. Set received_param parameter |
|
537 |
-... |
|
538 |
-modparam("registrar", "received_param", "rcv") |
|
539 |
-... |
|
540 |
- |
|
541 |
-3.14. max_contacts (integer) |
|
542 |
- |
|
543 |
- The parameter can be used to limit the number of contacts per AOR |
|
544 |
- (Address of Record) in the user location database. If the maximum |
|
545 |
- number of contacts is exceeded, Kamailio will not accept the |
|
546 |
- registration and send an error response. Value 0 disables the check. |
|
547 |
- This parameter can be modified via the Kamailio config framework. |
|
548 |
- (Please also check the flag for save() if you only want only one active |
|
549 |
- registration). |
|
550 |
- |
|
551 |
- Default value is 0. |
|
552 |
- |
|
553 |
- Example 1.13. Set max_contacts parameter |
|
554 |
-... |
|
555 |
-# Allow no more than 10 contacts per AOR |
|
556 |
-modparam("registrar", "max_contacts", 10) |
|
557 |
-... |
|
558 |
- |
|
559 |
-3.15. retry_after (integer) |
|
560 |
- |
|
561 |
- The registrar can generate a 5xx reply to REGISTER requests in various |
|
562 |
- situations. It can, for example, happen when the max_contacts parameter |
|
563 |
- is set and the processing of REGISTER request would exceed the limit. |
|
564 |
- In this case the registrar would generate "503 Service Unavailable" |
|
565 |
- response. This parameter can be modified via the Kamailio config |
|
566 |
- framework. |
|
567 |
- |
|
568 |
- If you want to add the Retry-After header field in 5xx replies, set |
|
569 |
- this parameter to a value grater than zero (0 means do not add the |
|
570 |
- header field). See section 20.33 of RFC3261 for more details. |
|
571 |
- |
|
572 |
- Default value is 0 (disabled). |
|
573 |
- |
|
574 |
- Example 1.14. Set retry_after parameter |
|
575 |
-... |
|
576 |
-modparam("registrar", "retry_after", 30) |
|
577 |
-... |
|
578 |
- |
|
579 |
-3.16. sock_flag (integer) |
|
580 |
- |
|
581 |
- Message flag to signal to the registrar module to look into REGISTER |
|
582 |
- request for a header which contains a socket description (IP:port). |
|
583 |
- This socket info will be stored by registrar instead of the received |
|
584 |
- socket info. |
|
585 |
- |
|
586 |
- This makes sense only in multiple replicated servers scenarios. |
|
587 |
- |
|
588 |
- Default value is -1 (no flag). |
|
589 |
- |
|
590 |
- Example 1.15. Set sock_flag parameter |
|
591 |
-... |
|
592 |
-modparam("registrar", "sock_flag", 18) |
|
593 |
-... |
|
594 |
- |
|
595 |
-3.17. sock_hdr_name (string) |
|
596 |
- |
|
597 |
- Header which contains a socket description (proto:IP:port) to override |
|
598 |
- the received socket info. The header will be read only if the flag |
|
599 |
- sock_flag is set. |
|
600 |
- |
|
601 |
- This makes sense only in multiple replicated servers scenarios. |
|
602 |
- |
|
603 |
- Default value is NULL. |
|
604 |
- |
|
605 |
- Example 1.16. Set sock_hdr_name parameter |
|
606 |
-... |
|
607 |
-modparam("registrar", "sock_hdr_name", "Sock-Info") |
|
608 |
-... |
|
609 |
- |
|
610 |
-3.18. sock_mode (integer) |
|
611 |
- |
|
612 |
- If set to 1, the server stores the advertised address in socket field, |
|
613 |
- instead of bind address. |
|
614 |
- |
|
615 |
- This could be useful when kamailio is installed behind NAT and it is |
|
616 |
- necessary to store its public IP instead socket on which the register |
|
617 |
- request was received. |
|
618 |
- |
|
619 |
- Default value is 0 (store bind address). |
|
620 |
- |
|
621 |
- Example 1.17. Set sock_mode parameter |
|
622 |
-... |
|
623 |
-modparam("registrar", "sock_mode", 1) |
|
624 |
-... |
|
625 |
- |
|
626 |
-3.19. method_filtering (integer) |
|
627 |
- |
|
628 |
- Tells if the contact filtering based on supported methods should be |
|
629 |
- performed during lookup on initial requests without to-tag. It's |
|
630 |
- enabled only if it has a non zero value. Supported methods are listed |
|
631 |
- in the “Allow:” header in the REGISTER message and stored in the |
|
632 |
- location database. |
|
633 |
- |
|
634 |
- Default value is 0 (disabled). |
|
635 |
- |
|
636 |
- Example 1.18. Set method_filtering parameter |
|
637 |
-... |
|
638 |
-modparam("registrar", "method_filtering", 1) |
|
639 |
-... |
|
640 |
- |
|
641 |
-3.20. use_path (integer) |
|
642 |
- |
|
643 |
- If set to 1, the “Path:” header is handled according to the parameter |
|
644 |
- This parameter can be modified via Kamailio config framework. |
|
645 |
- “path_mode”. |
|
646 |
- |
|
647 |
- Default value is 0 (disabled). |
|
648 |
- |
|
649 |
- Example 1.19. Set use_path parameter |
|
650 |
-... |
|
651 |
-modparam("registrar", "use_path", 1) |
|
652 |
-... |
|
653 |
- |
|
654 |
-3.21. path_mode (integer) |
|
655 |
- |
|
656 |
- The registrar module implements three different modes regarding the |
|
657 |
- response to a registration which includes one or more Path headers: |
|
658 |
- * 0 - The Path header is saved into usrloc, but is not included in |
|
659 |
- the reply. |
|
660 |
- * 1 - The Path header is saved into usrloc, but is only included in |
|
661 |
- the reply if path support is indicated in the registration request |
|
662 |
- by the “path” option in the “Supported:” header. |
|
663 |
- * 2 - The path header is only saved into usrloc, if path support is |
|
664 |
- indicated in the registration request by the “path” option of the |
|
665 |
- “Supported” header. If no path support is indicated, the request is |
|
666 |
- rejected with “420 - Bad Extension” and the header “Unsupported: |
|
667 |
- path” is included in the reply along with the received “Path” |
|
668 |
- header. This mode is the one recommended by RFC-3327. |
|
669 |
- |
|
670 |
- Default value is 2. |
|
671 |
- |
|
672 |
- Example 1.20. Set path_mode parameter |
|
673 |
-... |
|
674 |
-modparam("registrar", "path_mode", 0) |
|
675 |
-... |
|
676 |
- |
|
677 |
-3.22. path_use_received (integer) |
|
678 |
- |
|
679 |
- If set to 1, the “received” parameter of the first Path URI of a |
|
680 |
- registration is set as received-uri and the NAT branch flag is set for |
|
681 |
- this contact. This is useful if the registrar is placed behind a SIP |
|
682 |
- loadbalancer, which passes the nat'ed UAC address as “received” |
|
683 |
- parameter in it's Path uri. |
|
684 |
- |
|
685 |
- Default value is 0 (disabled). |
|
686 |
- |
|
687 |
- Example 1.21. Set path_use_received parameter |
|
688 |
-... |
|
689 |
-modparam("registrar", "path_use_received", 1) |
|
690 |
-... |
|
691 |
- |
|
692 |
-3.23. path_check_local (integer) |
|
693 |
- |
|
694 |
- If set to 1, when performing a lookup the Path (if present) is |
|
695 |
- evaluated and if the first hop is local (according to “myself” test), |
|
696 |
- we skip it to avoid unnecessary looping. |
|
697 |
- |
|
698 |
- This is useful if multiple servers are sharing a common location |
|
699 |
- database, each saving contacts with their local address as the Path. |
|
700 |
- |
|
701 |
- Default value is 0 (disabled). |
|
702 |
- |
|
703 |
- Example 1.22. Set path_check_local parameter |
|
704 |
-... |
|
705 |
-modparam("registrar", "path_check_local", 1) |
|
706 |
-... |
|
707 |
- |
|
708 |
-3.24. reg_callid_avp (string) |
|
709 |
- |
|
710 |
- obsolete. use match_option in registered function |
|
711 |
- |
|
712 |
- If reg_callid_avp is defined and populated when the registered() is |
|
713 |
- invoked, the result is TRUE only if an active registration with the |
|
714 |
- specified callID is found. |
|
715 |
- |
|
716 |
- Default value is NULL (disabled). |
|
717 |
- |
|
718 |
- Example 1.23. Set reg_callid_avp parameter |
|
719 |
-... |
|
720 |
-modparam("registrar", "reg_callid_avp", "$avp(s:avp)") |
|
721 |
-... |
|
722 |
- |
|
723 |
-3.25. xavp_cfg (string) |
|
724 |
- |
|
725 |
- Defines the name of XAVP class to store runtime module config values. |
|
726 |
- The values are stored as inner XAVPs, like $xavp(class=>attribute). |
|
727 |
- Valid inner XAVP names: |
|
728 |
- * match_callid - filter contacts by callid. Used in registered(). |
|
729 |
- * match_contact - filter contacts by contact. Used in registered(). |
|
730 |
- * match_received - filter contacts by received. Used in registered(). |
|
731 |
- * rlf_bflags - filter contacts by branch flags. Used in lookup(). |
|
732 |
- * q - q value of contact (integer 0-1000). It overrides q value given |
|
733 |
- in contact header and default_q parameter. Used in save(). |
|
734 |
- * expires - the expires value, to overwrite the value from SIP |
|
735 |
- headers. Used in save(). |
|
736 |
- * max_contacts - the number of maximum contacts to be stored for the |
|
737 |
- current registration AoR. It overwrites the 'max_contacts' module |
|
738 |
- parameter value. Used in save(). |
|
739 |
- * socket - the string representing the socket on which the register |
|
740 |
- request was received, as alternative to using the sock_hdr. Used in |
|
741 |
- save(). |
|
742 |
- |
|
743 |
- For example. if this parameter is set to 'reg', then the number of |
|
744 |
- maximum contacts can be set in $xavp(reg=>max_contacts). |
|
745 |
- |
|
746 |
- Default value is NULL (disabled). |
|
747 |
- |
|
748 |
- Example 1.24. Set xavp_cfg parameter |
|
749 |
-... |
|
750 |
-modparam("registrar", "xavp_cfg", "reg") |
|
751 |
-... |
|
752 |
-request_route { |
|
753 |
- ... |
|
754 |
- $xavp(reg=>max_contacts) = 4; |
|
755 |
- $xavp(reg[0]=>expires) = 600; |
|
756 |
- save("location"); |
|
757 |
- ... |
|
758 |
-} |
|
759 |
-... |
|
760 |
- |
|
761 |
-3.26. xavp_rcd (string) |
|
762 |
- |
|
763 |
- Defines the name of XAVP class to store details from the location |
|
764 |
- records. The values are stored as inner XAVPs, like |
|
765 |
- $xavp(class[0]=>attribute). Valid inner XAVP names: |
|
766 |
- * ruid - the record's internal unique id. |
|
767 |
- * contact - the record's contact value. |
|
768 |
- * expires - the record's expires value. |
|
769 |
- * received - the record's received value. |
|
770 |
- * path - the record's path value. |
|
771 |
- |
|
772 |
- For example. if this parameter is set to 'ulrcd', then values are set |
|
773 |
- in: |
|
774 |
- * $xavp(ulrcd[0]=>ruid) |
|
775 |
- * $xavp(ulrcd[0]=>contact) |
|
776 |
- * $xavp(ulrcd[0]=>received) |
|
777 |
- * $xavp(ulrcd[0]=>path) |
|
778 |
- |
|
779 |
- Default value is NULL (disabled). |
|
780 |
- |
|
781 |
- Example 1.25. Set xavp_rcd parameter |
|
782 |
-... |
|
783 |
-modparam("registrar", "xavp_rcd", "ulrcd") |
|
784 |
-... |
|
785 |
- |
|
786 |
-3.27. xavp_rcd_mask (int) |
|
787 |
- |
|
788 |
- Defines what values to skip when xavp_rcd is stored. |
|
789 |
- * 1 - ruid |
|
790 |
- * 2 - contact |
|
791 |
- * 4 - expires |
|
792 |
- * 8 - received |
|
793 |
- * 16 - path |
|
794 |
- |
|
795 |
- Default value is 0 (none). |
|
796 |
- |
|
797 |
- Example 1.26. Set xavp_rcd_mask parameter |
|
798 |
-... |
|
799 |
-# skip path value |
|
800 |
-modparam("registrar", "xavp_rcd_mask", 16) |
|
801 |
-... |
|
802 |
-# skip path and expires values |
|
803 |
-modparam("registrar", "xavp_rcd_mask", 20) |
|
804 |
-... |
|
805 |
- |
|
806 |
-3.28. gruu_enabled (integer) |
|
807 |
- |
|
808 |
- If set to 1 and the “+sip.instance” parameter to Contact header of |
|
809 |
- REGISTER is present, then the value of the parameter is saved to |
|
810 |
- location and pub-gruu and temp-gruu addresses are generated. |
|
811 |
- |
|
812 |
- Set it to 0 if you want to ignore GRUU extensions in REGISTER. |
|
813 |
- |
|
814 |
- Default value is 1 (enabled). |
|
815 |
- |
|
816 |
- Example 1.27. Set gruu_enabled parameter |
|
817 |
-... |
|
818 |
-modparam("registrar", "gruu_enabled", 0) |
|
819 |
-... |
|
820 |
- |
|
821 |
-3.29. outbound_mode (integer) |
|
822 |
- |
|
823 |
- If set to 0 this module will accept REGISTER requests that do not |
|
824 |
- contain a “Supported:” header with the outbound options-tag. The 200 OK |
|
825 |
- response to REGISTER requests that this module generates will not |
|
826 |
- contain “Require:” or “Supported:” headers with the outbound |
|
827 |
- options-tag. If the client has a “Require:” header with the outbound |
|
828 |
- options tag the REGISTER will be rejected with a “420 Bad Extension” |
|
829 |
- response. |
|
830 |
- |
|
831 |
- If set to 1 this module will accept REGISTER requests that do not |
|
832 |
- contain a “Supported:” header with the outbound options-tag and |
|
833 |
- REGISTER requests that do contain a Supported: or Requires: header with |
|
834 |
- the outbound options-tag. When the client supports outbound the |
|
835 |
- appropriate RFC5626 procedures will be followed. |
|
836 |
- |
|
837 |
- If set to 2 this module will reject REGISTER requests that do not |
|
838 |
- contain a “Supported:” header with the outbound options-tag. When the |
|
839 |
- client supports outbound the appropriate RFC5626 procedures will be |
|
840 |
- followed. |
|
841 |
- |
|
842 |
- Default value is 0. |
|
843 |
- |
|
844 |
- Example 1.28. Set outbound_mode parameter |
|
845 |
-... |
|
846 |
-modparam("registrar", "outbound_mode", 2) |
|
847 |
-... |
|
848 |
- |
|
849 |
-3.30. regid_mode (integer) |
|
850 |
- |
|
851 |
- If set to 0 this module will ignore the “regid” contact param when |
|
852 |
- saving REGISTER request if the request does not indicate support for |
|
853 |
- outbound. |
|
854 |
- |
|
855 |
- If set to 1 this module will use “regid” contact param (if present) |
|
856 |
- when saving REGISTER request even if REGISTER request does not indicate |
|
857 |
- support for outbound. |
|
858 |
- |
|
859 |
- Default value is 0. |
|
860 |
- |
|
861 |
- Example 1.29. Set regid_mode parameter |
|
862 |
-... |
|
863 |
-modparam("registrar", "regid_mode", 1) |
|
864 |
-... |
|
865 |
- |
|
866 |
-3.31. flow_timer (integer) |
|
867 |
- |
|
868 |
- If set to 0 then this module will not add a “Flow-Timer:” header to 200 |
|
869 |
- OK responses to REGISTER requests. |
|
870 |
- |
|
871 |
- If set to > 0 then this module will add a “Flow-Timer:” header |
|
872 |
- containing this value to 200 OK responses to REGISTER requests. This |
|
873 |
- parameter may only be set to a value > 0 when outbound_mode is set to 1 |
|
874 |
- or 2. |
|
875 |
- |
|
876 |
- When set to a value greater than 0 this parameter should be set to |
|
877 |
- slightly less than the connection timeout value between the UAC and the |
|
878 |
- network (this corresponds to the core tcp_connection_lifetime option |
|
879 |
- and websocket keepalive_timeout modparam). This parameter is most |
|
880 |
- useful when you have a single edge proxy/registrar or if you have an |
|
881 |
- edge proxy that cannot modify responses. If you are using a separate |
|
882 |
- edge proxy you should consider leaving this parameter set to 0 and |
|
883 |
- adding the “Flow-Timer:” header on the edge proxy as this allows you to |
|
884 |
- keep all of the timer values for a specific flow in one configuration. |
|
885 |
- |
|
886 |
- Default value is 0. |
|
887 |
- |
|
888 |
- Example 1.30. Set flow_timer parameter |
|
889 |
-... |
|
890 |
-modparam("registrar", "flow_timer", 25) |
|
891 |
-... |
|
892 |
- |
|
893 |
-3.32. contact_max_size (integer) |
|
894 |
- |
|
895 |
- Max size of URIs in “Contact:” header. |
|
896 |
- |
|
897 |
- The size of URIs in “Contact:” headers are checked to be lower or equal |
|
898 |
- to this value. A warning is logged and a 400 Bad Request is sent in |
|
899 |
- response to REGISTER requests with contact URIs that are longer than |
|
900 |
- this value. |
|
901 |
- |
|
902 |
- If a database is used then you must make sure that your database model |
|
903 |
- supports strings of the configured size in the column “contact” of the |
|
904 |
- table specified in “save()” function. |
|
905 |
- |
|
906 |
- Default value is 512. |
|
907 |
- |
|
908 |
- Example 1.31. Set contact_max_size parameter |
|
909 |
-... |
|
910 |
-modparam("registrar", "contact_max_size", 1024) |
|
911 |
-... |
|
912 |
- |
|
913 |
-3.33. event_callback (str) |
|
914 |
- |
|
915 |
- The name of the function in the KEMI configuration file (embedded |
|
916 |
- scripting language such as Lua, Python, ...) to be executed instead of |
|
917 |
- event_route[...] blocks. |
|
918 |
- |
|
919 |
- The function receives a string parameter with the name of the event. |
|
920 |
- The only possible value currently is 'usrloc:contact-expired'. |
|
921 |
- |
|
922 |
- Default value is 'empty' (no function is executed for events). |
|
923 |
- |
|
924 |
- Example 1.32. Set event_callback parameter |
|
925 |
-... |
|
926 |
-modparam("registrar", "event_callback", "ksr_registrar_event") |
|
927 |
-... |
|
928 |
-function ksr_registrar_event(evname) |
|
929 |
- KSR.info( "Expired contact for " .. KSR.pv.getw("$ulc(exp=>aor)") .. "\n"); |
|
930 |
- return 1; |
|
931 |
-end |
|
932 |
-... |
|
933 |
- |
|
934 |
-3.34. lookup_filter_mode (int) |
|
935 |
- |
|
936 |
- Control what filters should be applied to lookup(...) operations. It |
|
937 |
- can be a combination (sum) of the next values: |
|
938 |
- * 1 - apply the branch flags filter - return only contact records |
|
939 |
- with branch flags matching at least one set inside xavp specified |
|
940 |
- by xavp_cfg parameter with inner name rlf_bflags - e.g., |
|
941 |
- $xavp(reg=>rlf_bflags). |
|
942 |
- * 2 - apply the active tcp connection filter - return only contact |
|
943 |
- records that have the associated TCP/TLS/WSS connection active. UDP |
|
944 |
- and SCTP contacts are not filtered, all are returned. |
|
945 |
- |
|
946 |
- Default value is NULL (disabled). |
|
947 |
- |
|
948 |
- Example 1.33. Set xavp_cfg parameter |
|
949 |
-... |
|
950 |
-modparam("registrar", "xavp_cfg", "reg") |
|
951 |
-modparam("registrar", "lookup_filter_mode", 1) |
|
952 |
-... |
|
953 |
-request_route { |
|
954 |
- ... |
|
955 |
- $xavp(reg=>rlf_bflags) = 8; |
|
956 |
- if(lookup("location")) { ... } |
|
957 |
- ... |
|
958 |
-} |
|
959 |
-... |
|
960 |
- |
|
961 |
-3.35. use_expired_contacts (int) |
|
962 |
- |
|
963 |
- Allow/Disallow the usage of the expired contacts. |
|
964 |
- * 0 Disallow the usage of the expired contacts. |
|
965 |
- * 1 Allow the usage of the expired contacts. |
|
966 |
- |
|
967 |
- Default value is 0 (Disallow). |
|
968 |
- |
|
969 |
- Example 1.34. Set use_expired_contacts parameter |
|
970 |
-... |
|
971 |
-modparam("registrar", "use_expired_contacts", 1) |
|
972 |
-... |
|
973 |
- |
|
974 |
-kamcmd cfg.set_now_int registrar use_expired_contacts 1 |
|
975 |
-kamcmd cfg.set_now_int registrar use_expired_contacts 0 |
|
976 |
- |
|
977 |
-4. Functions |
|
978 |
- |
|
979 |
- 4.1. save(domain, [, flags [, uri]]) |
|
980 |
- 4.2. lookup(domain [, uri]) |
|
981 |
- 4.3. lookup_to_dset(domain [, uri]) |
|
982 |
- 4.4. lookup_branches(domain) |
|
983 |
- 4.5. registered(domain [, uri [, match_option [, match_action]]]) |
|
984 |
- 4.6. add_sock_hdr(hdr_name) |
|
985 |
- 4.7. unregister(domain, uri[, ruid]) |
|
986 |
- 4.8. reg_fetch_contacts(domain, uri, profile) |
|
987 |
- 4.9. reg_free_contacts(profile) |
|
988 |
- 4.10. reg_send_reply() |
|
989 |
- |
|
990 |
-4.1. save(domain, [, flags [, uri]]) |
|
991 |
- |
|
992 |
- The function processes a REGISTER message. It can add, remove or modify |
|
993 |
- location records (in usrloc) depending on Contact and Expires header |
|
994 |
- fields in the REGISTER message. On success and when called from the |
|
995 |
- REQUEST_ROUTE, “200 OK” will be returned listing all contacts that are |
|
996 |
- currently in the location database. As a side effect, also branch flags |
|
997 |
- are stored in usrloc. On an error, an error message will be sent with a |
|
998 |
- short description in reason phrase. |
|
999 |
- |
|
1000 |
- Meaning of the parameters is as follows: |
|
1001 |
- * domain - Logical domain within the registrar. If a database is used |
|
1002 |
- then this must be name of the table which stores the contacts. |
|
1003 |
- * flags (optional) - the value may be a bitwise OR of the following |
|
1004 |
- flags: |
|
1005 |
- + 0x01 - save the contacts only in memory cache with no DB |
|
1006 |
- operation; |
|
1007 |
- + 0x02 - do not generate a SIP reply to the current REGISTER |
|
1008 |
- request. When used in ONREPLY_ROUTE, this parameter is |
|
1009 |
- obsolete. |
|
1010 |
- + 0x04 - store and maintain one contact per AoR. If there are |
|
1011 |
- other contact addresses for AoR not matching current |
|
1012 |
- registration, remove them. This mode ensures one contact per |
|
1013 |
- AoR (user). |
|
1014 |
- + 0x08 - Do not apply expires_range or default_expires_range to |
|
1015 |
- this registration. |
|
1016 |
- + 0x10 - prepare the headers for reply, used only if flag 0x02 |
|
1017 |
- is set. |
|
1018 |
- The flags may be given in decimal or hexadecimal format. |
|
1019 |
- * uri (optional - flags param has to be set and can be 0 for default |
|
1020 |
- behavior) - SIP URI to do be used instead of To header URI. It can |
|
1021 |
- be a dynamic string with pseudo-variables. |
|
1022 |
- |
|
1023 |
- Return codes: |
|
1024 |
- * -2 - error, too many contacts for AOR. |
|
1025 |
- -1 - error. |
|
1026 |
- 1 - contacts inserted. |
|
1027 |
- 2 - contacts updated. |
|
1028 |
- 3 - contacts deleted. |
|
1029 |
- 4 - contacts returned. |
|
1030 |
- |
|
1031 |
- This function can be used from REQUEST_ROUTE, FAILURE_ROUTE and |
|
1032 |
- REPLY_ROUTE. |
|
1033 |
- |
|
1034 |
- Example 1.35. save usage |
|
1035 |
-... |
|
1036 |
-save("location"); |
|
1037 |
-save("location", "0x01"); |
|
1038 |
-save("location", "0x00", "sip:test@kamailio.org"); |
|
1039 |
-... |
|
1040 |
- |
|
1041 |
-4.2. lookup(domain [, uri]) |
|
1042 |
- |
|
1043 |
- The lookup function extracts username and/or domain from Request-URI |
|
1044 |
- and tries to find all contacts for the username in usrloc. If there are |
|
1045 |
- no such contacts, -1 will be returned. If there are such contacts, |
|
1046 |
- Request-URI will be overwritten with the contact that has the highest q |
|
1047 |
- value and optionally the rest will be appended to the message |
|
1048 |
- (depending on append_branches parameter value). As a side effect, also |
|
1049 |
- branch flags are restored from usrloc. |
|
1050 |
- |
|
1051 |
- If the method_filtering option is enabled and request is initial |
|
1052 |
- request without to-tag, the lookup function will return only the |
|
1053 |
- contacts that support the method of the processed request. |
|
1054 |
- |
|
1055 |
- Meaning of the parameters is as follows: |
|
1056 |
- * domain - Name of table that should be used for the lookup. |
|
1057 |
- * uri (optional) - SIP URI to do be used instead of R-URI. It can be |
|
1058 |
- a dynamic string with pseudo-variables. |
|
1059 |
- |
|
1060 |
- Return codes: |
|
1061 |
- * 1 - contacts found and returned. |
|
1062 |
- -1 - no contact found. |
|
1063 |
- -2 - contacts found, but method not supported. |
|
1064 |
- -3 - internal error during processing. |
|
1065 |
- |
|
1066 |
- This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. |
|
1067 |
- |
|
1068 |
- Example 1.36. lookup usage |
|
1069 |
-... |
|
1070 |
-lookup("location"); |
|
1071 |
- switch ($retcode) {:1 |
|
1072 |
- |
|
1073 |
- case -1: |
|
1074 |
- case -3: |
|
1075 |
- sl_send_reply("404", "Not Found"); |
|
1076 |
- exit; |
|
1077 |
- case -2: |
|
1078 |
- sl_send_reply("405", "Not Found"); |
|
1079 |
- exit; |
|
1080 |
-}; |
|
1081 |
-... |
|
1082 |
- |
|
1083 |
-4.3. lookup_to_dset(domain [, uri]) |
|
1084 |
- |
|
1085 |
- Similar to lookup(...), but push the location contacts to destination |
|
1086 |
- set, without changing the R-URI (first branch not changed, it creates |
|
1087 |
- additional branches). For the meaning of the parameters and the return |
|
1088 |
- codes, see the documentation for lookup(...) function. |
|
1089 |
- |
|
1090 |
- This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. |
|
1091 |
- |
|
1092 |
- Example 1.37. lookup_to_dset usage |
|
1093 |
-... |
|
1094 |
-lookup_to_dset("location"); |
|
1095 |
-... |
|
1096 |
- |
|
1097 |
-4.4. lookup_branches(domain) |
|
1098 |
- |
|
1099 |
- The function performs lookup(domain) on r-uri and additional branches |
|
1100 |
- (only branches that have no other attributes set than uri). |
|
1101 |
- |
|
1102 |
- Meaning of the parameters is as follows: |
|
1103 |
- * domain - Name of table that should be used for the lookup. |
|
1104 |
- |
|
1105 |
- Return codes are propagated from the lookup(domain) function. |
|
1106 |
- |
|
1107 |
- This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. |
|
1108 |
- |
|
1109 |
- Example 1.38. lookup_branches usage |
|
1110 |
-... |
|
1111 |
-lookup_branches("location"); |
|
1112 |
-... |
|
1113 |
- |
|
1114 |
-4.5. registered(domain [, uri [, match_option [, match_action]]]) |
|
1115 |
- |
|
1116 |
- The function returns true if the AOR in the URI is registered, false |
|
1117 |
- otherwise. The function does not modify the message being process, it |
|
1118 |
- neither rewrites the Request-URI if a contact is found nor append |
|
1119 |
- branches. If uri parameter is not provided, then it considered to be |
|
1120 |
- the Request-URI for SIP requests and To-URI for SIP replies. |
|
1121 |
- |
|
1122 |
- Meaning of the parameters is as follows: |
|
1123 |
- * domain - Name of table that should be used for the lookup. |
|
1124 |
- * uri (optional) - SIP URI to do be used instead of Request/To-URI. |
|
1125 |
- It can be a dynamic string with pseudo-variables. |
|
1126 |
- * match_option (optional) - flag parameter to restrict contact |
|
1127 |
- search. use xavp_cfg to set the values to compare to. |
|
1128 |
- flag values is as follows: |
|
1129 |
- + 1 - match_callid |
|
1130 |
- + 2 - match_received |
|
1131 |
- + 4 - match_contact |
|
1132 |
- * match_action (optional) - actions to perform when match is |
|
1133 |
- positive. |
|
1134 |
- flag values is as follows: |
|
1135 |
- + 1 - restore the xavps associated with the matched contact |
|
1136 |
- + 2 - skip adding the matched location record attributes to |
|
1137 |
- xavp_rcd (e.g., the ruid, contact, received, ...) |
|
1138 |
- |
|
1139 |
- This function can be used from ANY_ROUTE. |
|
1140 |
- |
|
1141 |
- Example 1.39. registered usage |
|
1142 |
-... |
|
1143 |
-if (registered("location")) { |
|
1144 |
- sl_send_reply("100", "Trying"); |
|
1145 |
- ... |
|
1146 |
-}; |
|
1147 |
-... |
|
1148 |
-$xavp(regcfg=>match_received) = $su; |
|
1149 |
-if (registered("location","$rz:$Au", 2)) { |
|
1150 |
- sl_send_reply("100", "Trying"); |
|
1151 |
- ... |
|
1152 |
-}; |
|
1153 |
-... |
|
1154 |
- |
|
1155 |
-4.6. add_sock_hdr(hdr_name) |
|
1156 |
- |
|
1157 |
- Adds a new header to the current REGISTER request with “hdr_name” which |
|
1158 |
- contains the description of the received socket (proto:ip:port) |
|
1159 |
- |
|
1160 |
- This makes sense only in multiple replicated servers scenarios. |
|
1161 |
- |
|
1162 |
- Meaning of the parameters is as follows: |
|
1163 |
- * hdr_name - header name to be used, it can be a static string or |
|
1164 |
- contain variables. |
|
1165 |
- |
|
1166 |
- This function can be used from REQUEST_ROUTE. |
|
1167 |
- |
|
1168 |
- Example 1.40. add_sock_hdr usage |
|
1169 |
-... |
|
1170 |
-add_sock_hdr("Sock-Info"); |
|
1171 |
-... |
|
1172 |
- |
|
1173 |
-4.7. unregister(domain, uri[, ruid]) |
|
1174 |
- |
|
1175 |
- The function removes contacts associated with 'uri' from the location |
|
1176 |
- database. If 'ruid' is provided a specific contact is removed, if |
|
1177 |
- 'ruid' is not provided all the current contacts are removed. If 'ruid' |
|
1178 |
- is provided and the “usrloc” module is using “db_mode=3”, 'uri' does |
|
1179 |
- not need to be given and can be empty string. |
|
1180 |
- |
|
1181 |
- Meaning of the parameters is as follows: |
|
1182 |
- * domain - Name of table that should be used for the lookup or |
|
1183 |
- contact addresses. |
|
1184 |
- * uri - The SIP URI address of the user which to remove the contact |
|
1185 |
- addresses for. It can contain pseudo-variables that are evaluated |
|
1186 |
- at runtime. |
|
1187 |
- * ruid - The record unique ID for a a specific contact to be removed. |
|
1188 |
- It can contain pseudo-variables that are evaluated at runtime. |
|
1189 |
- |
|
1190 |
- This function can be used from ANY_ROUTE. |
|
1191 |
- |
|
1192 |
- Return values: |
|
1193 |
- * 0 - Successfully deleted contact(s) |
|
1194 |
- * -1 - Failed to extract or parse address of record from argument |
|
1195 |
- * -2 - Error in unregistering user |
|
1196 |
- * -3 - Contacts for AOR not found |
|
1197 |
- |
|
1198 |
- Example 1.41. unregister usage |
|
1199 |
-... |
|
1200 |
-unregister("location", "$ru"); |
|
1201 |
-unregister("location", "sip:user@kamailio.org"); |
|
1202 |
-unregister("location", "$ru", "$ulc(caller=>ruid)"); |
|
1203 |
-unregister("location", "", "$ruid"); |
|
1204 |
-... |
|
1205 |
- |
|
1206 |
-4.8. reg_fetch_contacts(domain, uri, profile) |
|
1207 |
- |
|
1208 |
- The function fetches the contacts for 'uri' from table 'domain' to |
|
1209 |
- pseudo-variable $ulc(profile). |
|
1210 |
- |
|
1211 |
- Meaning of the parameters is as follows: |
|
1212 |
- * domain - Name of table that should be used for the lookup of |
|
1213 |
- contact addresses. |
|
1214 |
- * uri - The SIP URI address of the user which to fetch the contact |
|
1215 |
- addresses for. It can contain pseudo-variables that are evaluated |
|
1216 |
- at runtime. |
|
1217 |
- * profile - Name of $ulc pseudo-variable profile that will store the |
|
1218 |
- fetched contacts. It is a static string. |
|
1219 |
- |
|
1220 |
- This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. |
|
1221 |
- |
|
1222 |
- Example 1.42. reg_fetch_contacts usage |
|
1223 |
-... |
|
1224 |
-reg_fetch_contacts("location", "$ru", "callee"); |
|
1225 |
-reg_fetch_contacts("location", "sip:user@kamailio.org", "caller"); |
|
1226 |
-... |
|
1227 |
- |
|
1228 |
-4.9. reg_free_contacts(profile) |
|
1229 |
- |
|
1230 |
- The function frees the contacts from pseudo-variable $ulc(profile). |
|
1231 |
- Should be called to release the content of a profile. Anyhow, fetching |
|
1232 |
- a new contact addresses set over a profile will release any existing |
|
1233 |
- data in that profile. |
|
1234 |
- |
|
1235 |
- Meaning of the parameters is as follows: |
|
1236 |
- * profile - Name of $ulc pseudo-variable profile that stores fetched |
|
1237 |
- contacts. It is a static string. |
|
1238 |
- |
|
1239 |
- This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. |
|
1240 |
- |
|
1241 |
- Example 1.43. reg_free_contacts usage |
|
1242 |
-... |
|
1243 |
-reg_free_contacts("callee"); |
|
1244 |
-... |
|
1245 |
- |
|
1246 |
-4.10. reg_send_reply() |
|
1247 |
- |
|
1248 |
- The function sends the SIP reply that is normally sent by save(...), |
|
1249 |
- but that was skipped due to flag 0x2. It must be used after save(..., |
|
1250 |
- "0x2"). Practically it allows saving registration to location table, do |
|
1251 |
- other operations and then send the reply. |
|
1252 |
- |
|
1253 |
- This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. |
|
1254 |
- |
|
1255 |
- Example 1.44. reg_send_reply usage |
|
1256 |
-... |
|
1257 |
-save("location", "0x2"); |
|
1258 |
-... |
|
1259 |
-reg_send_reply(); |
|
1260 |
-... |
|
1261 |
- |
|
1262 |
-5. Event Routes |
|
1263 |
- |
|
1264 |
- 5.1. event_route[usrloc:contact-expired] |
|
1265 |
- |
|
1266 |
-5.1. event_route[usrloc:contact-expired] |
|
1267 |
- |
|
1268 |
- Executed when a contact in location table has expired. The variable |
|
1269 |
- $ulc(exp=>...) is filled with the attributes of the expired contact. |
|
1270 |
- |
|
1271 |
- Example 1.45. event_route[usrloc:contact-expired] usage |
|
1272 |
-... |
|
1273 |
-event_route[usrloc:contact-expired] { |
|
1274 |
- xlog("expired contact for $ulc(exp=>aor)\n"); |
|
1275 |
-} |
|
1276 |
-... |
|
1277 |
- |
|
1278 |
-6. Statistics |
|
1279 |
- |
|
1280 |
- 6.1. max_expires |
|
1281 |
- 6.2. max_contacts |
|
1282 |
- 6.3. default_expires |
|
1283 |
- 6.4. accepted_regs |
|
1284 |
- 6.5. rejected_regs |
|
1285 |
- |
|
1286 |
-6.1. max_expires |
|
1287 |
- |
|
1288 |
- Value of max_expires parameter. |
|
1289 |
- |
|
1290 |
-6.2. max_contacts |
|
1291 |
- |
|
1292 |
- The value of max_contacts parameter. |
|
1293 |
- |
|
1294 |
-6.3. default_expires |
|
1295 |
- |
|
1296 |
- The value of default_expires parameter. |
|
1297 |
- |
|
1298 |
-6.4. accepted_regs |
|
1299 |
- |
|
1300 |
- Number of accepted registrations. |
|
1301 |
- |
|
1302 |
-6.5. rejected_regs |
|
1303 |
- |
|
1304 |
- Number of rejected registrations. |
|
1305 |
- |
|
1306 |
-7. Pseudo Variables |
|
1307 |
- |
|
1308 |
- 7.1. $ulc(profile=>attr) |
|
1309 |
- |
|
1310 |
-7.1. $ulc(profile=>attr) |
|
1311 |
- |
|
1312 |
- Access the attributes of contact addresses stored in 'profile'. It must |
|
1313 |
- be used after a call of “reg_fetch_contacts()”. |
|
1314 |
- |
|
1315 |
- The “profile” has to be one of the values used with |
|
1316 |
- “reg_fetch_contacts()”. |
|
1317 |
- |
|
1318 |
- The “attr” can be: |
|
1319 |
- * aor - address of record |
|
1320 |
- * domain - used location domain/table name |
|
1321 |
- * aorhash - hash id for the record |
|
1322 |
- * addr - contact address |
|
1323 |
- * path - path vector |
|
1324 |
- * received - received address |
|
1325 |
- * expires - expires value |
|
1326 |
- * callid - call-id header value |
|
1327 |
- * q - the q value |
|
1328 |
- * cseq - the cseq value |
|
1329 |
- * flags - flags value |
|
1330 |
- * cflags - cflags value |
|
1331 |
- * user_agent - user agent |
|
1332 |
- * socket - local socket |
|
1333 |
- * modified - last modified time |
|
1334 |
- * methods - methods value |
|
1335 |
- * count - number of contacts |
|
1336 |
- * ruid - record unique ID |
|
1337 |
- * regid - reg-id value |
|
1338 |
- * instance - instance value |
|
1339 |
- * conid - TCP socket internal connection ID ($null if UDP) |
|
1340 |
- * server_id - server_id value |
|
1341 |
- |
|
1342 |
- The pseudo-variable accepts positive index value to access a specific |
|
1343 |
- contact record. |
|
1344 |
- |
|
1345 |
- Example 1.46. $ulc(name) usage |
|
1346 |
-... |
|
1347 |
-if(reg_fetch_contacts("location", "$fu", "caller")) |
|
1348 |
-{ |
|
1349 |
- xlog("caller=>aor: $(ulc(caller=>aor))\n"); |
|
1350 |
- xlog("caller=>domain: $(ulc(caller=>domain))\n"); |
|
1351 |
- xlog("caller=>aorhash $(ulc(caller=>aorhash))\n"); |
|
1352 |
- xlog("caller=>count $(ulc(caller=>count))\n"); |
|
1353 |
- $var(i) = 0; |
|
1354 |
- while($var(i) < $(ulc(caller=>count))) |
|
1355 |
- { |
|
1356 |
- xlog("--- contact [$var(i)]\n"); |
|
1357 |
- xlog("caller=>addr: $(ulc(caller=>addr)[$var(i)])\n"); |
|
1358 |
- xlog("caller=>path: $(ulc(caller=>path)[$var(i)])\n"); |
|
1359 |
- xlog("caller=>received: $(ulc(caller=>received)[$var(i)])\n"); |
|
1360 |
- xlog("caller=>expires: $(ulc(caller=>expires)[$var(i)])\n"); |
|
1361 |
- xlog("caller=>callid: $(ulc(caller=>callid)[$var(i)])\n"); |
|
1362 |
- xlog("caller=>regid: $(ulc(caller=>regid)[$var(i)])\n"); |
|
1363 |
- xlog("caller=>q: $(ulc(caller=>q)[$var(i)])\n"); |
|
1364 |
- xlog("caller=>cseq: $(ulc(caller=>cseq)[$var(i)])\n"); |
|
1365 |
- xlog("caller=>flags: $(ulc(caller=>flags)[$var(i)])\n"); |
|
1366 |
- xlog("caller=>cflags: $(ulc(caller=>cflags)[$var(i)])\n"); |
|
1367 |
- xlog("caller=>user_agent: $(ulc(caller=>user_agent)[$var(i)])\n"); |
|
1368 |
- xlog("caller=>socket: $(ulc(caller=>socket)[$var(i)])\n"); |
|
1369 |
- xlog("caller=>modified: $(ulc(caller=>modified)[$var(i)])\n"); |
|
1370 |
- xlog("caller=>methods: $(ulc(caller=>methods)[$var(i)])\n"); |
|
1371 |
- $var(i) = $var(i) + 1; |
|
1372 |
- } |
|
1373 |
-} |
|
1374 |
-... |
|
1375 |
- |
|
1376 |
-Chapter 2. Frequently Asked Questions |
|
1377 |
- |
|
1378 |
- 2.1. What happened with the old “nat_flag” module parameter? |
|
1379 |
- 2.2. What happened with the old “use_domain” module parameter? |
|
1380 |
- 2.3. What happened with the old “save_noreply” and “save_memory” |
|
1381 |
- functions? |
|
1382 |
- |
|
1383 |
- 2.4. Where can I find more about Kamailio? |
|
1384 |
- 2.5. Where can I post a question about this module? |
|
1385 |
- 2.6. How can I report a bug? |
|
1386 |
- 2.7. What happened to the desc_time_order parameter? |
|
1387 |
- |
|
1388 |
- 2.1. |
|
1389 |
- |
|
1390 |
- What happened with the old “nat_flag” module parameter? |
|
1391 |
- |
|
1392 |
- In was removed, as the module internally loads this value from the |
|
1393 |
- “USRLOC” module (see the “nat_bflag” USRLOC parameter). |
|
1394 |
- |
|
1395 |
- 2.2. |
|
1396 |
- |
|
1397 |
- What happened with the old “use_domain” module parameter? |
|
1398 |
- |
|
1399 |
- In was removed, as the module internally loads this option from the |
|
1400 |
- “USRLOC” module. This was done in order to simplify the configuration. |
|
1401 |
- |
|
1402 |
- 2.3. |
|
1403 |