-
Notifications
You must be signed in to change notification settings - Fork 564
/
README
1675 lines (1285 loc) · 59.3 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
usrloc Module
__________________________________________________________
Table of Contents
1. Admin Guide
1.1. Overview
1.2. Distributed SIP User Location
1.2.1. "Federation" Topology
1.2.2. "Full Sharing" Topology
1.2.3. "N Contact Pings" Problem
1.3. Contact matching
1.4. Dependencies
1.4.1. OpenSIPS Modules
1.4.2. External Libraries or Applications
1.5. Exported Parameters
1.5.1. nat_bflag (string)
1.5.2. contact_id_column (string)
1.5.3. user_column (string)
1.5.4. domain_column (string)
1.5.5. contact_column (string)
1.5.6. expires_column (string)
1.5.7. q_column (string)
1.5.8. callid_column (string)
1.5.9. cseq_column (string)
1.5.10. methods_column (string)
1.5.11. flags_column (string)
1.5.12. cflags_column (string)
1.5.13. user_agent_column (string)
1.5.14. received_column (string)
1.5.15. socket_column (string)
1.5.16. path_column (string)
1.5.17. sip_instance_column (string)
1.5.18. kv_store_column (string)
1.5.19. attr_column (string)
1.5.20. use_domain (integer)
1.5.21. desc_time_order (integer)
1.5.22. timer_interval (integer)
1.5.23. db_url (string)
1.5.24. cachedb_url (string)
1.5.25. db_mode (integer, deprecated)
1.5.26. working_mode_preset (string)
1.5.27. cluster_mode (string)
1.5.28. restart_persistency (string)
1.5.29. sql_write_mode (string)
1.5.30. matching_mode (integer)
1.5.31. cseq_delay (integer)
1.5.32. location_cluster (integer)
1.5.33. skip_replicated_db_ops (int)
1.5.34. max_contact_delete (int)
1.5.35. hash_size (integer)
1.5.36. regen_broken_contactid (integer)
1.5.37. latency_event_min_us (integer)
1.5.38. latency_event_min_us_delta (integer)
1.5.39. pinging_mode (string)
1.5.40. mi_dump_kv_store (integer)
1.5.41. contact_refresh_timer (boolean)
1.6. Exported Functions
1.7. Exported MI Functions
1.7.1. ul_rm
1.7.2. ul_rm_contact
1.7.3. ul_dump
1.7.4. ul_flush
1.7.5. ul_add
1.7.6. ul_show_contact
1.7.7. ul_sync
1.7.8. ul_cluster_sync
1.8. Exported Statistics
1.8.1. users
1.8.2. contacts
1.8.3. expires
1.8.4. registered_users
1.9. Exported Events
1.9.1. E_UL_AOR_INSERT
1.9.2. E_UL_AOR_DELETE
1.9.3. E_UL_CONTACT_INSERT
1.9.4. E_UL_CONTACT_DELETE
1.9.5. E_UL_CONTACT_UPDATE
1.9.6. E_UL_CONTACT_REFRESH
1.9.7. E_UL_LATENCY_UPDATE
2. Developer Guide
2.1. Available Functions
2.1.1. ul_register_domain(name)
2.1.2. ul_insert_urecord(domain, aor, rec,
is_replicated)
2.1.3. ul_delete_urecord(domain, aor, is_replicated)
2.1.4. ul_get_urecord(domain, aor)
2.1.5. ul_lock_udomain(domain)
2.1.6. ul_unlock_udomain(domain)
2.1.7. ul_release_urecord(record, is_replicated)
2.1.8. ul_insert_ucontact(record, contact,
contact_info, contact, is_replicated)
2.1.9. ul_delete_ucontact (record, contact,
is_replicated)
2.1.10. ul_delete_ucontact_from_id (domain,
contact_id)
2.1.11. ul_get_ucontact(record, contact)
2.1.12. ul_get_domain_ucontacts (domain, buf, len,
flags)
2.1.13. ul_get_all_ucontacts (buf, len, flags)
2.1.14. ul_update_ucontact(record, contact,
contact_info, is_replicated)
2.1.15. ul_bind_ursloc( api )
2.1.16. ul_register_ulcb(type ,callback, param)
2.1.17. ul_get_num_users()
3. Contributors
3.1. By Commit Statistics
3.2. By Commit Activity
4. Documentation
4.1. Contributors
List of Tables
1.1. Possible values for the "pinging_mode", depending on the
current "cluster_mode"
3.1. Top contributors by DevScore^(1), authored commits^(2) and
lines added/removed^(3)
3.2. Most recently active contributors^(1) to this module
List of Examples
1.1. Set nat_bflag parameter
1.2. Set contact_id_column parameter
1.3. Set user_column parameter
1.4. Set user_column parameter
1.5. Set contact_column parameter
1.6. Set expires_column parameter
1.7. Set q_column parameter
1.8. Set callid_column parameter
1.9. Set cseq_column parameter
1.10. Set methods_column parameter
1.11. Set flags_column parameter
1.12. Set cflags_column parameter
1.13. Set user_agent_column parameter
1.14. Set received_column parameter
1.15. Set socket_column parameter
1.16. Set path_column parameter
1.17. Set sip_instance_column parameter
1.18. Set kv_store_column parameter
1.19. Set attr_column parameter
1.20. Set use_domain parameter
1.21. Set desc_time_order parameter
1.22. Set timer_interval parameter
1.23. Set db_url parameter
1.24. Set cachedb_url parameter
1.25. Set db_mode parameter
1.26. Set working_mode_preset parameter
1.27. Set cluster_mode parameter
1.28. Set restart_persistency parameter
1.29. Set sql_write_mode parameter
1.30. Set matching_mode parameter
1.31. Set cseq_delay parameter
1.32. Setting the location_cluster parameter
1.33. Setting the skip_replicated_db_ops parameter
1.34. Setting the max_contact_delete parameter
1.35. Set hash_size parameter
1.36. Set regen_broken_contactid parameter
1.37. Set latency_event_min_us parameter
1.38. Set latency_event_min_us_delta parameter
1.39. Set pinging_mode parameter
1.40. Set mi_dump_kv_store parameter
1.41. Set contact_refresh_timer parameter
Chapter 1. Admin Guide
1.1. Overview
A SIP user location implementation. Its main purpose is to
store, manage and provide access to SIP registration bindings
(contacts) for other modules (e.g. registrar, mid-registrar,
nathelper, etc.). The module exports no functions that could be
directly used from the OpenSIPS script.
At runtime, the contacts may reside in memory, in an SQL
database or in a NoSQL database. Combinations of two of the
above are also possible. For example, contacts may only be
directly manipulated in memory in order to guarantee fast
interactions while being asynchronously synchronized to an SQL
database. The latter helps achieve restart persistency. Consult
the working_mode_preset parameter for more details on all
possible runtime behaviors of the module.
The OpenSIPS user location implementation is cluster-enabled.
On top of supporting traditional "single instance" setups, it
also allows multiple OpenSIPS user location nodes to form a
single, global user location cluster. This allows high-level
features such as startup synchronization (data tunneling) from
a random, healthy "donor" node and evenly distributed NAT
pinging workloads.
1.2. Distributed SIP User Location
Starting with OpenSIPS 2.4, the user location module offers
several optional data distribution models, each tailoring to
specific real-life production use cases. Built on top of the
OpenSIPS clustering module, these models take into account
service concerns such as high availability, geographical
distribution, horizontal scalability and NAT traversal.
Depending on data locality, the distribution models are split
in two main categories:
1.2.1. "Federation" Topology
A federated user location keeps contact data local to the
original OpenSIPS node the contact initially registered to. In
order to share the reachability of these contacts with the
global OpenSIPS user location cluster, registrar nodes will
only publish some light "metadata" entries for any new
Addresses-of-Record which are reachable from them. These
entries will cause other nodes to also fork additional SIP
branches pointing to the publisher registrar upon receiving
calls for its advertised Addresses-of-Record.
The federation topology is an optimized solution for the
following core problems:
* IP address restrictions - In some cases, calls routed
towards registered contacts must necessarily pass through
the original registration nodes of these contacts. A
classic example of this situation is when an OpenSIPS
registrar sitting at the edge of the platform is directly
facing a NAT device on the way to the contact. Unless calls
are sent out from this exact registrar, they will not be
able to traverse the NAT device and reach the contact.
* horizontal scalability - Avoiding global
replication/contact broadcasting within the cluster not
only dramatically improves contact storage performance, but
also leads to better service scalability. Different
geographical locations can be sized according to their
local subscriber populations (traffic may be balanced to
them using DNS SRV weights, for example), without losing
platform-wide reachability.
Currently, the metadata information may be published to NoSQL
databases which support key/multi-value column-like
associations. Example known backends to support these
abstractions at the time of writing are MongoDB and Cassandra.
The federated user location tutorial contains precise details
on how to achieve this setup (including High Availability
support).
1.2.2. "Full Sharing" Topology
A fully sharing user location broadcasts contact information to
all data nodes (OpenSIPS or NoSQL). The main assumption behind
this mode is that any routing restrictions have been alleviated
beforehand. Consequently, either SIP traffic egressing from a
"full sharing" OpenSIPS user location topology is being
intermediated by an additional SIP edge endpoint of our
platform, or there are no egress IP restrictions at all (for
example, if all SIP UAs have public IPs). In this setup, all
OpenSIPS user location nodes are equivalent to one another, as
they each have access to the same dataset and have no routing
restrictions.
The full sharing topology is an appropriate solution for
multi-layer VoIP platforms, where the OpenSIPS registrar nodes
do not directly interact with external SIP endpoints. Moreover,
it can be configured to fully store contact data within a NoSQL
cluster (zero in-memory storage), thus taking full advantage of
the data sharing, sharding, migration and other capabilities of
a specialized distributed data handling engine.
Additionally, a "full sharing" topology can be used to achieve
a basic "hot backup" high-availability setup with an
active-passive registrar nodes configuration, both of which
make use of a shared virtual IP.
Registrations may optionally be fully managed inside NoSQL
databases which support key/multi-value column-like
associations. Example known backends to currently support these
abstractions are MongoDB and Apache Cassandra.
The "full sharing" user location tutorial contains precise
details on how to achieve this setup (including full NoSQL
storage support).
1.2.3. "N Contact Pings" Problem
A long-standing problem caused by contact information being
replicated to multiple SIP registrar instances directly through
replication or indirectly through a globally reachable
database. As long as traditionally clusterized nodes are not
aware of each other, they will each scan the entire contact
dataset, thus periodically sending "N pings" instead of "1
ping" for each contact. This difference directly affects
service scalability, as well as the amount of consumed
resources such as CPU and network bandwidth, both on the
service and client side.
This problem is solved with the help of the OpenSIPS cluster
layer, which makes all nodes aware of each others' presence.
Thus, the distributed user location node topologies are able to
collectively partition the pinging workload and spread it
evenly across the current number of cluster nodes, at any given
point in time. The pinging_mode module parameter describes the
built-in pinging heuristics in more detail.
1.3. Contact matching
Contact matching (for the same Address-of-Record, AoR) is an
important aspect of a SIP user location service, especially in
the context of NAT traversal. The latter raises more problems,
since contacts from different phones of same users may overlap
(if behind NATs with identical configurations) or the
re-register Contact of the same SIP User Agent may be seen as a
new one (due to the request arriving via a new NAT binding).
The SIP RFC 3261 publishes a matching algorithm based only on
the contact string with Call-ID and CSeq number extra checking
(if the Call-ID matches, it must have a higher CSeq number,
otherwise the registration is invalid). But as argumented
above, this is not enough in a NAT traversal context, so the
OpenSIPS implementation of contact matching offers more
algorithms:
* Contact based only - strict RFC 3261 compliancy - the
contact is matched as string and extra checked via Call-ID
and CSeq (if Call-ID is the same, it must have a higher
CSeq number, otherwise the registration is invalid).
* Contact and Call-ID based - an extension of the first case
- the Contact and Call-ID header field values must match as
strings; the CSeq must be higher than the previous one - so
be careful how you deal with REGISTER retransmissions in
this case.
For more details on how to control/select the contact matching
algorithm, please go to matching_mode.
1.4. Dependencies
1.4.1. OpenSIPS Modules
The following modules must be loaded before this module:
* Optionally an SQL database module.
* Optionally a NoSQL database module.
* clusterer, if cluster_mode is different than "none".
1.4.2. External Libraries or Applications
The following libraries or applications must be installed
before running OpenSIPS with this module loaded:
* None.
1.5. Exported Parameters
1.5.1. nat_bflag (string)
The name of the branch flag to be used as NAT marker (if the
contact is or not natted). This is a branch flag and it will be
imported and used by all other modules depending on the usrloc
module.
Default value is NULL (not set).
Example 1.1. Set nat_bflag parameter
...
modparam("usrloc", "nat_bflag", "NAT_BFLAG")
...
1.5.2. contact_id_column (string)
Name of the column holding the unique contact IDs.
Default value is “contact_id”.
Example 1.2. Set contact_id_column parameter
...
modparam("usrloc", "contact_id_column", "ctid")
...
1.5.3. user_column (string)
Name of column containing usernames.
Default value is “username”.
Example 1.3. Set user_column parameter
...
modparam("usrloc", "user_column", "username")
...
1.5.4. domain_column (string)
Name of column containing domains.
Default value is “domain”.
Example 1.4. Set user_column parameter
...
modparam("usrloc", "domain_column", "domain")
...
1.5.5. contact_column (string)
Name of column containing contacts.
Default value is “contact”.
Example 1.5. Set contact_column parameter
...
modparam("usrloc", "contact_column", "contact")
...
1.5.6. expires_column (string)
Name of column containing expires value.
Default value is “expires”.
Example 1.6. Set expires_column parameter
...
modparam("usrloc", "expires_column", "expires")
...
1.5.7. q_column (string)
Name of column containing q values.
Default value is “q”.
Example 1.7. Set q_column parameter
...
modparam("usrloc", "q_column", "q")
...
1.5.8. callid_column (string)
Name of column containing callid values.
Default value is “callid”.
Example 1.8. Set callid_column parameter
...
modparam("usrloc", "callid_column", "callid")
...
1.5.9. cseq_column (string)
Name of column containing cseq numbers.
Default value is “cseq”.
Example 1.9. Set cseq_column parameter
...
modparam("usrloc", "cseq_column", "cseq")
...
1.5.10. methods_column (string)
Name of column containing supported methods.
Default value is “methods”.
Example 1.10. Set methods_column parameter
...
modparam("usrloc", "methods_column", "methods")
...
1.5.11. flags_column (string)
Name of column to save the internal flags of the record.
Default value is “flags”.
Example 1.11. Set flags_column parameter
...
modparam("usrloc", "flags_column", "flags")
...
1.5.12. cflags_column (string)
Name of column to save the branch/contact flags of the record.
Default value is “cflags”.
Example 1.12. Set cflags_column parameter
...
modparam("usrloc", "cflags_column", "cflags")
...
1.5.13. user_agent_column (string)
Name of column containing user-agent values.
Default value is “user_agent”.
Example 1.13. Set user_agent_column parameter
...
modparam("usrloc", "user_agent_column", "user_agent")
...
1.5.14. received_column (string)
Name of column containing the source IP, port, and protocol
from the REGISTER message.
Default value is “received”.
Example 1.14. Set received_column parameter
...
modparam("usrloc", "received_column", "received")
...
1.5.15. socket_column (string)
Name of column containing the received socket information
(IP:port) for the REGISTER message.
Default value is “socket”.
Example 1.15. Set socket_column parameter
...
modparam("usrloc", "socket_column", "socket")
...
1.5.16. path_column (string)
Name of column containing the Path header.
Default value is “path”.
Example 1.16. Set path_column parameter
...
modparam("usrloc", "path_column", "path")
...
1.5.17. sip_instance_column (string)
Name of column containing the SIP instance.
Default value is “NULL”.
Example 1.17. Set sip_instance_column parameter
...
modparam("usrloc", "sip_instance_column", "sip_instance")
...
1.5.18. kv_store_column (string)
Name of column containing generic key-value data.
Default value is “kv_store”.
Example 1.18. Set kv_store_column parameter
...
modparam("usrloc", "kv_store_column", "json_data")
...
1.5.19. attr_column (string)
Name of column containing additional registration-related
information.
Default value is “attr”.
Example 1.19. Set attr_column parameter
...
modparam("usrloc", "attr_column", "attributes")
...
1.5.20. use_domain (integer)
If the domain part of the user should be also saved and used
for identifing the user (along with the username part). Useful
in multi domain scenarios. Non 0 value means true.
Default value is “0 (false)”.
Example 1.20. Set use_domain parameter
...
modparam("usrloc", "use_domain", 1)
...
1.5.21. desc_time_order (integer)
If the user's contacts should be kept timestamp ordered;
otherwise the contact will be ordered based on q value. Non 0
value means true.
Default value is “0 (false)”.
Example 1.21. Set desc_time_order parameter
...
modparam("usrloc", "desc_time_order", 1)
...
1.5.22. timer_interval (integer)
Number of seconds between two timer runs. During each run, the
module will update/delete dirty/expired contacts from memory
and/or mirror these operations to the database, if configured
to do so.
Warning
In case of an OpenSIPS shutdown or even a crash, contacts which
are in memory only and have not been flushed yet to disk will
NOT get lost! OpenSIPS will try its best to do a last-minute
sync to DB right before shutting down.
Default value is 60.
Example 1.22. Set timer_interval parameter
...
modparam("usrloc", "timer_interval", 120)
...
1.5.23. db_url (string)
URL of the database that should be used.
Default value is
“mysql://opensips:opensipsrw@localhost/opensips”.
Example 1.23. Set db_url parameter
...
modparam("usrloc", "db_url", "dbdriver://username:password@dbhost/dbname
")
...
1.5.24. cachedb_url (string)
URL of a NoSQL database to be used. Only required in a
cachedb-enabled cluster_mode.
Default value is “none”.
Example 1.24. Set cachedb_url parameter
...
modparam("usrloc", "cachedb_url", "mongodb://10.0.0.4:27017/opensipsDB.u
serlocation")
...
1.5.25. db_mode (integer, deprecated)
This parameter has been kept for backwards compatibility. It
acts as a working_mode_preset (which it also conflicts with),
overriding any cluster_mode, restart_persistency and
sql_write_mode settings. Possible values are:
* 0, corresponding to "single-instance-no-db" (see below)
* 1, corresponding to "single-instance-sql-write-through"
* 2, corresponding to "single-instance-sql-write-back"
* 3, corresponding to "sql-only"
Default value is "not set".
Example 1.25. Set db_mode parameter
...
modparam("usrloc", "db_mode", 2)
...
1.5.26. working_mode_preset (string)
A pre-defined working mode for the usrloc module. Setting this
parameter will override any cluster_mode, restart_persistency
and sql_write_mode settings.
* "single-instance-no-db" - This disables database
completely. Only memory will be used. Contacts will not
survive restart. Use this value if you need a really fast
usrloc and contact persistence is not necessary or is
provided by other means.
* "single-instance-sql-write-through" - Write-Through scheme.
All changes to usrloc are immediately reflected in database
too. This is very slow, but very reliable. Use this scheme
if speed is not your priority but need to make sure that no
registered contacts will be lost during crash or reboot.
* "single-instance-sql-write-back" - Write-Back scheme. This
is a combination of previous two schemes. All changes are
made to memory and database synchronization is done in the
timer. The timer deletes all expired contacts and flushes
all modified or new contacts to database. Use this scheme
if you encounter high-load peaks and want them to process
as fast as possible. The mode will not help at all if the
load is high all the time. The added latency on the SIP
signaling when using this asynchronous preset is much lower
than the one added by the safe but blocking,
"single-instance-sql-write-through" preset.
* "sql-only" - DB-Only scheme. No memory cache is kept, all
operations being directly performed with the database. The
timer deletes all expired contacts from database - cleans
after clients that didn't un-register or re-register. The
mode is useful if you configure more servers sharing the
same DB without any replication at SIP level. The mode may
be slower due the high number of DB operation. For example
NAT pinging is a killer since during each ping cycle all
nated contact are loaded from the DB; The lack of memory
caching also disable the statistics exports.
* "federation-cachedb-cluster" - OpenSIPS will run with a
"federation-cachedb" cluster_mode and "sync-from-cluster"
restart_persistency. This will require the configuration of
multiple "seed" nodes in the cluster. Refer to the
federated user location tutorial for more details.
* "full-sharing-cluster" - OpenSIPS will run with a
"full-sharing" cluster_mode and "sync-from-cluster"
restart_persistency. This will require the configuration of
one of the nodes in the cluster as a "seed" node in order
to bootstrap the syncing process.
* "full-sharing-cachedb-cluster" - OpenSIPS will run with a
"full-sharing-cachedb" cluster_mode, where all location
data strictly resides in a NoSQL database, thus it will
have natural restart persistency.
Refer to section Distributed SIP User Location for details
regarding the clustering topologies and their behavior.
Default value is "single-instance-no-db".
Example 1.26. Set working_mode_preset parameter
...
modparam("usrloc", "working_mode_preset", "full-sharing-cachedb-cluster"
)
...
1.5.27. cluster_mode (string)
This parameter will get overridden if either
working_mode_preset or db_mode is set.
The behavior of the global OpenSIPS user location cluster.
Refer to section Distributed SIP User Location for details.
This parameter may take the following values:
* "none" - single instance mode.
* "federation-cachedb" - federation-based data sharing. Local
AoR metadata is published inside a NoSQL database, so other
cluster nodes can fork SIP traffic over to the current
node. Consequently, the location_cluster and cachedb_url
parameters are mandatory.
* "full-sharing" - Broadcast contact updates (full-mesh
mirroring) to all other OpenSIPS cluster participants. Each
node will hold the entire user location dataset.
Consequently, the location_cluster parameter is mandatory.
* "full-sharing-cachedb" - Full contact data management
through the use of a NoSQL database (somewhat resembling
the "sql-only" preset). The cluster layer is still required
in order to be able to partition and spread the pinging
workload evenly among participating OpenSIPS nodes.
Consequently, the location_cluster and cachedb_url
parameters are mandatory.
* "sql-only" - Multiple OpenSIPS boxes using a common db_url
without necessarily being aware of each other.
Default value is "none" (single instance mode).
Example 1.27. Set cluster_mode parameter
...
modparam("usrloc", "cluster_mode", "federation-cachedb")
...
1.5.28. restart_persistency (string)
This parameter will get overridden if either
working_mode_preset or db_mode are set.
Controls the behavior of the OpenSIPS user location following a
restart. This parameter has no effect in some database-only
working mode presets, where restart persistency is naturally
ensured.
This parameter may take the following values:
* "none" - no explicit data synchronization following a
restart. The node starts empty.
* "load-from-sql" - enable SQL-based restart persistency.
This causes all runtime in-memory writes (i.e. new
registrations, re-registrations or de-registrations) to
also propagate to an SQL database, from which all data will
be imported following a restart. Choosing this value will
make the db_url parameter mandatory, as well as cause
sql_write_mode to default to "write-back" instead of
"none".
* "sync-from-cluster" - enable cluster-based restart
persistency. Following a restart, an OpenSIPS cluster node
will search for a healthy "donor" node from which to mirror
the entire user location dataset via direct cluster sync
(TCP-based, binary-encoded data transfer). Depending on the
clustering mode and cluster topology, this will require the
configuration of one or multiple "seed" nodes in the
cluster. Choosing this value will make the location_cluster
parameter mandatory.
Default value is "none" (no restart persistency).
Example 1.28. Set restart_persistency parameter
...
modparam("usrloc", "restart_persistency", "sync-from-cluster")
...
1.5.29. sql_write_mode (string)
This parameter will get overridden if either
working_mode_preset or db_mode are set.
Only valid if restart_persistency is enabled. Controls the
runtime behavior of OpenSIPS writes to the SQL database.
This parameter may take the following values:
* "none" - do not perform any additional SQL writes at
runtime to an SQL database in order to specifically ensure
restart persistency.
* "write-through" - all in-memory writes (i.e. new
registrations, re-registrations or de-registrations) also
propagate into the SQL database, inline. While this will
definitely slow down registration performance (lookups are
served from memory!), it has the advantage of making the
instance crash-safe.
* "write-back" - all in-memory writes (i.e. new
registrations, re-registrations or de-registrations)
eventually also propagate into the SQL database, thanks to
a separate timer routine. This dramatically speeds up
registrations, but also introduces the possibility of
crashing before the latest contact changes are propagated
to the database. See the timer_interval for additional
configuration.
Default value is "none" (no added SQL writes).
Example 1.29. Set sql_write_mode parameter
...
modparam("usrloc", "sql_write_mode", "write-back")
...
1.5.30. matching_mode (integer)
What contact matching algorithm to be used. Refer to section
Contact Matching for the description of the algorithms.
The parameter may take the following values:
* 0 - CONTACT ONLY based matching algorithm.
* 1 - CONTACT and CALLID based matching algorithm.
Default value is 0 (CONTACT_ONLY).
Example 1.30. Set matching_mode parameter
...
modparam("usrloc", "matching_mode", 1)
...
1.5.31. cseq_delay (integer)
Delay (in seconds) for accepting as retransmissions register
requests with same Call-ID and Cseq. The delay is calculated
starting from the receiving time of the first register with
that Call-ID and Cseq.
Retransmissions within this delay interval will be accepted and
replied as the original request, but no update will be done in
location. If the delay is exceeded, error is reported.
A value of 0 disable the retransmission detection.
Default value is “20 seconds”.
Example 1.31. Set cseq_delay parameter
...
modparam("usrloc", "cseq_delay", 5)
...
1.5.32. location_cluster (integer)
Specifies the cluster ID which this instance will send to and
receive from all user-location related information
(addresses-of-record, contacts), organized into specific events
(inserts, deletes or updates).
Default value is 0 (replication disabled).
More details on the user location distribution mechanisms are
available under Distributed SIP User Location.
Example 1.32. Setting the location_cluster parameter
...
modparam("usrloc", "location_cluster", 1)
...
1.5.33. skip_replicated_db_ops (int)
Prevent OpenSIPS from performing any DB-related contact
operations when events are received over the Binary Interface.
This is commonly used to prevent unneeded duplicate operations.
Default value is "0" (upon receival of usrloc-related Binary
Interface events, DB queries may be freely performed)
More details on the user location replication mechanism are
available in Distributed SIP User Location
Example 1.33. Setting the skip_replicated_db_ops parameter
...
modparam("usrloc", "skip_replicated_db_ops", 1)
...
1.5.34. max_contact_delete (int)
Relevant only in WRITE_THROUGH or WRITE_BACK schemes. The
maximum number of contacts to be deleted from the database at
once. Will delete all of them, if fewer after passing through
all the contacts.
Default value is "10"
Example 1.34. Setting the max_contact_delete parameter
...
modparam("usrloc", "max_contact_delete", 10)
...
1.5.35. hash_size (integer)
The number of entries of the hash table used by usrloc to store
the location records is 2^hash_size. For hash_size=4, the
number of entries of the hash table is 16. Since version 2.2,
the maximu size of this parameter is 16, meaning that the hash
supports maximum 65536 entries.
Default value is “9”.
Example 1.35. Set hash_size parameter
...
modparam("usrloc", "hash_size", 10)
...
1.5.36. regen_broken_contactid (integer)
Since version 2.2, contact_id concept was introduced. Since
this parameter validates a contact each time OpenSIPS is
started, there are times when the value of this parameter
should be regenerated. That is when location table is being
migrated from a version older than 2.2 or when hash_size module
parameter is changed. Enabling this parameter will regenerate
broken contact id's based on current configurations.
Default value is “0(not enabled)”
Example 1.36. Set regen_broken_contactid parameter
...
modparam("usrloc", "regen_broken_contactid", 1)
...
1.5.37. latency_event_min_us (integer)
Defines a minimal pinging latency threshold, in microseconds,
past which contact pinging latency update events will get
raised. By default, an event is raised for each ping reply
(i.e. latency update).
If both latency_event_min_us and latency_event_min_us_delta are
set, the event will get raised if either of them is true.
Default value is “0 (no bottom limit set)”.
Example 1.37. Set latency_event_min_us parameter
...
# raise an event for any 425+ ms pinging latency
modparam("usrloc", "latency_event_min_us", 425000)
...
1.5.38. latency_event_min_us_delta (integer)
Defines a minimal, absolute pinging latency difference, in
microseconds, past which contact pinging latency update events
will get raised. The difference is computed using the latencies
of the last two contact pinging replies. By default, an event
is raised for each ping reply (i.e. latency update).
If both latency_event_min_us and latency_event_min_us_delta are
set, the event will get raised if either of them is true.
Default value is “0 (no minimal latency delta set)”.
Example 1.38. Set latency_event_min_us_delta parameter