Debian Codegraph @

src/modules/dialog/README

raw
1 dialog Module
2
3 Bogdan-Andrei Iancu
4
5 Voice Sistem SRL
6
7 Carsten Bock
8
9 ng-voice.com
10
11 Edited by
12
13 Bogdan-Andrei Iancu
14
15 Carsten Bock
16
17 Alex Balashov
18
19 <[email protected]>
20
21 Olle E. Johansson
22
23 <[email protected]>
24
25 Surendra Tiwari
26
27 <[email protected]>
28
29 Julien Klingenmeyer
30
31 <[email protected]>
32
33 Copyright © 2006 Voice Sistem SRL
34
35 Copyright © 2011, 2022 ng-voice GmbH, Carsten Bock,
36 http://www.ng-voice.com
37 __________________________________________________________________
38
39 Table of Contents
40
41 1. Admin Guide
42
43 1. Overview
44 2. How it works
45 3. Dialog states
46 4. Dialog profiling
47 5. Dependencies
48
49 5.1. Kamailio Modules
50 5.2. External Libraries or Applications
51
52 6. Parameters
53
54 6.1. enable_stats (integer)
55 6.2. hash_size (integer)
56 6.3. rr_param (string)
57 6.4. timeout_avp (string)
58 6.5. default_timeout (integer)
59 6.6. early_timeout (integer)
60 6.7. noack_timeout (integer)
61 6.8. end_timeout (integer)
62 6.9. dlg_extra_hdrs (string)
63 6.10. dlg_match_mode (integer)
64 6.11. detect_spirals (integer)
65 6.12. db_url (string)
66 6.13. db_mode (integer)
67 6.14. db_update_period (integer)
68 6.15. db_fetch_rows (integer)
69 6.16. db_skip_load (integer)
70 6.17. table_name (string)
71 6.18. call_id_column (string)
72 6.19. from_uri_column (string)
73 6.20. from_tag_column (string)
74 6.21. to_uri_column (string)
75 6.22. to_tag_column (string)
76 6.23. from_cseq_column (string)
77 6.24. to_cseq_column (string)
78 6.25. from_route_column (string)
79 6.26. to_route_column (string)
80 6.27. from_contact_column (string)
81 6.28. to_contact_column (string)
82 6.29. from_sock_column (string)
83 6.30. to_sock_column (string)
84 6.31. h_id_column (string)
85 6.32. h_entry_column (string)
86 6.33. state_column (string)
87 6.34. start_time_column (string)
88 6.35. timeout_column (string)
89 6.36. sflags_column (string)
90 6.37. toroute_name_column (string)
91 6.38. vars_table_name (string)
92 6.39. vars_h_id_column (string)
93 6.40. vars_h_entry_column (string)
94 6.41. vars_key_column (string)
95 6.42. vars_value_column (string)
96 6.43. profiles_with_value (string)
97 6.44. profiles_no_value (string)
98 6.45. bridge_controller (string)
99 6.46. bridge_contact (string)
100 6.47. initial_cbs_inscript (int)
101 6.48. send_bye (int)
102 6.49. dlg_filter_mode (int)
103 6.50. wait_ack (int)
104 6.51. ka_timer (int)
105 6.52. ka_interval (int)
106 6.53. ka_failed_limit (int)
107 6.54. timeout_noreset (int)
108 6.55. timer_procs (int)
109 6.56. enable_dmq (int)
110 6.57. track_cseq_updates (int)
111 6.58. lreq_callee_headers (string)
112 6.59. event_callback (str)
113 6.60. h_id_start (int)
114 6.61. h_id_step (int)
115 6.62. keep_proxy_rr (string)
116 6.63. bye_early_code (int)
117 6.64. bye_early_reason (string)
118 6.65. dlg_ctxiuid_mode (int)
119 6.66. debug_variables (int)
120 6.67. dlg_mode (int)
121
122 7. Functions
123
124 7.1. set_dlg_profile(profile[, value])
125 7.2. unset_dlg_profile(profile[, value])
126 7.3. is_in_profile(profile[, value])
127 7.4. get_profile_size(profile[, value], size)
128 7.5. dlg_isflagset(flag)
129 7.6. dlg_setflag(flag)
130 7.7. dlg_resetflag(flag)
131 7.8. dlg_bye(side)
132 7.9. dlg_refer(side, address)
133 7.10. dlg_refer_did(h_entry, h_id, side, address)
134 7.11. dlg_refer_dcid(callid, side, address)
135 7.12. dlg_manage()
136 7.13. dlg_bridge(from, to, op)
137 7.14. dlg_get(callid, ftag, ttag)
138 7.15. dlg_get_var(callid, ftag, ttag, name, dst)
139 7.16. dlg_set_var(callid, ftag, ttag, name, value)
140 7.17. is_known_dlg()
141 7.18. dlg_set_timeout(timeout [, h_entry, h_id])
142 7.19. dlg_set_timeout_by_profile(profile, [value], timeout)
143 7.20. dlg_set_property(attr)
144 7.21. dlg_remote_profile(cmd, profile, value, uid, expires)
145 7.22. dlg_set_ruri()
146 7.23. dlg_db_load_callid(cival)
147 7.24. dlg_db_load_extra()
148 7.25. dlg_reset_property(attr)
149 7.26. dlg_req_within(side, method, [headers], [content_type,
150 content])
151
152 7.27. dlg_set_state(newstate)
153
154 8. Statistics
155
156 8.1. active_dialogs
157 8.2. early_dialogs
158 8.3. processed_dialogs
159 8.4. expired_dialogs
160 8.5. failed_dialogs
161
162 9. RPC Commands
163
164 9.1. dlg.list
165 9.2. dlg.list_ctx
166 9.3. dlg.list_match
167 9.4. dlg.list_match_ctx
168 9.5. dlg.dump_file
169 9.6. dlg.dlg_list
170 9.7. dlg.dlg_list_ctx
171 9.8. dlg.terminate_dlg
172 9.9. dlg.end_dlg
173 9.10. dlg.set_state
174 9.11. dlg.profile_get_size
175 9.12. dlg.profile_list
176 9.13. dlg.bridge_dlg
177 9.14. dlg.stats_active
178 9.15. dlg.is_alive
179 9.16. dlg.briefing
180
181 10. Exported Variables
182
183 10.1. $DLG_count
184 10.2. $DLG_status
185 10.3. $DLG_lifetime
186 10.4. $dlg(...)
187 10.5. $dlg_ctx(...)
188 10.6. $dlg_var(key)
189
190 11. Event Routes
191
192 11.1. event_route[dialog:start]
193 11.2. event_route[dialog:end]
194 11.3. event_route[dialog:failed]
195
196 2. Developer Guide
197
198 1. Available Functions
199
200 1.1. register_dlgcb (dialog, type, cb, param, free_param_cb)
201
202 1.2. terminate_dlg (dlg, hdrs)
203
204 3. Frequently Asked Questions
205
206 List of Examples
207
208 1.1. Set enable_stats parameter
209 1.2. Set hash_size parameter
210 1.3. Set rr_param parameter
211 1.4. Set timeout_avp parameter
212 1.5. Set default_timeout parameter
213 1.6. Set early_timeout parameter
214 1.7. Set noack_timeout parameter
215 1.8. Set end_timeout parameter
216 1.9. Set dlf_extra_hdrs parameter
217 1.10. Set dlg_match_mode parameter
218 1.11. Set detect_spirals parameter
219 1.12. Set db_url parameter
220 1.13. Set db_mode parameter
221 1.14. Set db_update_period parameter
222 1.15. Set db_fetch_rows parameter
223 1.16. Set db_skip_load parameter
224 1.17. Set table_name parameter
225 1.18. Set call_id_column parameter
226 1.19. Set from_uri_column parameter
227 1.20. Set from_tag_column parameter
228 1.21. Set to_uri_column parameter
229 1.22. Set to_tag_column parameter
230 1.23. Set from_cseq_column parameter
231 1.24. Set to_cseq_column parameter
232 1.25. Set from_route_column parameter
233 1.26. Set to_route_column parameter
234 1.27. Set from_contact_column parameter
235 1.28. Set to_contact_column parameter
236 1.29. Set from_sock_column parameter
237 1.30. Set to_sock_column parameter
238 1.31. Set h_id_column parameter
239 1.32. Set h_entry_column parameter
240 1.33. Set state_column parameter
241 1.34. Set start_time_column parameter
242 1.35. Set timeout_column parameter
243 1.36. Set sflags_column parameter
244 1.37. Set toroute_name_column parameter
245 1.38. Set vars_table_name parameter
246 1.39. Set vars_h_id_column parameter
247 1.40. Set vars_h_entry_column parameter
248 1.41. Set vars_key_column parameter
249 1.42. Set vars_value_column parameter
250 1.43. Set profiles_with_value parameter
251 1.44. Set profiles_no_value parameter
252 1.45. Set bridge_controller parameter
253 1.46. Set bridge_contact parameter
254 1.47. Set initial_cbs_inscript parameter
255 1.48. Set send_bye parameter
256 1.49. Set dlg_filter_mode parameter
257 1.50. Set wait_ack parameter
258 1.51. Set ka_timer parameter
259 1.52. Set ka_interval parameter
260 1.53. Set ka_failed_limit parameter
261 1.54. Set timeout_noreset parameter
262 1.55. Set timer_procs parameter
263 1.56. Set enable_dmq parameter
264 1.57. Set track_cseq_updates parameter
265 1.58. Set lreq_callee_headers parameter
266 1.59. Set event_callback parameter
267 1.60. Set h_id_start parameter
268 1.61. Set h_id_step parameter
269 1.62. Set dlg_keep_proxy_rr parameter
270 1.63. Set bye_early_code parameter
271 1.64. Set bye_early_reason parameter
272 1.65. Set dlg_ctxiuid_mode parameter
273 1.66. Set debug_variables parameter
274 1.67. Set dlg_mode parameter
275 1.68. set_dlg_profile usage
276 1.69. unset_dlg_profile usage
277 1.70. is_in_profile usage
278 1.71. get_profile_size usage
279 1.72. dlg_isflagset usage
280 1.73. dlg_setflag usage
281 1.74. dlg_resetflag usage
282 1.75. dlg_bye usage
283 1.76. dlg_refer usage
284 1.77. dlg_refer_did usage
285 1.78. dlg_refer_cid usage
286 1.79. dlg_manage usage
287 1.80. dlg_bridge usage
288 1.81. dlg_get usage
289 1.82. dlg_get_var usage
290 1.83. dlg_set_var usage
291 1.84. is_known_dlg() usage
292 1.85. dlg_set_timeout usage
293 1.86. dlg_set_timeout_by_profile usage
294 1.87. dlg_set_property usage
295 1.88. dlg_remote_profile usage
296 1.89. dlg_set_ruri() usage
297 1.90. dlg_db_load_callid() usage
298 1.91. dlg_db_load_extra() usage
299 1.92. dlg_reset_property usage
300 1.93. dlg_req_within usage
301 1.94. dlg_set_state usage
302
303 Chapter 1. Admin Guide
304
305 Table of Contents
306
307 1. Overview
308 2. How it works
309 3. Dialog states
310 4. Dialog profiling
311 5. Dependencies
312
313 5.1. Kamailio Modules
314 5.2. External Libraries or Applications
315
316 6. Parameters
317
318 6.1. enable_stats (integer)
319 6.2. hash_size (integer)
320 6.3. rr_param (string)
321 6.4. timeout_avp (string)
322 6.5. default_timeout (integer)
323 6.6. early_timeout (integer)
324 6.7. noack_timeout (integer)
325 6.8. end_timeout (integer)
326 6.9. dlg_extra_hdrs (string)
327 6.10. dlg_match_mode (integer)
328 6.11. detect_spirals (integer)
329 6.12. db_url (string)
330 6.13. db_mode (integer)
331 6.14. db_update_period (integer)
332 6.15. db_fetch_rows (integer)
333 6.16. db_skip_load (integer)
334 6.17. table_name (string)
335 6.18. call_id_column (string)
336 6.19. from_uri_column (string)
337 6.20. from_tag_column (string)
338 6.21. to_uri_column (string)
339 6.22. to_tag_column (string)
340 6.23. from_cseq_column (string)
341 6.24. to_cseq_column (string)
342 6.25. from_route_column (string)
343 6.26. to_route_column (string)
344 6.27. from_contact_column (string)
345 6.28. to_contact_column (string)
346 6.29. from_sock_column (string)
347 6.30. to_sock_column (string)
348 6.31. h_id_column (string)
349 6.32. h_entry_column (string)
350 6.33. state_column (string)
351 6.34. start_time_column (string)
352 6.35. timeout_column (string)
353 6.36. sflags_column (string)
354 6.37. toroute_name_column (string)
355 6.38. vars_table_name (string)
356 6.39. vars_h_id_column (string)
357 6.40. vars_h_entry_column (string)
358 6.41. vars_key_column (string)
359 6.42. vars_value_column (string)
360 6.43. profiles_with_value (string)
361 6.44. profiles_no_value (string)
362 6.45. bridge_controller (string)
363 6.46. bridge_contact (string)
364 6.47. initial_cbs_inscript (int)
365 6.48. send_bye (int)
366 6.49. dlg_filter_mode (int)
367 6.50. wait_ack (int)
368 6.51. ka_timer (int)
369 6.52. ka_interval (int)
370 6.53. ka_failed_limit (int)
371 6.54. timeout_noreset (int)
372 6.55. timer_procs (int)
373 6.56. enable_dmq (int)
374 6.57. track_cseq_updates (int)
375 6.58. lreq_callee_headers (string)
376 6.59. event_callback (str)
377 6.60. h_id_start (int)
378 6.61. h_id_step (int)
379 6.62. keep_proxy_rr (string)
380 6.63. bye_early_code (int)
381 6.64. bye_early_reason (string)
382 6.65. dlg_ctxiuid_mode (int)
383 6.66. debug_variables (int)
384 6.67. dlg_mode (int)
385
386 7. Functions
387
388 7.1. set_dlg_profile(profile[, value])
389 7.2. unset_dlg_profile(profile[, value])
390 7.3. is_in_profile(profile[, value])
391 7.4. get_profile_size(profile[, value], size)
392 7.5. dlg_isflagset(flag)
393 7.6. dlg_setflag(flag)
394 7.7. dlg_resetflag(flag)
395 7.8. dlg_bye(side)
396 7.9. dlg_refer(side, address)
397 7.10. dlg_refer_did(h_entry, h_id, side, address)
398 7.11. dlg_refer_dcid(callid, side, address)
399 7.12. dlg_manage()
400 7.13. dlg_bridge(from, to, op)
401 7.14. dlg_get(callid, ftag, ttag)
402 7.15. dlg_get_var(callid, ftag, ttag, name, dst)
403 7.16. dlg_set_var(callid, ftag, ttag, name, value)
404 7.17. is_known_dlg()
405 7.18. dlg_set_timeout(timeout [, h_entry, h_id])
406 7.19. dlg_set_timeout_by_profile(profile, [value], timeout)
407 7.20. dlg_set_property(attr)
408 7.21. dlg_remote_profile(cmd, profile, value, uid, expires)
409 7.22. dlg_set_ruri()
410 7.23. dlg_db_load_callid(cival)
411 7.24. dlg_db_load_extra()
412 7.25. dlg_reset_property(attr)
413 7.26. dlg_req_within(side, method, [headers], [content_type,
414 content])
415
416 7.27. dlg_set_state(newstate)
417
418 8. Statistics
419
420 8.1. active_dialogs
421 8.2. early_dialogs
422 8.3. processed_dialogs
423 8.4. expired_dialogs
424 8.5. failed_dialogs
425
426 9. RPC Commands
427
428 9.1. dlg.list
429 9.2. dlg.list_ctx
430 9.3. dlg.list_match
431 9.4. dlg.list_match_ctx
432 9.5. dlg.dump_file
433 9.6. dlg.dlg_list
434 9.7. dlg.dlg_list_ctx
435 9.8. dlg.terminate_dlg
436 9.9. dlg.end_dlg
437 9.10. dlg.set_state
438 9.11. dlg.profile_get_size
439 9.12. dlg.profile_list
440 9.13. dlg.bridge_dlg
441 9.14. dlg.stats_active
442 9.15. dlg.is_alive
443 9.16. dlg.briefing
444
445 10. Exported Variables
446
447 10.1. $DLG_count
448 10.2. $DLG_status
449 10.3. $DLG_lifetime
450 10.4. $dlg(...)
451 10.5. $dlg_ctx(...)
452 10.6. $dlg_var(key)
453
454 11. Event Routes
455
456 11.1. event_route[dialog:start]
457 11.2. event_route[dialog:end]
458 11.3. event_route[dialog:failed]
459
460 1. Overview
461
462 Kamailio can behave as a stateful proxy through the TM module. However,
463 "stateful" in this context refers to transaction state, not dialog
464 state. Certain applications may benefit from an awareness of "calls" in
465 the proxy, not just SIP transactions.
466
467 For example, a common need is to limit the number of calls that can be
468 made concurrently by an endpoint, account, user group, etc. In order to
469 count the number of calls in progress, it is necessary for the proxy to
470 be aware of whole dialogs, not just transactions, and to provide some
471 means of programmatically classifying these dialogs. This is just one
472 common application discussed for illustrative purposes; there are many
473 others.
474
475 The dialog module provides dialog awareness for the Kamailio proxy. Its
476 functionality is to keep track of the current dialogs, to offer
477 information about them (e.g. how many dialogs are active), and to
478 manage various characteristics of dialogs. The module exports several
479 functions that can be used directly from the configuration route script
480 as well as functions for the RPC interface.
481
482 This module also provides an API foundation on which to build more
483 complex dialog-oriented functionality in other Kamailio modules.
484
485 2. How it works
486
487 To create the dialog associated with an initial INVITE request, execute
488 the function “dlg_manage()” before creating the corresponding
489 transaction.
490
491 The dialog is automatically destroyed when a “BYE” is received. In case
492 of no “BYE”, the dialog lifetime is controlled via the default timeout
493 (see “default_timeout” - Section 6.5, “default_timeout (integer)”) and
494 custom timeout (see “timeout_avp” - Section 6.4, “timeout_avp
495 (string)”). The dialog timeout is reset each time a sequential request
496 is processed.
497
498 3. Dialog states
499
500 Dialogs have states that are shown in the RPC interface as well as
501 stored in the database.
502 * 1 : Unconfirmed dialog
503 * 2 : Early dialog (ringing)
504 * 3 : Confirmed dialog (waiting for ACK)
505 * 4 : Confirmed dialog (active call)
506 * 5 : Deleted dialog
507
508 The early and deleted dialog states are not updated in database
509 storage.
510
511 4. Dialog profiling
512
513 Dialog profiling is a mechanism that helps in classifying, sorting and
514 keeping track of certain types of dialogs. The classification criteria
515 can be any attributes desired by the administrator; it can be SIP
516 message attributes, other pseudo-variables, custom values, etc. Dialogs
517 can be dynamically added into one or more profile tables. Logically,
518 each profile table can have a special meaning (like dialogs outside the
519 domain, dialogs terminated to the PSTN, etc.).
520
521 There are two types of profiles:
522 * with no value - a dialog simply belongs to a profile (for instance,
523 an outbound calls profile). There is no other additional
524 information to describe the dialog beyond its membership in the
525 profile per se.
526 * with value - a dialog belongs to a profile having a certain value
527 (like in a caller profile, where the value is the caller ID). The
528 membership of the dialog in the profile is strictly related to the
529 value. For example, if the account ID of the caller is stored in
530 the pseudo-variable $var(account_id), you can use $var(account_id)
531 as a value/key by which to group dialogs so that you can count the
532 number of open dialogs for each account, enforce concurrent call
533 limits as necessary, etc.
534
535 A dialog can be added to multiple profiles at the same time.
536
537 Profiles are visible (at the moment) in the request route (for initial
538 and sequential requests) and in the branch, failure and reply routes of
539 the original request.
540
541 5. Dependencies
542
543 5.1. Kamailio Modules
544 5.2. External Libraries or Applications
545
546 5.1. Kamailio Modules
547
548 The following modules must be loaded before this module:
549 * TM - Transaction module
550 * RR - Record-Route module
551 * PV - Pseudovariables module
552
553 5.2. External Libraries or Applications
554
555 The following libraries or applications must be installed before
556 running Kamailio with this module loaded:
557 * None.
558
559 6. Parameters
560
561 6.1. enable_stats (integer)
562 6.2. hash_size (integer)
563 6.3. rr_param (string)
564 6.4. timeout_avp (string)
565 6.5. default_timeout (integer)
566 6.6. early_timeout (integer)
567 6.7. noack_timeout (integer)
568 6.8. end_timeout (integer)
569 6.9. dlg_extra_hdrs (string)
570 6.10. dlg_match_mode (integer)
571 6.11. detect_spirals (integer)
572 6.12. db_url (string)
573 6.13. db_mode (integer)
574 6.14. db_update_period (integer)
575 6.15. db_fetch_rows (integer)
576 6.16. db_skip_load (integer)
577 6.17. table_name (string)
578 6.18. call_id_column (string)
579 6.19. from_uri_column (string)
580 6.20. from_tag_column (string)
581 6.21. to_uri_column (string)
582 6.22. to_tag_column (string)
583 6.23. from_cseq_column (string)
584 6.24. to_cseq_column (string)
585 6.25. from_route_column (string)
586 6.26. to_route_column (string)
587 6.27. from_contact_column (string)
588 6.28. to_contact_column (string)
589 6.29. from_sock_column (string)
590 6.30. to_sock_column (string)
591 6.31. h_id_column (string)
592 6.32. h_entry_column (string)
593 6.33. state_column (string)
594 6.34. start_time_column (string)
595 6.35. timeout_column (string)
596 6.36. sflags_column (string)
597 6.37. toroute_name_column (string)
598 6.38. vars_table_name (string)
599 6.39. vars_h_id_column (string)
600 6.40. vars_h_entry_column (string)
601 6.41. vars_key_column (string)
602 6.42. vars_value_column (string)
603 6.43. profiles_with_value (string)
604 6.44. profiles_no_value (string)
605 6.45. bridge_controller (string)
606 6.46. bridge_contact (string)
607 6.47. initial_cbs_inscript (int)
608 6.48. send_bye (int)
609 6.49. dlg_filter_mode (int)
610 6.50. wait_ack (int)
611 6.51. ka_timer (int)
612 6.52. ka_interval (int)
613 6.53. ka_failed_limit (int)
614 6.54. timeout_noreset (int)
615 6.55. timer_procs (int)
616 6.56. enable_dmq (int)
617 6.57. track_cseq_updates (int)
618 6.58. lreq_callee_headers (string)
619 6.59. event_callback (str)
620 6.60. h_id_start (int)
621 6.61. h_id_step (int)
622 6.62. keep_proxy_rr (string)
623 6.63. bye_early_code (int)
624 6.64. bye_early_reason (string)
625 6.65. dlg_ctxiuid_mode (int)
626 6.66. debug_variables (int)
627 6.67. dlg_mode (int)
628
629 6.1. enable_stats (integer)
630
631 If statistics support should be enabled or not. Via statistics
632 variables, the module provides information about the dialog processing.
633 Set it to zero to disable or to non-zero to enable it.
634
635 Default value is “1 (enabled)”.
636
637 Example 1.1. Set enable_stats parameter
638 ...
639 modparam("dialog", "enable_stats", 0)
640 ...
641
642 6.2. hash_size (integer)
643
644 The size of the hash table internally used to keep the dialogs. A
645 larger table is much faster but consumes more memory. The hash size
646 must be a power of two.
647
648 IMPORTANT: If dialog information should be stored in a database, a
649 constant hash_size should be used, otherwise the restoring process will
650 not take place. If you really want to modify the hash_size, you must
651 delete all table's rows before restarting the server.
652
653 Default value is “4096”.
654
655 Example 1.2. Set hash_size parameter
656 ...
657 modparam("dialog", "hash_size", 1024)
658 ...
659
660 6.3. rr_param (string)
661
662 Name of the Record-Route parameter used to store the dialog cookie. It
663 is used for the fast matching of sequential requests to tracked
664 dialogs.
665
666 Default value is “did”.
667
668 Example 1.3. Set rr_param parameter
669 ...
670 modparam("dialog", "rr_param", "xyz")
671 ...
672
673 6.4. timeout_avp (string)
674
675 The specification of an AVP that contains a custom timeout value (in
676 seconds) for the dialog. It may be used only in a request (initial or
677 sequential) context.
678
679 Default value is “none”.
680
681 Example 1.4. Set timeout_avp parameter
682 ...
683 modparam("dialog", "timeout_avp", "$avp(i:10)")
684 ...
685
686 6.5. default_timeout (integer)
687
688 The default dialog timeout (in seconds), in the absence of a custom
689 value provided in an AVP.
690
691 Default value is “43200 (12 hours)”.
692
693 Example 1.5. Set default_timeout parameter
694 ...
695 modparam("dialog", "default_timeout", 21600)
696 ...
697
698 6.6. early_timeout (integer)
699
700 The timeout (in seconds) after which the dialogs in unconfirmed or
701 early state (no final response received) are destroyed.
702
703 Default value is “300 (5 minutes)”.
704
705 Example 1.6. Set early_timeout parameter
706 ...
707 modparam("dialog", "early_timeout", 180)
708 ...
709
710 6.7. noack_timeout (integer)
711
712 The timeout (in seconds) after which the dialogs which were answered
713 with 200 OK but didn't receive the ACK are marked for termination (the
714 lifetime is set to 10 more seconds).
715
716 Default value is “60 (1 minute)”.
717
718 Example 1.7. Set noack_timeout parameter
719 ...
720 modparam("dialog", "noack_timeout", 90)
721 ...
722
723 6.8. end_timeout (integer)
724
725 The timeout (in seconds) after which the dialogs in terminated state
726 are destroyed.
727
728 Default value is “300 (5 minutes)”.
729
730 Example 1.8. Set end_timeout parameter
731 ...
732 modparam("dialog", "end_timeout", 180)
733 ...
734
735 6.9. dlg_extra_hdrs (string)
736
737 A string containing the extra headers (full format, with EOH) to be
738 added to requests generated locally by the module (like BYEs).
739
740 Default value is “NULL”.
741
742 Example 1.9. Set dlf_extra_hdrs parameter
743 ...
744 modparam("dialog", "dlg_extra_hdrs", "Hint: credit expired\r\n")
745 ...
746
747 6.10. dlg_match_mode (integer)
748
749 How the sequential requests should be matched against the known
750 dialogs. The modes are a combination of matching based on a cookie
751 (DID) stored as cookie in Record-Route header and matching based on SIP
752 elements (as in RFC 3261).
753
754 Note: DID-based matching does not replace callid/fromtag/totag
755 comparison. It will speed up dialog matching by not iterating over the
756 whole dialog list for callid/fromtag/totag comparison, but instead it
757 uses a hash table to find the respective dialog and then doing only one
758 callid/fromtag/totag comparison. Thus, there is no security issue when
759 using DID based matching. Use DID_FALLBACK for maximum interoperability
760 or use DID_ONLY to reject buggy clients or hacking attempts. DID_NONE
761 is only useful, when you want to hide dialog-tracking from the users
762 (preventing the DID Record-Route cookie).
763
764 The supported modes are:
765 * 0 - DID_ONLY - the match is done exclusively based on DID;
766 * 1 - DID_FALLBACK - the match is first tried based on DID and if not
767 present, it will fall back to SIP matching;
768 * 2 - DID_NONE - the match is done exclusively based on SIP elements;
769 no DID information is added in RR.
770
771 Default value is “0 (DID_ONLY)”.
772
773 Example 1.10. Set dlg_match_mode parameter
774 ...
775 modparam("dialog", "dlg_match_mode", 1)
776 ...
777
778 6.11. detect_spirals (integer)
779
780 Whether spirals (i.e., messages routed through the proxy multiple
781 times) should be detected.
782
783 If set to 0, spirals will not be detected and result in the generation
784 of a new, possibly dangling dialog structure per occurring spiral. If
785 set to 1, spirals are detected and internally mapped to existing dialog
786 structures.
787
788 Default value is 1.
789
790 Example 1.11. Set detect_spirals parameter
791 ...
792 modparam("dialog", "detect_spirals", 1)
793 ...
794
795 6.12. db_url (string)
796
797 In order to store information about dialogs in a database, a database
798 URL must be specified.
799
800 Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”.
801
802 Example 1.12. Set db_url parameter
803 ...
804 modparam("dialog", "db_url", "dbdriver://username:password@dbhost/dbname")
805 ...
806
807 6.13. db_mode (integer)
808
809 Mode of synchronisation of dialog information from memory to an
810 underlying database (if desired):
811
812 The supported modes are:
813 * 0 - NO_DB - the memory content is not flushed into DB;
814 * 1 - REALTIME - any dialog information changes will be reflected
815 into the database immediately.
816 * 2 - DELAYED - the dialog information changes will be flushed into
817 DB periodically, based on a timer routine.
818 * 3 - SHUTDOWN - the dialog information will be flushed into DB only
819 at shutdown - no runtime updates.
820
821 Default value is “0”.
822
823 Example 1.13. Set db_mode parameter
824 ...
825 modparam("dialog", "db_mode", 1)
826 ...
827
828 6.14. db_update_period (integer)
829
830 The interval (seconds) at which to update dialogs' information, if the
831 server is configured to store the dialog information at a given
832 interval. A too short interval will generate intensive database
833 operations, while an excessively long one will miss dialogs with a
834 short lifetime.
835
836 Default value is “60” seconds.
837
838 Example 1.14. Set db_update_period parameter
839 ...
840 modparam("dialog", "db_update_period", 120)
841 ...
842
843 6.15. db_fetch_rows (integer)
844
845 The number of the rows to be fetched at once from database when loading
846 the dialog records at startup from the database. This value can be used
847 to tune the load time at startup. For 1MB of private memory (default),
848 it should be below 400. The database driver must support the
849 fetch_result() capability. A value of 0 means the database fetch is not
850 limited.
851
852 Default value is “200”.
853
854 Example 1.15. Set db_fetch_rows parameter
855 ...
856 modparam("dialog", "db_fetch_rows", 500)
857 ...
858
859 6.16. db_skip_load (integer)
860
861 Set db_skip_load to 1, to skip the loading of dialog data from the
862 database.
863
864 Default value is “0” ( not skipped ).
865
866 Example 1.16. Set db_skip_load parameter
867 ...
868 modparam("dialog", "db_skip_load", 1)
869 ...
870
871 6.17. table_name (string)
872
873 Database table name used for storing dialog information.
874
875 Default value is “dialog”.
876
877 Example 1.17. Set table_name parameter
878 ...
879 modparam("dialog", "table_name", "my_dialog")
880 ...
881
882 6.18. call_id_column (string)
883
884 The column name in the database to store the dialog call-id.
885
886 Default value is “callid”.
887
888 Example 1.18. Set call_id_column parameter
889 ...
890 modparam("dialog", "call_id_column", "callid_c_name")
891 ...
892
893 6.19. from_uri_column (string)
894
895 The column name in the database to store the caller's SIP address
896 (URI).
897
898 Default value is “from_uri”.
899
900 Example 1.19. Set from_uri_column parameter
901 ...
902 modparam("dialog", "from_uri_column", "from_uri_c_name")
903 ...
904
905 6.20. from_tag_column (string)
906
907 The column name in the database to store the From header tag from the
908 INVITE request.
909
910 Default value is “from_tag”.
911
912 Example 1.20. Set from_tag_column parameter
913 ...
914 modparam("dialog", "from_tag_column", "from_tag_c_name")
915 ...
916
917 6.21. to_uri_column (string)
918
919 The column name in the database to store the callee's SIP address
920 (URI).
921
922 Default value is “to_uri”.
923
924 Example 1.21. Set to_uri_column parameter
925 ...
926 modparam("dialog", "to_uri_column", "to_uri_c_name")
927 ...
928
929 6.22. to_tag_column (string)
930
931 The column name in the database to store the To header tag from the 200
932 OK response to the INVITE request, if present.
933
934 Default value is “to_tag”.
935
936 Example 1.22. Set to_tag_column parameter
937 ...
938 modparam("dialog", "to_tag_column", "to_tag_c_name")
939 ...
940
941 6.23. from_cseq_column (string)
942
943 The column name in the database to store the Cseq from caller side.
944
945 Default value is “caller_cseq”.
946
947 Example 1.23. Set from_cseq_column parameter
948 ...
949 modparam("dialog", "from_cseq_column", "from_cseq")
950 ...
951
952 6.24. to_cseq_column (string)
953
954 The column name in the database to store the cseq from callee side.
955
956 Default value is “callee_cseq”.
957
958 Example 1.24. Set to_cseq_column parameter
959 ...
960 modparam("dialog", "to_cseq_column", "to_cseq")
961 ...
962
963 6.25. from_route_column (string)
964
965 The column name in the database to store the route records from caller
966 side (proxy to caller).
967
968 Default value is “caller_route_set”.
969
970 Example 1.25. Set from_route_column parameter
971 ...
972 modparam("dialog", "from_route_column", "rroute_from")
973 ...
974
975 6.26. to_route_column (string)
976
977 The column name in the database to store the route records from callee
978 side (proxy to callee).
979
980 Default value is “callee_route_set”.
981
982 Example 1.26. Set to_route_column parameter
983 ...
984 modparam("dialog", "to_route_column", "rroute_to")
985 ...
986
987 6.27. from_contact_column (string)
988
989 The column name in the database to store the caller's contact uri.
990
991 Default value is “caller_contact”.
992
993 Example 1.27. Set from_contact_column parameter
994 ...
995 modparam("dialog", "from_contact_column", "from_contact_uri")
996 ...
997
998 6.28. to_contact_column (string)
999
1000 The column name in the database to store the callee's contact uri.
1001
1002 Default value is “callee_contact”.
1003
1004 Example 1.28. Set to_contact_column parameter
1005 ...
1006 modparam("dialog", "to_contact_column", "to_contact_uri")
1007 ...
1008
1009 6.29. from_sock_column (string)
1010
1011 The column name in the database to store the information about the
1012 local interface receiving the traffic from caller.
1013
1014 Default value is “caller_sock”.
1015
1016 Example 1.29. Set from_sock_column parameter
1017 ...
1018 modparam("dialog", "from_sock_column", "socket_from")
1019 ...
1020
1021 6.30. to_sock_column (string)
1022
1023 The column name in the database to store information about the local
1024 interface receiving the traffic from callee.
1025
1026 Default value is “callee_sock”.
1027
1028 Example 1.30. Set to_sock_column parameter
1029 ...
1030 modparam("dialog", "to_sock_column", "socket_to")
1031 ...
1032
1033 6.31. h_id_column (string)
1034
1035 The column name in the database to store the dialogs' hash id
1036 information.
1037
1038 Default value is “hash_id”.
1039
1040 Example 1.31. Set h_id_column parameter
1041 ...
1042 modparam("dialog", "h_id_column", "hash_id_c_name")
1043 ...
1044
1045 6.32. h_entry_column (string)
1046
1047 The column name in the database to store the dialog's hash entry
1048 information.
1049
1050 Default value is “hash_entry”.
1051
1052 Example 1.32. Set h_entry_column parameter
1053 ...
1054 modparam("dialog", "h_entry_column", "h_entry_c_name")
1055 ...
1056
1057 6.33. state_column (string)
1058
1059 The column name in the database to store the dialog's state
1060 information.
1061
1062 Default value is “state”.
1063
1064 Example 1.33. Set state_column parameter
1065 ...
1066 modparam("dialog", "state_column", "state_c_name")
1067 ...
1068
1069 6.34. start_time_column (string)
1070
1071 The column name in the database to store the dialog's start time
1072 information.
1073
1074 Default value is “start_time”.
1075
1076 Example 1.34. Set start_time_column parameter
1077 ...
1078 modparam("dialog", "start_time_column", "start_time_c_name")
1079 ...
1080
1081 6.35. timeout_column (string)
1082
1083 The column name in the database to store the dialog's timeout.
1084
1085 Default value is “timeout”.
1086
1087 Example 1.35. Set timeout_column parameter
1088 ...
1089 modparam("dialog", "timeout_column", "timeout_c_name")
1090 ...
1091
1092 6.36. sflags_column (string)
1093
1094 The column name in the database to store the dialog script flags.
1095
1096 Default value is “sflags”.
1097
1098 Example 1.36. Set sflags_column parameter
1099 ...
1100 modparam("dialog", "sflags_column", "s_flags")
1101 ...
1102
1103 6.37. toroute_name_column (string)
1104
1105 The column name in the database to store the index of the route to be
1106 executed at timeout.
1107
1108 Default value is “toroute_name”.
1109
1110 Example 1.37. Set toroute_name_column parameter
1111 ...
1112 modparam("dialog", "toroute_name_column", "timeout_route")
1113 ...
1114
1115 6.38. vars_table_name (string)
1116
1117 If you want to store the dialog variables (“$dlg_var(name)”) for a
1118 dialog in a database a table name must be specified.
1119
1120 Default value is “dialog_vars”.
1121
1122 Example 1.38. Set vars_table_name parameter
1123 ...
1124 modparam("dialog", "vars_table_name", "my_dialog_vars")
1125 ...
1126
1127 6.39. vars_h_id_column (string)
1128
1129 The column name in the database to store the dialog's hash id
1130 information (as a reference to the dialog table).
1131
1132 Default value is “hash_id”.
1133
1134 Example 1.39. Set vars_h_id_column parameter
1135 ...
1136 modparam("dialog", "vars_h_id_column", "vars_h_id_name")
1137 ...
1138
1139 6.40. vars_h_entry_column (string)
1140
1141 The column name in the database to store the dialog's hash entry
1142 information (as a reference to the dialog table).
1143
1144 Default value is “hash_entry”.
1145
1146 Example 1.40. Set vars_h_entry_column parameter
1147 ...
1148 modparam("dialog", "vars_h_entry_column", "vars_h_entry_name")
1149 ...
1150
1151 6.41. vars_key_column (string)
1152
1153 The column name in the database to store the names (keys) of a dialog
1154 variable.
1155
1156 Default value is “dialog_key”.
1157
1158 Example 1.41. Set vars_key_column parameter
1159 ...
1160 modparam("dialog", "vars_key_column", "vars_key_name")
1161 ...
1162
1163 6.42. vars_value_column (string)
1164
1165 The column name in the database to store the values of a dialog
1166 variable.
1167
1168 Default value is “dialog_value”.
1169
1170 Example 1.42. Set vars_value_column parameter
1171 ...
1172 modparam("dialog", "vars_value_column", "vars_value_name")
1173 ...
1174
1175 6.43. profiles_with_value (string)
1176
1177 List of names for profiles with values, separated with semi-colon ";".
1178
1179 Default value is “empty”.
1180
1181 Example 1.43. Set profiles_with_value parameter
1182 ...
1183 modparam("dialog", "profiles_with_value", "caller ; my_profile")
1184 ...
1185
1186 6.44. profiles_no_value (string)
1187
1188 List of names for profiles without values, separated with semi-colon
1189 ";".
1190
1191 Default value is “empty”.
1192
1193 Example 1.44. Set profiles_no_value parameter
1194 ...
1195 modparam("dialog", "profiles_no_value", "inbound ; outbound")
1196 ...
1197
1198 6.45. bridge_controller (string)
1199
1200 SIP address to be used in From header when initiating a call bridge.
1201
1202 Default value is “sip:[email protected]”.
1203
1204 Example 1.45. Set bridge_controller parameter
1205 ...
1206 modparam("dialog", "bridge_controller", "sip:[email protected]")
1207 ...
1208
1209 6.46. bridge_contact (string)
1210
1211 SIP address to be used in Contact header when doing a call bridge.
1212
1213 Default value is “sip:[email protected]:5060”.
1214
1215 Example 1.46. Set bridge_contact parameter
1216 ...
1217 modparam("dialog", "bridge_contact", "sip:[email protected]:5060")
1218 ...
1219
1220 6.47. initial_cbs_inscript (int)
1221
1222 If the initial dialog callbacks (i.e., DLGCB_CREATED and
1223 DLGCB_SPIRALED) should be executed in-script or post-script. If
1224 dlg_manage() is not used, the setting of this parameter does not
1225 matter; otherwise, initial callbacks will be executed directly after
1226 dlg_manage() is called if this parameter is enabled. If it is disabled,
1227 initial callback execution will be postponed until configuration script
1228 execution completes.
1229
1230 The supported values are:
1231 * 0 - POST-SCRIPT - execute initial callbacks after the script
1232 completes;
1233 * 1 - IN-SCRIPT - execute initial callbacks during script execution,
1234 i.e., right after dlg_manage() is called;
1235
1236 Default value is “1”.
1237
1238 Example 1.47. Set initial_cbs_inscript parameter
1239 ...
1240 modparam("dialog", "initial_cbs_inscript", 0)
1241 ...
1242
1243 6.48. send_bye (int)
1244
1245 If set to 1, BYE requests will be sent out for each dialog that timed
1246 out. It is an alternative to $dlg_ctx(timeout_bye)=1 for all dialogs.
1247
1248 Default value is “0”.
1249
1250 Example 1.48. Set send_bye parameter
1251 ...
1252 modparam("dialog", "send_bye", 1)
1253 ...
1254
1255 6.49. dlg_filter_mode (int)
1256
1257 Set dialog fitering mode, which can specify what dialogs are processed.
1258 Its value can be a combination (the sum) of following flags:
1259 * 1 - do not send keepalives and do not execute timeout function if
1260 dialog is not local (if the associated bind address is not a local
1261 socket).
1262
1263 Default value is “0”.
1264
1265 Example 1.49. Set dlg_filter_mode parameter
1266 ...
1267 modparam("dialog", "dlg_filter_mode", 1)
1268 ...
1269
1270 6.50. wait_ack (int)
1271
1272 If set to 1, dialog will be kept a bit longer in memory in order to
1273 absorb the ACK negative replies of initial INVITE. If not, the dialog
1274 is destroyed when negative reply is sent out (less internal
1275 complexity).
1276
1277 Default value is “1”.
1278
1279 Example 1.50. Set wait_ack parameter
1280 ...
1281 modparam("dialog", "wait_ack", 0)
1282 ...
1283
1284 6.51. ka_timer (int)
1285
1286 Keep-alive timer step - how often to execute the callback to send
1287 dialog keep alives (SIP OPTIONS requests within dialog). The value
1288 represents the number of seconds.
1289
1290 Default value is “0” (no keep alive).
1291
1292 Example 1.51. Set ka_timer parameter
1293 ...
1294 modparam("dialog", "ka_timer", 10)
1295 ...
1296
1297 6.52. ka_interval (int)
1298
1299 The interval between keep alives within dialog (SIP OPTIONS requests),
1300 sent to caller or callee. The keep alive request will be sent by the
1301 first callback fired by KA timer after the ka_interval elapsed from
1302 dialog setup or previous keep-alive. The value represents the number of
1303 seconds.
1304
1305 If the requests times out (generating a 408) or if the UA responds with
1306 481 the lifetime is set to 10 seconds. When lifetime expires the dialog
1307 will be terminated. Any other response (including error responses) will
1308 reset the timers.
1309
1310 Default value is “0” (no keep alive). The lowest settable interval is
1311 30 seconds.
1312
1313 Example 1.52. Set ka_interval parameter
1314 ...
1315 modparam("dialog", "ka_interval", 300)
1316 ...
1317
1318 6.53. ka_failed_limit (int)
1319
1320 The number of failed keep-alive requests that is accepted before
1321 generating a dialog timeout.
1322
1323 Default value is “1”.
1324
1325 Example 1.53. Set ka_failed_limit parameter
1326 ...
1327 modparam("dialog", "ka_failed_limit", 5)
1328 ...
1329
1330 6.54. timeout_noreset (int)
1331
1332 If set to 1, the dialog timeout won't be reset each time a sequential
1333 request is processed. It is an alternative to
1334 dlg_set_property("timeout-noreset") for all dialogs.
1335
1336 Default value is “0”.
1337
1338 Example 1.54. Set timeout_noreset parameter
1339 ...
1340 modparam("dialog", "timeout_noreset", 1)
1341 ...
1342
1343 6.55. timer_procs (int)
1344
1345 If set to 1, the dialog module will start a separate dialog timer
1346 process to execute dialog timeout tasks. The default is to use the core
1347 timer process.
1348
1349 Default value is “0” (use core timer process).
1350
1351 Example 1.55. Set timer_procs parameter
1352 ...
1353 modparam("dialog", "timer_procs", 1)
1354 ...
1355
1356 6.56. enable_dmq (int)
1357
1358 If set to 1, the dialog will be synced via dmq. For now, only very
1359 basic dialog info is shared, just enough to have synced profiles.
1360 Notably, it is not possible to send in-dialog requests on any but the
1361 original proxy instance.
1362
1363 Default value is “0”.
1364
1365 Example 1.56. Set enable_dmq parameter
1366 ...
1367 modparam("dialog", "enable_dmq", 1)
1368 ...
1369
1370 6.57. track_cseq_updates (int)
1371
1372 Enable the callbacks for tracking if CSeq number needs to be updated.
1373 It is the case when the INVITE has to be authenticated to downstream
1374 provider using uac_auth() from uac module.
1375
1376 This is done only for requests in downstream direction. The CSeq
1377 difference is stored in $dlg_var(cseq_diff), be sure this variable is
1378 not overwritten via config operation.
1379
1380 Default value is “0” (disabled).
1381
1382 Example 1.57. Set track_cseq_updates parameter
1383 ...
1384 modparam("dialog", "track_cseq_updates", 1)
1385 ...
1386
1387 6.58. lreq_callee_headers (string)
1388
1389 SIP headers to be added when sending local generated requests (e.g.,
1390 BYE) to callee. It can be useful when you use topoh module with call-id
1391 masking (see the docs of topoh module).
1392
1393 Default value is “null”.
1394
1395 Example 1.58. Set lreq_callee_headers parameter
1396 ...
1397 modparam("dialog", "lreq_callee_headers", "TH: dlh\r\n")
1398 ...
1399
1400 6.59. event_callback (str)
1401
1402 The name of the function in the kemi configuration file (embedded
1403 scripting language such as Lua, Python, ...) to be executed instead of
1404 event_route[...] blocks.
1405
1406 The function receives a string parameter with the name of the event,
1407 the values are: 'dialog:start', 'dialog:end', 'dialog:failed'. It is
1408 also executed if '$dlg_ctx(timeout_route)' is set, the callback
1409 function being executed with the variable value as parameter.
1410
1411 Default value is 'empty' (no function is executed for events).
1412
1413 Example 1.59. Set event_callback parameter
1414 ...
1415 modparam("dialog", "event_callback", "ksr_dialog_event")
1416 ...
1417 -- event callback function implemented in Lua
1418 function ksr_dialog_event(evname)
1419 KSR.info("===== dialog module triggered event: " .. evname .. "\n");
1420 return 1;
1421 end
1422 ...
1423
1424 6.60. h_id_start (int)
1425
1426 Set the offset to be used for generating dialog internal hash id. If
1427 set to -1, the h_id_start is set to the value of the server_id global
1428 parameter.
1429
1430 Default value is “0”.
1431
1432 Example 1.60. Set h_id_start parameter
1433 ...
1434 modparam("dialog", "h_id_start", 5)
1435 ...
1436
1437 6.61. h_id_step (int)
1438
1439 Set the step to increment the dialog internal hash id.
1440
1441 If the value is greater than 1, the internal hash id is generated with
1442 the rule: h_id_start + N * h_id_step. The first value of N is randomly
1443 selected at startup, then incremented by 1 for each new dialog. Setting
1444 h_id_start and h_id_step to non-default values should be done when
1445 using dlg_db_load_callid(...) or dlg_db_load_extra() to load dialog
1446 records generated by another Kamailio instance. Pay attention to ensure
1447 that those Kamailio instances are not going to generate overlapping
1448 dialog hash id values by using different h_id_start and the same
1449 h_id_step (h_id_step has to be greater than the maximum value of
1450 h_id_start).
1451
1452 Default value is “1”.
1453
1454 Example 1.61. Set h_id_step parameter
1455 ...
1456 modparam("dialog", "h_id_step", 10)
1457 ...
1458
1459 6.62. keep_proxy_rr (string)
1460
1461 Whether to keep the record-route header added by the proxy. When
1462 enabled, it will keep this proxy's record-route header from the reply.
1463 The result is that generated requests like the BYE from the dlg_end_dlg
1464 mi function will pass through the proxy (looped).
1465
1466 Valid values are:
1467 * 0 - Don't keep any proxy Record-Route headers
1468 * 1 - Keep Record-route headers for the callee leg
1469 * 2 - Keep Record-route headers for the caller leg
1470 * 3 - Keep Record-route headers for both legs
1471
1472 Default value is “0”.
1473
1474 Example 1.62. Set dlg_keep_proxy_rr parameter
1475 ...
1476 modparam("dialog", "keep_proxy_rr", 1)
1477 ...
1478
1479 6.63. bye_early_code (int)
1480
1481 This parameter defines the reply-code being used for dialogs being
1482 terminated in early stage (e.g. before 200 OK/ACK).
1483 Default value is “480”.
1484
1485 Example 1.63. Set bye_early_code parameter
1486 ...
1487 modparam("dialog", "bye_early_code", 503)
1488 ...
1489
1490 6.64. bye_early_reason (string)
1491
1492 This parameter defines the reply-reason being used for dialogs being
1493 terminated in early stage (e.g. before 200 OK/ACK).
1494 Default value is “Temporarily Unavailable”.
1495
1496 Example 1.64. Set bye_early_reason parameter
1497 ...
1498 modparam("dialog", "bye_early_reason", "Call terminated")
1499 ...
1500
1501 6.65. dlg_ctxiuid_mode (int)
1502
1503 Set dialog context iuid mode, which can specify additional cases when
1504 the internal unique id should be set:
1505 * 1 - set it when processing CANCEL requests.
1506
1507 Default value is “0”.
1508
1509 Example 1.65. Set dlg_ctxiuid_mode parameter
1510 ...
1511 modparam("dialog", "dlg_ctxiuid_mode", 1)
1512 ...
1513
1514 6.66. debug_variables (int)
1515
1516 Activate additional debugging for printing internal lists for dialog
1517 variables. This output is only visible at debug log level and should
1518 only be used for debugging. By default it is deactivated.
1519
1520 Default value is “0”.
1521
1522 Example 1.66. Set debug_variables parameter
1523 ...
1524 modparam("dialog", "debug_variables", 1)
1525 ...
1526
1527 6.67. dlg_mode (int)
1528
1529 Control how dialog state management is done. If set to 0, the the
1530 management is done with tm module callbacks; if set to 1, tm callbacks
1531 are not used, states have to be set from config.
1532
1533 Default value is “0”.
1534
1535 Example 1.67. Set dlg_mode parameter
1536 ...
1537 modparam("dialog", "dlg_mode", 1)
1538 ...
1539
1540 7. Functions
1541
1542 7.1. set_dlg_profile(profile[, value])
1543 7.2. unset_dlg_profile(profile[, value])
1544 7.3. is_in_profile(profile[, value])
1545 7.4. get_profile_size(profile[, value], size)
1546 7.5. dlg_isflagset(flag)
1547 7.6. dlg_setflag(flag)
1548 7.7. dlg_resetflag(flag)
1549 7.8. dlg_bye(side)
1550 7.9. dlg_refer(side, address)
1551 7.10. dlg_refer_did(h_entry, h_id, side, address)
1552 7.11. dlg_refer_dcid(callid, side, address)
1553 7.12. dlg_manage()
1554 7.13. dlg_bridge(from, to, op)
1555 7.14. dlg_get(callid, ftag, ttag)
1556 7.15. dlg_get_var(callid, ftag, ttag, name, dst)
1557 7.16. dlg_set_var(callid, ftag, ttag, name, value)
1558 7.17. is_known_dlg()
1559 7.18. dlg_set_timeout(timeout [, h_entry, h_id])
1560 7.19. dlg_set_timeout_by_profile(profile, [value], timeout)
1561 7.20. dlg_set_property(attr)
1562 7.21. dlg_remote_profile(cmd, profile, value, uid, expires)
1563 7.22. dlg_set_ruri()
1564 7.23. dlg_db_load_callid(cival)
1565 7.24. dlg_db_load_extra()
1566 7.25. dlg_reset_property(attr)
1567 7.26. dlg_req_within(side, method, [headers], [content_type, content])
1568 7.27. dlg_set_state(newstate)
1569
1570 7.1. set_dlg_profile(profile[, value])
1571
1572 Inserts the current dialog into a profile. Note that if the profile
1573 does not support values, they will be silently discarded. Also, there
1574 is no check for inserting the same dialog into the same profile
1575 multiple times.
1576
1577 Meaning of the parameters is as follows:
1578 * profile - name of the profile to be added to;
1579 * value (optional) - string value to define the membership of the
1580 dialog in the profile. Note that the profile must support values.
1581 Pseudo-variables are supported.
1582
1583 This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE
1584 and FAILURE_ROUTE.
1585
1586 Example 1.68. set_dlg_profile usage
1587 ...
1588 set_dlg_profile("inbound_call");
1589 set_dlg_profile("caller","$fu");
1590 ...
1591
1592 7.2. unset_dlg_profile(profile[, value])
1593
1594 Removes the current dialog from a profile.
1595
1596 Meaning of the parameters is as follows:
1597 * profile - name of the profile to be removed from;
1598 * value (optional) - string value to define the belonging of the
1599 dialog to the profile - note that the profile must support values.
1600 Pseudo-variables are supported.
1601
1602 This function can be used from BRANCH_ROUTE, REPLY_ROUTE and
1603 FAILURE_ROUTE.
1604
1605 Example 1.69. unset_dlg_profile usage
1606 ...
1607 unset_dlg_profile("inbound_call");
1608 unset_dlg_profile("caller","$fu");
1609 ...
1610
1611 7.3. is_in_profile(profile[, value])
1612
1613 Checks if the current dialog belongs to a profile. If the profile is
1614 defined with values, then the check is also matching with the specific
1615 value provided as parameter.
1616
1617 Note that if the profile is not defined with support for values, the
1618 value parameter will be silently discarded.
1619
1620 Meaning of the parameters is as follows:
1621 * profile - name of the profile to be checked against;
1622 * value (optional) - string value to be matched during the check.
1623 Pseudo-variables are supported.
1624
1625 This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE
1626 and FAILURE_ROUTE.
1627
1628 Example 1.70. is_in_profile usage
1629 ...
1630 if (is_in_profile("inbound_call")) {
1631 log("this request belongs to an inbound call\n");
1632 }
1633 ...
1634 if (is_in_profile("caller","XX")) {
1635 log("this request belongs to a call of user XX\n");
1636 }
1637 ...
1638
1639 7.4. get_profile_size(profile[, value], size)
1640
1641 Returns the number of dialogs belonging to a profile. If the profile
1642 supports values, the check can be reinforced to take into account a
1643 specific value, i.e. how many dialogs were inserted into the profile
1644 with a specific value. If no value is passed, only the membership of
1645 the dialog in the profile per se is checked. Note that if the profile
1646 does not support values, the value parameter will be silently
1647 discarded.
1648
1649 Meaning of the parameters is as follows:
1650 * profile - name of the profile to get the size for;
1651 * value (optional) - string value to further restrict the check.
1652 Pseudo-variables are supported;
1653 * size - an AVP or script variable to return the profile size in.
1654
1655 This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE
1656 and FAILURE_ROUTE.
1657
1658 Example 1.71. get_profile_size usage
1659 ...
1660 if(get_profile_size("inbound_call","$avp(size)"))
1661 xlog("currently there are $avp(size) inbound calls\n");
1662 ...
1663 if(get_profile_size("caller","$fu","$avp(size)"))
1664 xlog("currently, the user $fu has $avp(size) active outgoing calls\n");
1665 ...
1666
1667 7.5. dlg_isflagset(flag)
1668
1669 Check if the dialog flag is set or not.
1670
1671 Meaning of the parameters is as follows:
1672 * flag - index of the flag - can be pseudo-variable.
1673
1674 This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
1675 ONREPLY_ROUTE and FAILURE_ROUTE.
1676
1677 Example 1.72. dlg_isflagset usage
1678 ...
1679 if(dlg_isflagset("1"))
1680 {
1681 ...
1682 }
1683 ...
1684
1685 7.6. dlg_setflag(flag)
1686
1687 Set a dialog flag.
1688
1689 Meaning of the parameters is as follows:
1690 * flag - index of the flag - can be pseudo-variable.
1691
1692 This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
1693 ONREPLY_ROUTE and FAILURE_ROUTE.
1694
1695 Example 1.73. dlg_setflag usage
1696 ...
1697 dlg_setflag("1");
1698 ...
1699
1700 7.7. dlg_resetflag(flag)
1701
1702 Reset the dialog flag.
1703
1704 Meaning of the parameters is as follows:
1705 * flag - index of the flag - can be pseudo-variable.
1706
1707 This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
1708 ONREPLY_ROUTE and FAILURE_ROUTE.
1709
1710 Example 1.74. dlg_resetflag usage
1711 ...
1712 dlg_resetflag("1");
1713 ...
1714
1715 7.8. dlg_bye(side)
1716
1717 Send BYE to parties of a dialog or - if in early stage - a CANCEL to
1718 the B-Party and a SIP response to the A-Party (as defined in
1719 bye_early_code / bye_early_reason).
1720
1721 Meaning of the parameters is as follows:
1722 * side - where to send the BYE. It can be: 'caller', 'callee', or
1723 'all' (send to both sides).
1724
1725 This function can be used from ANY_ROUTE.
1726
1727 Example 1.75. dlg_bye usage
1728 ...
1729 dlg_bye("all");
1730 ...
1731
1732 7.9. dlg_refer(side, address)
1733
1734 Refer the 'side' to a new SIP 'address'.
1735
1736 Meaning of the parameters is as follows:
1737 * side - which side of the dialog to REFER. It can be: 'caller' or
1738 'callee'.
1739 * address - SIP address to refer to.
1740
1741 This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
1742 ONREPLY_ROUTE and FAILURE_ROUTE.
1743
1744 Example 1.76. dlg_refer usage
1745 ...
1746 dlg_refer("caller", "sip:[email protected]");
1747 ...
1748
1749 7.10. dlg_refer_did(h_entry, h_id, side, address)
1750
1751 Refer the 'side' of the identified dialog to a new SIP 'address'.
1752
1753 Meaning of the parameters is as follows:
1754 * h_entry - hash entry of the dialog in the internal dialog table
1755 * h_id - hash id of the dialog on the hash entry
1756 * side - which side of the dialog to REFER. It can be: 'caller' or
1757 'callee'.
1758 * address - SIP address to refer to.
1759
1760 The parameters can contain variables.
1761
1762 This function can be used from ANY_ROUTE.
1763
1764 Example 1.77. dlg_refer_did usage
1765 ...
1766 dlg_refer_did("246","468", "caller", "sip:[email protected]");
1767 ...
1768
1769 7.11. dlg_refer_dcid(callid, side, address)
1770
1771 Refer the 'side' of the first matching dialog by call-id to a new SIP
1772 'address'.
1773
1774 Meaning of the parameters is as follows:
1775 * callid - call-id of the dialog
1776 * side - which side of the dialog to REFER. It can be: 'caller' or
1777 'callee'.
1778 * address - SIP address to refer to.
1779
1780 The parameters can contain variables.
1781
1782 This function can be used from ANY_ROUTE.
1783
1784 Example 1.78. dlg_refer_cid usage
1785 ...
1786 dlg_refer_cid("abcd-efgh-ijkl", "caller", "sip:[email protected]");
1787 ...
1788
1789 7.12. dlg_manage()
1790
1791 Process current SIP request with dialog module.
1792
1793 This function can be used from REQUEST_ROUTE.
1794
1795 Example 1.79. dlg_manage usage
1796 ...
1797 modparam("dialog", "default_timeout", 100)
1798 ...
1799 request_route {
1800 ...
1801 if(is_method("INVITE") && !has_totag())
1802 {
1803 $dlg_ctx(timeout_route) = "DLGTIMEOUT";
1804 $dlg_ctx(timeout_bye) = 1;
1805 }
1806 dlg_manage();
1807 ...
1808 }
1809 ...
1810
1811 7.13. dlg_bridge(from, to, op)
1812
1813 Bridge 'from' SIP address to 'to' SIP address via outbound proxy 'op'.
1814
1815 Meaning of the parameters is as follows:
1816 * from - SIP address of first side to call.
1817 * to - SIP address to refer “from” to.
1818 * op - outbound proxy SIP address.
1819
1820 This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
1821 ONREPLY_ROUTE and FAILURE_ROUTE.
1822
1823 Example 1.80. dlg_bridge usage
1824 ...
1825 dlg_bridge("sip:[email protected]", "sip:[email protected]",
1826 "sip:kamailio.org:5080");
1827 ...
1828
1829 7.14. dlg_get(callid, ftag, ttag)
1830
1831 Search and set current dialog based on Call-ID, From-Tag and To-Tag
1832 parameters.
1833
1834 Meaning of the parameters is as follows:
1835 * callid - SIP call-id.
1836 * ftag - SIP From tag.
1837 * ttag - SIP To tag (it can be empty string to match a dialog during
1838 call setup (eg., match for CANCEL)).
1839
1840 This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
1841 ONREPLY_ROUTE and FAILURE_ROUTE.
1842
1843 Example 1.81. dlg_get usage
1844 ...
1845 if(dlg_get("abcdef", "123", "456"))
1846 {
1847 dlg_bye("all");
1848 }
1849 ...
1850
1851 7.15. dlg_get_var(callid, ftag, ttag, name, dst)
1852
1853 Get dlg_var of another dialog value based on Call-ID, From-Tag and
1854 To-Tag parameters.
1855
1856 Meaning of the parameters is as follows:
1857 * callid - SIP call-id.
1858 * ftag - SIP From tag.
1859 * ttag - SIP To tag. Use "" value to indicate early dialog.
1860 * name - key name of the $dlg_var.
1861 * dst - pv to store the value of $dlg_var(name).
1862
1863 This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
1864 ONREPLY_ROUTE and FAILURE_ROUTE.
1865
1866 Example 1.82. dlg_get_var usage
1867 ...
1868 if(dlg_get_var("$var(ci)", "$var(ft)", "456", "test", "$var(tmp)"))
1869 {
1870 xdbg("$$dlg_var(test):$var(tmp)\n");
1871 }
1872 ...
1873
1874 7.16. dlg_set_var(callid, ftag, ttag, name, value)
1875
1876 Set dlg_var of another dialog value based on Call-ID, From-Tag and
1877 To-Tag parameters.
1878
1879 Meaning of the parameters is as follows:
1880 * callid - SIP call-id.
1881 * ftag - SIP From tag.
1882 * ttag - SIP To tag. Use "" value to indicate early dialog.
1883 * name - key name of the $dlg_var.
1884 * value - string value to store at $dlg_var(name).
1885
1886 This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
1887 ONREPLY_ROUTE and FAILURE_ROUTE.
1888
1889 Example 1.83. dlg_set_var usage
1890 ...
1891 if(dlg_set_var("$var(ci)", "$var(ft)", "456", "test", "$var(tmp)"))
1892 {
1893 xdbg("set $$dlg_var(test):$var(tmp)\n");
1894 }
1895 # you can set vars in early dialog too
1896 if(dlg_set_var("$var(ci)", "$var(ft)", "", "test", "$var(tmp)"))
1897 {
1898 xdbg("set $$dlg_var(test):$var(tmp)\n");
1899 }
1900 ...
1901
1902 7.17. is_known_dlg()
1903
1904 This function checks if the current SIP message being processed belongs
1905 to any transaction within an active dialog that the dialog module is
1906 currently tracking. This is a check for tracking of any kind, without
1907 regard to profiles.
1908
1909 This function has numerous potential applications, among which is that
1910 it can be used to strengthen security for loose-routing sequential
1911 (in-dialog) requests or responses to them, as by providing a
1912 preventative check against spoofing on the proxy level instead of
1913 leaving the issue purely to the receiving UA.
1914
1915 This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE
1916 and FAILURE_ROUTE.
1917
1918 Example 1.84. is_known_dlg() usage
1919 ...
1920 if(!uri == myself) {
1921 if(is_known_dlg()) {
1922 xlog("Request $rm from $ci is in-dialog\n");
1923 }
1924 }
1925 ...
1926
1927 7.18. dlg_set_timeout(timeout [, h_entry, h_id])
1928
1929 Set the dialog timeout. Dialog timeout will be updated if it was
1930 already set. If h_entry and h_id parameters are not provided, the
1931 dialog will be searched based on (callid, fromtag, totag) of currently
1932 processed SIP message.
1933
1934 Meaning of the parameters is as follows:
1935 * timeout - the interval in seconds after which the dialog will time
1936 out.
1937 * h_entry - h_entry value of the iternal dialog identifier.
1938 * h_id - h_id value if the internal dialog identifier.
1939
1940 This function can be used from ANY_ROUTE.
1941
1942 Example 1.85. dlg_set_timeout usage
1943 ...
1944 if(dlg_set_timeout("180", "123", "456"))
1945 {
1946 ...
1947 }
1948 ...
1949
1950 7.19. dlg_set_timeout_by_profile(profile, [value], timeout)
1951
1952 Like dlg_set_timeout(), but simultaneously sets the timeout of all
1953 dialogs in a given profile. Can be constrained by profile value.
1954
1955 Meaning of the parameters is as follows:
1956 * profile - The dialog profile across which to apply the timeout.
1957 value (optional) - The profile value to use when applying the
1958 dialog timeout.
1959 timeout - the interval in seconds after which the dialog will time
1960 out.
1961
1962 This function can be used from ANY_ROUTE.
1963
1964 Example 1.86. dlg_set_timeout_by_profile usage
1965 ...
1966 # All dialogs belonging to user abc123 (tracked via set_dlg_profile())
1967 # will be timed out in 3 seconds.
1968
1969 dlg_set_timeout_by_profile("users", "abc123", "3");
1970 ...
1971
1972 7.20. dlg_set_property(attr)
1973
1974 Set a dialog property - an attribute that enable/disable various
1975 behaviours (e.g., sending keep alive requests).
1976
1977 Meaning of the parameters is as follows:
1978 * attr - name of property. It can be:
1979 + 'ka-src' - send keep alive OPTION requests to caller
1980 + 'ka-dst' - send keep alive OPTION requests to callee
1981 + 'timeout-noreset' - don't reset timeout on in-dialog messages
1982 reception
1983
1984 If keep alive is enabled for a dialog, the module will send SIP OPTIONS
1985 requests with CSeq lower or equal than last request within dialog, with
1986 the scope of detecting if the destination is still in the call. If the
1987 keep alive request results in a local timeout or '481 Call
1988 Leg/Transaction Does Not Exist', then the dialog is ended from the
1989 server.
1990
1991 If 'timeout-noreset' is set, dialog timeout won't be reset upon
1992 reception of in-dialog messages (default behavior).
1993
1994 This function can be used from ANY_ROUTE.
1995
1996 Example 1.87. dlg_set_property usage
1997 ...
1998 dlg_set_property("ka-src");
1999 dlg_set_property("ka-dst");
2000 dlg_set_property("timeout-noreset");
2001 ...
2002
2003 7.21. dlg_remote_profile(cmd, profile, value, uid, expires)
2004
2005 Manage remote profile via config file. A remote profile item is
2006 considered when the dialog is not managed by this server instance. The
2007 notification to add/remove can be received via SIP or a RPC command,
2008 the operation can be then triggered from configuration file. This
2009 should allow counting active dialogs in a profile that are managed by
2010 multiple SIP server instances.
2011
2012 Meaning of the parameters is as follows:
2013 * cmd - the operations to do: add - add an item in profile; rm -
2014 remove an item from profile
2015 * profile - name of profile
2016 * value - value for profile (if no value is needed for that profile,
2017 use an empty string.
2018 * expires - absolute time (unix timestamp) when this profile item
2019 should be removed automatically (time based), if still in the
2020 profile
2021
2022 This function can be used from ANY_ROUTE.
2023
2024 Example 1.88. dlg_remote_profile usage
2025 ...
2026 $var(exp) = 3600 + $Ts;
2027 dlg_remote_profile("add", "caller", "test", "$sruid", "$var(exp)");
2028 ...
2029
2030 7.22. dlg_set_ruri()
2031
2032 This function sets the R-URI with the corresponding endpoint address
2033 stored in dialog structure (i.e., its Contact field).
2034
2035 This function can be used from ANY_ROUTE.
2036
2037 Example 1.89. dlg_set_ruri() usage
2038 ...
2039 if(has_totag() and is_present_hf("Route") and uri==myself ) {
2040 if(dlg_set_ruri()) {
2041 xlog("Request URI changed from [$ou] to dlg value: [$ru]\n");
2042 }
2043 }
2044 ...
2045
2046 7.23. dlg_db_load_callid(cival)
2047
2048 Load dialog record from database matching on Call-Id provided as
2049 parameter.
2050
2051 This function can be used from ANY_ROUTE.
2052
2053 Example 1.90. dlg_db_load_callid() usage
2054 ...
2055 if(has_totag()) {
2056 if(!is_known_dlg()) {
2057 dlg_db_load_callid("$ci");
2058 if(!is_known_dlg()) {
2059 xlog("no dialog found with callid: $ci\n");
2060 }
2061 }
2062 }
2063 ...
2064
2065 7.24. dlg_db_load_extra()
2066
2067 Load all dialog records from database that are not in memory of the
2068 current Kamailio instance.
2069
2070 This function can be used from ANY_ROUTE.
2071
2072 Example 1.91. dlg_db_load_extra() usage
2073 ...
2074 if(has_totag()) {
2075 if(!is_known_dlg()) {
2076 dlg_db_load_extra();
2077 if(!is_known_dlg()) {
2078 xlog("no dialog found with callid: $ci\n");
2079 }
2080 }
2081 }
2082 ...
2083
2084 7.25. dlg_reset_property(attr)
2085
2086 Reset a dialog property - an attribute that enable/disable various
2087 behaviours (e.g., sending keep alive requests).
2088
2089 Meaning of the parameters is as follows:
2090 * attr - name of property. It can be:
2091 + 'ka-src' - send keep alive OPTION requests to caller
2092 + 'ka-dst' - send keep alive OPTION requests to callee
2093 + 'timeout-noreset' - don't reset timeout on in-dialog messages
2094 reception
2095
2096 This function can be used from ANY_ROUTE.
2097
2098 Example 1.92. dlg_reset_property usage
2099 ...
2100 dlg_reset_property("ka-src");
2101 dlg_reset_property("ka-dst");
2102 dlg_reset_property("timeout-noreset");
2103 ...
2104
2105 7.26. dlg_req_within(side, method, [headers], [content_type, content])
2106
2107 Sends an in-dialog SIP Request with method to a party of a dialog
2108 indicated by the side parameter.
2109
2110 Meaning of the parameters is as follows:
2111 * side - where to send the request. It can be: 'caller', 'callee', or
2112 'all' (send to both sides).
2113 * method - Method of the request
2114 * headers (optional) - additional headers to be added to the request.
2115 * content_type (optional) - Content-Type of the request body - will
2116 be added as Content-Type Header.
2117 * content (optional) - Content to be sent as body.
2118
2119 This function can be used from ANY_ROUTE.
2120
2121 Example 1.93. dlg_req_within usage
2122 ...
2123 # Send a simple request:
2124 dlg_req_within("all", "OPTIONS");
2125 ...
2126 # Send a simple request with extra headers:
2127 dlg_req_within("caller", "OPTIONS", "X-Info: Bandwidth granted\r\nX-Info
2128 -2: Go ahead\r\n");
2129 ...
2130 # Send a simple request with body:
2131 dlg_req_within("caller", "UPDATE", "application/sdp", "...some SDP...");
2132 ...
2133 # Send a simple request with extra headers and body:
2134 dlg_req_within("callee", "INFO", "X-Info: Bandwidth granted\r\n", "appli
2135 cation/sdp", "...some SDP...");
2136 ...
2137
2138 7.27. dlg_set_state(newstate)
2139
2140 Set the state for dialog matching current message.
2141
2142 Meaning of the parameters is as follows:
2143 * newstate - the new state. It can be:
2144 + 'unconfirmed'
2145 + 'early'
2146 + 'answered'
2147 + 'confirmed'
2148 + 'deleted'
2149
2150 This function can be used from ANY_ROUTE.
2151
2152 Example 1.94. dlg_set_state usage
2153 ...
2154 dlg_set_state("early");
2155 ...
2156
2157 8. Statistics
2158
2159 8.1. active_dialogs
2160 8.2. early_dialogs
2161 8.3. processed_dialogs
2162 8.4. expired_dialogs
2163 8.5. failed_dialogs
2164
2165 8.1. active_dialogs
2166
2167 Returns the number of current active dialogs (may be confirmed or not).
2168
2169 8.2. early_dialogs
2170
2171 Returns the number of early dialogs.
2172
2173 8.3. processed_dialogs
2174
2175 Returns the total number of processed dialogs (terminated, expired or
2176 active) from the startup.
2177
2178 8.4. expired_dialogs
2179
2180 Returns the total number of expired dialogs from the startup.
2181
2182 8.5. failed_dialogs
2183
2184 Returns the number of failed dialogs.
2185
2186 9. RPC Commands
2187
2188 9.1. dlg.list
2189 9.2. dlg.list_ctx
2190 9.3. dlg.list_match
2191 9.4. dlg.list_match_ctx
2192 9.5. dlg.dump_file
2193 9.6. dlg.dlg_list
2194 9.7. dlg.dlg_list_ctx
2195 9.8. dlg.terminate_dlg
2196 9.9. dlg.end_dlg
2197 9.10. dlg.set_state
2198 9.11. dlg.profile_get_size
2199 9.12. dlg.profile_list
2200 9.13. dlg.bridge_dlg
2201 9.14. dlg.stats_active
2202 9.15. dlg.is_alive
2203 9.16. dlg.briefing
2204
2205 9.1. dlg.list
2206
2207 Lists the description of all dialogs (active calls).
2208
2209 Name: dlg.list
2210
2211 RPC Command Format:
2212 ...
2213 kamctl rpc dlg.list
2214 ...
2215
2216 9.2. dlg.list_ctx
2217
2218 The same as the “dlg_list” but including in the dialog description the
2219 associated context from modules sitting on top of the dialog module.
2220
2221 Name: dlg.list_ctx
2222
2223 RPC Command Format:
2224 ...
2225 kamctl rpc dlg.list_ctx
2226 ...
2227
2228 9.3. dlg.list_match
2229
2230 Lists the details of matching dialogs. The parameters specify the
2231 matching key, operator, value and optionally a limit of matched
2232 dialogs.
2233
2234 Name: dlg.list_match
2235
2236 Parameters:
2237 * mkey - matching key. It can be: 'ruri' - match against R-URI of the
2238 dialog; 'furi' - match against From header URI of the dialog;
2239 'turi' - match against the To header URI of the dialog; 'callid' -
2240 match against Call-Id value; 'start_ts' - match against start
2241 timestamp.
2242 * mop - matching operator. It can be: 'eq' - match using string
2243 comparison; 're' - match using regular expression; 'sw' - match
2244 using starts-with (prefix) comparison; 'gt' - match using integer
2245 greater comparison; 'lt' - match using integer lesser comparison.
2246 Integer comparison can be used only with 'start_ts' key.
2247 * mval - matching value.
2248 * limit (optional) - limit of matched dialogs.
2249
2250 RPC Command Format:
2251 ...
2252 kamctl rpc dlg.list_match furi eq sip:[email protected] 2
2253 ...
2254 kamctl rpc dlg.list_match furi sw sip:alice@
2255 ...
2256 kamctl rpc dlg.list_match start_ts gt s:1641550904
2257 ...
2258
2259 9.4. dlg.list_match_ctx
2260
2261 Similar to “dlg.list_match”, but including in the attributes associated
2262 with the dialog context from modules sitting on top of the dialog
2263 module.
2264
2265 Name: dlg.list_match_ctx
2266
2267 RPC Command Format:
2268 ...
2269 kamctl rpc dlg.list_match_ctx furi sw sip:alice@
2270 ...
2271
2272 9.5. dlg.dump_file
2273
2274 Dump all dialogs in a json file. (much faster than dlg.list)
2275
2276 Name: dlg.dump_file
2277
2278 Parameters:
2279 * file name output file name
2280
2281 RPC Command Format:
2282 ...
2283 kamctl rpc dlg.dump_file "/tmp/dlg.json"
2284 ...
2285
2286 9.6. dlg.dlg_list
2287
2288 Lists the description of one dialog. The dialog identifiers are to be
2289 passed as parameter (callid and optionally fromtag).
2290
2291 Name: dlg.dlg_list
2292
2293 Parameters:
2294 * callid callid of the dialog to be listed.
2295 * from_tag from tag (as per initial request) of the dialog to be
2296 listed.
2297
2298 RPC Command Format:
2299 ...
2300 kamctl rpc dlg.dlg_list [email protected] AAdfeEFF33
2301 ...
2302 kamctl rpc dlg.dlg_list [email protected]
2303 ...
2304
2305 9.7. dlg.dlg_list_ctx
2306
2307 The same as the “dlg.list_list” but including in the dialog description
2308 the associated context from modules sitting on top of the dialog
2309 module.
2310
2311 Name: dlg.dlg_list_ctx
2312
2313 Parameters: see “dlg_list”
2314
2315 RPC Command Format:
2316 ...
2317 kamctl rpc dlg.list_ctx [email protected] AAdfeEFF33
2318 ...
2319 kamctl rpc dlg.list_ctx [email protected]
2320 ...
2321
2322 9.8. dlg.terminate_dlg
2323
2324 Terminates an ongoing dialog by sending BYE in both directions,
2325 matching the dialog on call-id, from tag and to tag.
2326
2327 Name: dlg.terminate_dlg
2328
2329 Parameters:
2330 * callid - callid of dialog to be terminated
2331 * from_tag - from tag of the dialog to terminated
2332 * to_tag - to tag of the dialog to terminated
2333
2334 The command works only for confirmed dialogs.
2335
2336 RPC Command Format:
2337 kamctl rpc dlg.terminate_dlg callid12345 fromtag123 totag123
2338
2339 9.9. dlg.end_dlg
2340
2341 Terminates an ongoing dialog by sending BYE in both directions.
2342
2343 Name: dlg.end_dlg
2344
2345 Parameters:
2346 * h_entry - hash entry of the dialog in the internal dialog table
2347 * h_id - hash id of the dialog on the hash entry
2348 * extra_hdrs - (optional) string containg extra headers (full format)
2349 to be added to the BYE requests.
2350
2351 The values for the h_entry and h_id can be obtained via the dlg_list
2352 RPC command.
2353
2354 RPC Command Format:
2355 ...
2356 kamctl rpc dlg.end_dlg 342 56
2357 ...
2358
2359 9.10. dlg.set_state
2360
2361 Set state for the dialog matching the dialog on Call-ID, From-Tag and
2362 To-Tag.
2363
2364 Name: dlg.kill_active_dlg
2365
2366 Parameters:
2367 * callid - Call-ID of active dialog to kill
2368 * from_tag - From-Tag of active dialog to kill
2369 * to_tag - To-tag of active dialog to kill
2370 * state - The value for new state
2371
2372 At this moment, the command targets the need to change from active
2373 dialogs (state 4) to terminated state (5), although it allows setting
2374 other state value. Be careful using with it, it can cause side effects
2375 and the terminated dialog is wiped out silently. Dialog ending
2376 functions are not executed, such as accounting end-of-call events,
2377 dialog-end events, module-generated BYE requests, etc. After executing
2378 the command, dialog remains in memory until execution of the recurring
2379 function in charge of removing old dialogs (a "dialog in delete state
2380 is too old" will then be logged).
2381
2382 RPC Command Format:
2383 ...
2384 kamctl rpc dlg.set_state callid12345 fromtag123 totag123 5
2385 ...
2386
2387 9.11. dlg.profile_get_size
2388
2389 Returns the number of dialogs belonging to a profile. If the profile
2390 supports values, the check can be reinforced to take into account a
2391 specific value - how many dialogs were inserted into the profile with a
2392 specific value. If no value is passed, only the simply belonging of the
2393 dialog to the profile is checked. Note that if the profile does not
2394 support values, the value parameter will be silently discarded.
2395
2396 Name: dlg.profile_get_size
2397
2398 Parameters:
2399 * profile - name of the profile to get the value for.
2400 * value (optional)- string value to further restrict the check;
2401
2402 RPC Command Format:
2403 ...
2404 kamctl rpc dlg.dlg.profile_get_size inbound_calls
2405 ...
2406
2407 9.12. dlg.profile_list
2408
2409 Lists all the dialogs belonging to a profile. If the profile supports
2410 values, the check can be reinforced to take into account a specific
2411 value, i.e. list only the dialogs that were inserted into the profile
2412 with that specific value. If no value is passed, all dialogs belonging
2413 to the profile will be listed. Note that if the profile does not
2414 supports values, this will be silently discarded.
2415
2416 Name: dlg.profile_list
2417
2418 Parameters:
2419 * profile - name of the profile to list the dialog for.
2420 * value (optional)- string value to further restrict the check;
2421
2422 RPC Command Format:
2423 ...
2424 kamctl rpc dlg.profile_list inbound_calls
2425 ...
2426
2427 9.13. dlg.bridge_dlg
2428
2429 Bridge two SIP addresses into a call using INVITE(hold)-REFER-BYE
2430 mechanism.
2431
2432 Name: dlg.bridge_dlg
2433
2434 Parameters:
2435 * from - SIP address to initiate the call
2436 * to - SIP address to refer 'from' to
2437 * op (optional) - outbound proxy SIP address. If its value is set to
2438 '.' (dot), then it is ignored (like it would not have been
2439 provided).
2440 * body (optional) - SDP body for initial INVITE. If its value is set
2441 to '.' (dot), then it is ignored (like it would not have been
2442 provided). If body is not set via RPC command parameter, then an
2443 internal generated SDP with G711a and G711u is used. If its value
2444 is set to '' (empty string) or '_' (underline), then the INVITE is
2445 sent without an SDP body.
2446
2447 RPC Command Format:
2448 ...
2449 kamctl rpc dlg.bridge_dlg _from_ _to_ _op_
2450 ...
2451
2452 9.14. dlg.stats_active
2453
2454 Get stats about active dialogs by scanning internal list of dialogs
2455 (not relying on core stats framework).
2456
2457 Name: dlg.stats_active
2458
2459 Parameters:
2460 * local_only (optional) - if not 0 then filter out non local dialogs
2461 (the receiving socket is not found locally, from C code point of
2462 view, the bind_addr info is not set).
2463
2464 Returned fields
2465 * starting - initial INVITE has been processed, no ringing or 1xx has
2466 been received.
2467 * connecting - initial INVITE was forwarded and rining or 1xx has
2468 been received.
2469 * answering - initial INVITE received 200 OK, but ACK was not handled
2470 yet.
2471 * ongoing - ongoing active dialog, after the ACK was processed.
2472 * all - all active dialogs, respectively the sum of the above values.
2473
2474 RPC Command Format:
2475 ...
2476 kamctl rpc dlg.stats_active
2477 ...
2478
2479 9.15. dlg.is_alive
2480
2481 Check whether a dialog matching the parameter is in confirmed state
2482 (answered and alive).
2483
2484 Name: dlg.is_alive
2485
2486 Parameters:
2487 * callid - callid of dialog
2488 * from_tag - from tag of the dialog
2489 * to_tag - to tag of the dialog
2490
2491 This command will return error if dialog is not found or not confirmed
2492 state (answered).
2493
2494 RPC Command Format:
2495 ...
2496 kamctl rpc dlg.is_alive callid123 fromtag123 totag123
2497 ...
2498
2499 9.16. dlg.briefing
2500
2501 Lists fewer attributes for dialog records in memory. The dialog hash
2502 entry and id are added always, the rest of them are a matter of 'attrs'
2503 parameter.
2504
2505 Name: dlg.briefing
2506
2507 Parameters:
2508 * attrs - (optional) a list of characters (flags) representing the
2509 fields to be added to the response. If it is missing, its default
2510 value is 'ftcFT' (note the characters are case sensitive).
2511 The characters can be:
2512 + f - From URI
2513 + t - To URI
2514 + c - Call-ID
2515 + F - From tag
2516 + T - To tag
2517 + I - Init time
2518 + S - Start time
2519 + E - End time
2520 + s - State
2521
2522 RPC Command Example:
2523 ...
2524 kamctl rpc dlg.briefing
2525 ...
2526 kamctl rpc dlg.briefing "ft"
2527 ...
2528
2529 10. Exported Variables
2530
2531 10.1. $DLG_count
2532 10.2. $DLG_status
2533 10.3. $DLG_lifetime
2534 10.4. $dlg(...)
2535 10.5. $dlg_ctx(...)
2536 10.6. $dlg_var(key)
2537
2538 10.1. $DLG_count
2539
2540 Returns the number of current active dialogs (may be confirmed or not).
2541
2542 10.2. $DLG_status
2543
2544 Returns the status of the dialog corresponding to the processed
2545 sequential request. This PV will be available only for sequential
2546 requests, after doing loose_route().
2547
2548 Value may be:
2549 * NULL - Dialog not found.
2550 * 3 - Confirmed by a final reply but no ACK received yet.
2551 * 4 - Confirmed by a final reply and ACK received.
2552 * 5 - Dialog ended.
2553
2554 10.3. $DLG_lifetime
2555
2556 Returns the duration (in seconds) of the dialog corresponding to the
2557 processed sequential request. The duration is calculated from the
2558 dialog confirmation and the current moment. This PV will be available
2559 only for sequential requests, after doing loose_route().
2560
2561 NULL will be returned if there is no dialog for the request.
2562
2563 10.4. $dlg(...)
2564
2565 Access to dialog attributes.
2566
2567 10.5. $dlg_ctx(...)
2568
2569 Access to dialog context attributes.
2570
2571 10.6. $dlg_var(key)
2572
2573 This is a read/write variable that can be used to store custom values
2574 associated to a dialog (e.g. the URI of a billing-server, an assigned
2575 emergency-server). The value has to be a string. This pseudo-variable
2576 will be available for subsequential requests only after loose_route()
2577 or dlg_manage().
2578
2579 Note: "NULL" is returned, if there is no dialog for this request.
2580
2581 Note: dialog variables set before the dialog is created for the initial
2582 INVITE can be associated to the dialog only when the dialog is created
2583 by the same Kamailio process. They are lost if the variables are set in
2584 a process that calls an asynchronous function that resumes the
2585 processing in another process, which then creates the dialog.
2586
2587 11. Event Routes
2588
2589 11.1. event_route[dialog:start]
2590 11.2. event_route[dialog:end]
2591 11.3. event_route[dialog:failed]
2592
2593 11.1. event_route[dialog:start]
2594
2595 Executed when 200 OK reply for INVITE is processed.
2596
2597 11.2. event_route[dialog:end]
2598
2599 Executed when the BYE for the call is processed or the dialog timed
2600 out.
2601
2602 11.3. event_route[dialog:failed]
2603
2604 Executed when dialog is not completed (300 or greater reply code to
2605 INVITE).
2606
2607 Chapter 2. Developer Guide
2608
2609 Table of Contents
2610
2611 1. Available Functions
2612
2613 1.1. register_dlgcb (dialog, type, cb, param, free_param_cb)
2614 1.2. terminate_dlg (dlg, hdrs)
2615
2616 1. Available Functions
2617
2618 1.1. register_dlgcb (dialog, type, cb, param, free_param_cb)
2619 1.2. terminate_dlg (dlg, hdrs)
2620
2621 1.1. register_dlgcb (dialog, type, cb, param, free_param_cb)
2622
2623 Register a new callback to the dialog.
2624
2625 Meaning of the parameters is as follows:
2626 * struct dlg_cell* dlg - dialog to register callback to. It may be
2627 NULL only for DLGCB_CREATED callback type, which is not a per
2628 dialog type.
2629 * int type - types of callbacks; more types may be registered for the
2630 same callback function; only DLGCB_LOADED and DLGCB_CREATED must be
2631 registered alone. Possible types:
2632 + DLGCB_LOADED
2633 + DLGCB_CREATED - called when a new dialog is created - it's a
2634 global type (not associated to any dialog)
2635 + DLGCB_FAILED - called when the dialog was negatively replied
2636 (non-2xx) - it's a per dialog type.
2637 + DLGCB_CONFIRMED_NA - called when the dialog is confirmed (2xx
2638 replied) but the setup-concluding ACK message from the caller
2639 is yet pending - it's a per dialog type.
2640 + DLGCB_CONFIRMED - called when the dialog is confirmed (2xx
2641 replied) and the setup-concluding ACK message from the caller
2642 has been seen - it's a per dialog type.
2643 + DLGCB_REQ_WITHIN - called when the dialog matches a sequential
2644 request (excluding setup-concluding ACK messages which are
2645 handled in DLGCB_CONFIRMED) - it's a per dialog type.
2646 + DLGCB_TERMINATED - called when the dialog is terminated via
2647 BYE - it's a per dialog type.
2648 + DLGCB_TERMINATED_CONFIRMED - called when response to a BYE
2649 request is received - it's a per dialog type.
2650 + DLGCB_EXPIRED - called when the dialog expires without
2651 receiving a BYE - it's a per dialog type.
2652 + DLGCB_EARLY - called when the dialog is created in an early
2653 state (18x replied) - it's a per dialog type.
2654 + DLGCB_RESPONSE_FWDED - called when the dialog matches a reply
2655 to the initial INVITE request - it's a per dialog type.
2656 + DLGCB_RESPONSE_WITHIN - called when the dialog matches a reply
2657 to a subsequent in dialog request - it's a per dialog type.
2658 + DLGCB_RPC_CONTEXT - called when the rpc dlg_list_ctx command
2659 is invoked - it's a per dialog type.
2660 + DLGCB_SPIRALED - called when the dialog matches a spiraling
2661 request - it's a per dialog type.
2662 + DLGCB_DESTROY
2663 * dialog_cb cb - callback function to be called. Prototype is: “void
2664 (dialog_cb) (struct dlg_cell* dlg, int type, struct dlg_cb_params *
2665 params); ”
2666 * void *param - parameter to be passed to the callback function.
2667 * param_free callback_param_free - callback function to be called to
2668 free the param. Prototype is: “void (param_free_cb) (void *param);”
2669
2670 1.2. terminate_dlg (dlg, hdrs)
2671
2672 Terminate a Dialog
2673
2674 Meaning of parameters is as follows:
2675 * struct dlg_cell* dlg - dialog to terminate.
2676 * str* hdrs - string containing extra headers (full format) to be
2677 added to the BYE requests of the dialog.
2678
2679 Chapter 3. Frequently Asked Questions
2680
2681 3.1. What happened with “use_tight_match” parameter?
2682 3.2. Where can I find more about Kamailio?
2683 3.3. Where can I post a question about this module?
2684 3.4. How can I report a bug?
2685
2686 3.1.
2687
2688 What happened with “use_tight_match” parameter?
2689
2690 The parameter was removed with version 1.3 as the option of tight
2691 matching became mandatory and not configurable. Now, the tight matching
2692 is done all the time (when using DID matching).
2693
2694 3.2.
2695
2696 Where can I find more about Kamailio?
2697
2698 Take a look at https://www.kamailio.org/.
2699
2700 3.3.
2701
2702 Where can I post a question about this module?
2703
2704 First at all check if your question was already answered on one of our
2705 mailing lists:
2706 * User Mailing List -
2707 https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.
2708 kamailio.org/
2709 * Developer Mailing List -
2710 https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.ka
2711 mailio.org/
2712
2713 E-mails regarding any stable Kamailio release should be sent to
2714 <[email protected]> and e-mails regarding development
2715 versions should be sent to <[email protected]>.
2716
2717 3.4.
2718
2719 How can I report a bug?
2720
2721 Please follow the guidelines provided at:
2722 https://github.com/kamailio/kamailio/issues.