Skip to content

USRLOC module

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.

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:

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).

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).

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.

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.

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”.

The following libraries or applications must be installed before running OpenSIPS with this module loaded:

  • None.

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).

Set nat_bflag parameter
...
modparam("usrloc", "nat_bflag", "NAT_BFLAG")
...

Name of the column holding the unique contact IDs.

Default value is “contact_id”.

Set contact_id_column parameter
...
modparam("usrloc", "contact_id_column", "ctid")
...

Name of column containing usernames.

Default value is “username”.

Set user_column parameter
...
modparam("usrloc", "user_column", "username")
...

Name of column containing domains.

Default value is “domain”.

Set user_column parameter
...
modparam("usrloc", "domain_column", "domain")
...

Name of column containing contacts.

Default value is “contact”.

Set contact_column parameter
...
modparam("usrloc", "contact_column", "contact")
...

Name of column containing expires value.

Default value is “expires”.

Set expires_column parameter
...
modparam("usrloc", "expires_column", "expires")
...

Name of column containing q values.

Default value is “q”.

Set q_column parameter
...
modparam("usrloc", "q_column", "q")
...

Name of column containing callid values.

Default value is “callid”.

Set callid_column parameter
...
modparam("usrloc", "callid_column", "callid")
...

Name of column containing cseq numbers.

Default value is “cseq”.

Set cseq_column parameter
...
modparam("usrloc", "cseq_column", "cseq")
...

Name of column containing supported methods.

Default value is “methods”.

Set methods_column parameter
...
modparam("usrloc", "methods_column", "methods")
...

Name of column to save the internal flags of the record.

Default value is “flags”.

Set flags_column parameter
...
modparam("usrloc", "flags_column", "flags")
...

Name of column to save the branch/contact flags of the record.

Default value is “cflags”.

Set cflags_column parameter
...
modparam("usrloc", "cflags_column", "cflags")
...

Name of column containing user-agent values.

Default value is “user_agent”.

Set user_agent_column parameter
...
modparam("usrloc", "user_agent_column", "user_agent")
...

Name of column containing the source IP, port, and protocol from the REGISTER message.

Default value is “received”.

Set received_column parameter
...
modparam("usrloc", "received_column", "received")
...

Name of column containing the received socket information (IP:port) for the REGISTER message.

Default value is “socket”.

Set socket_column parameter
...
modparam("usrloc", "socket_column", "socket")
...

Name of column containing the Path header.

Default value is “path”.

Set path_column parameter
...
modparam("usrloc", "path_column", "path")
...

Name of column containing the SIP instance.

Default value is “NULL”.

Set sip_instance_column parameter
...
modparam("usrloc", "sip_instance_column", "sip_instance")
...

Name of column containing generic key-value data.

Default value is “kv_store”.

Set kv_store_column parameter
...
modparam("usrloc", "kv_store_column", "json_data")
...

Name of column containing additional registration-related information.

Default value is “attr”.

Set attr_column parameter
...
modparam("usrloc", "attr_column", "attributes")
...

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)“.

Set use_domain parameter
...
modparam("usrloc", "use_domain", 1)
...

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)“.

Set desc_time_order parameter
...
modparam("usrloc", "desc_time_order", 1)
...

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.

Default value is 60.

Set timer_interval parameter
...
modparam("usrloc", "timer_interval", 120)
...

URL of the database that should be used.

Default value is “mysql://opensips:opensipsrw@localhost/opensips”.

Set db_url parameter
...
modparam("usrloc", "db_url", "dbdriver://username:password@dbhost/dbname")
...

URL of a NoSQL database to be used. Only required in a cachedb-enabled cluster mode.

Default value is “none”.

Set cachedb_url parameter
...
modparam("usrloc", "cachedb_url", "mongodb://10.0.0.4:27017/opensipsDB.userlocation")
...

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”.

Set db_mode parameter
...
modparam("usrloc", "db_mode", 2)
...

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”.

Set working_mode_preset parameter
...
modparam("usrloc", "working_mode_preset", "full-sharing-cachedb-cluster")
...

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).

Set cluster_mode parameter
...
modparam("usrloc", "cluster_mode", "federation-cachedb")
...

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).

Set restart_persistency parameter
...
modparam("usrloc", "restart_persistency", "sync-from-cluster")
...

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).

Set sql_write_mode parameter
...
modparam("usrloc", "sql_write_mode", "write-back")
...

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).

Set matching_mode parameter
...
modparam("usrloc", "matching_mode", 1)
...

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”.

Set cseq_delay parameter
...
modparam("usrloc", "cseq_delay", 5)
...

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.

Setting the location_cluster parameter
...
modparam("usrloc", "location_cluster", 1)
...

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

Setting the skip_replicated_db_ops parameter
...
modparam("usrloc", "skip_replicated_db_ops", 1)
...

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”

Setting the max_contact_delete parameter
...
modparam("usrloc", "max_contact_delete", 10)
...

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”.

Set hash_size parameter
...
modparam("usrloc", "hash_size", 10)
...

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)“

Set regen_broken_contactid parameter
...
modparam("usrloc", "regen_broken_contactid", 1)
...

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)“.

Set latency_event_min_us parameter
...
# raise an event for any 425+ ms pinging latency
modparam("usrloc", "latency_event_min_us", 425000)
...

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)“.

Set latency_event_min_us_delta parameter
...
# raise an event only if a contact has pinging latency swings of 300+ ms
modparam("usrloc", "latency_event_min_us_delta", 300000)
...

Depending on the cluster mode, the module can perform contact pinging using one of at most two possible heuristics:

  • “ownership” - this instance will only attempt to ping a contact if it decides it is the logical owner of the contact. If a shared tag is attached to a contact, a node will keep sending pings to that contact as long as it owns the respective tag. If no shared tag has been specified for a given contact, the default is to assume permanent ownership of the contact and always ping it.
  • “cooperation” - the assumption behind this pinging heuristic is that all user location cluster nodes are symmetrical (possibly front-ended by a SIP traffic balancing entity), such that either of them can ping any contact. Under this assumption, all currently online user location cluster nodes will cooperate and evenly split the pinging workload between them by hashing AoRs modulo current_number_of_online_nodes, and only picking the ones that they are responsible for.

Possible values for the “pinging_mode”, depending on the current “cluster_mode”

cluster modenonefederation-cachedbfull-sharingfull-sharing-cachedbsql-only
pinging modeownershipownershipcooperation / ownershipcooperationunmaintained

Notice that only the “full-sharing” clustering mode allows some flexibility — all other modes are logically tied to a single pinging logic. Any unaccepted value, according to the above table, set for those modes will be silently discarded.

Set pinging_mode parameter
...
# prepare an active/backup "full-sharing" setup, with no front-end
modparam("usrloc", "pinging_mode", "ownership")
...

Enable in order to include the “KV-Store” field in all usrloc MI commands which output AoR or Contact representations. This verbose field contains custom data attached to each of these two entities. mid_registrar makes use of both of these holders, for example.

Default value is “0 (disabled)”.

Set mi_dump_kv_store parameter
...
# include the "KV-Store" key in all usrloc MI output
modparam("usrloc", "mi_dump_kv_store", 1)
...

There are no exported functions that could be used in scripts.

Deletes an entire AOR record (including its contacts).

Parameters:

  • table_name - table where the AOR is removed from (Ex: location).
  • aor - user AOR in username[@domain] format (domain must be supplied only if use_domain option is on).

Deletes a contact from an AOR record.

Parameters:

  • table name - table where the AOR is removed from (Ex: location).
  • AOR - user AOR in username[@domain] format (domain must be supplied only if use_domain option is on).
  • contact - exact contact to be removed

Dumps the entire content of the USRLOC in memory cache

Parameters:

  • brief - (optional, may not be present); if equals to string “brief”, a brief dump will be done (only AOR and contacts, with no other details)

Force a flush of all pending usrloc cache changes to the database. Normally, this routine runs every timer interval seconds.

Adds a new contact for an user AOR.

Parameters:

  • table name - table where the contact will be added (Ex: location).
  • aor - user AOR in username[@domain] format (domain must be supplied only if use_domain option is on).
  • contact - contact string to be added
  • expires - expires value of the contact
  • q - Q value of the contact
  • unused - unused attribute (kept for backword compatibility)
  • flags - internal USRLOC flags of the contact
  • cflags - per branch flags of the contact
  • methods - mask with supported requests of the contact

Dumps the contacts of an user AOR.

Parameters:

  • table_name - table where the AOR resides (Ex: location).
  • aor - user AOR in username[@domain] format (domain must be supplied only if use_domain option is on).

Empty the location table, then synchronize it with all contacts from memory. Note that this can not be used when no database is specified or with the DB-Only scheme.

Important: make sure that all your contacts are in memory (ul_dump MI function) before executing this command.

Parameters:

  • table name - table where the AOR resides (Ex: location).
  • AOR (optional) - only delete/sync this user AOR, not the whole table. Format: “username[@domain]” (domain is required only if use domain option is on).

This command will only take effect if the module is running under a cluster-enabled working mode preset.

The current node will locate a healthy donor node within the location cluster and issue a sync request to it. The donor node will then proceed to push all of its user location data over to the current node, via the binary interface. The received data will be merged with existing data. Conflicting contacts (matched according to matching mode) are overwritten only if the sync data is newer than the current data.

Exported statistics are listed in the next sections.

Number of AOR existing in the USRLOC memory cache for that domain - can not be resetted; this statistic will be register for each used domain (Ex: location).

Number of contacts existing in the USRLOC memory cache for that domain - can not be resetted; this statistic will be register for each used domain (Ex: location).

Total number of expired contacts for that domain - can be resetted; this statistic will be register for each used domain (Ex: location).

Total number of AOR existing in the USRLOC memory cache for all domains - can not be resetted.

This event is raised when a new AOR is inserted in the USRLOC memory cache.

Parameters:

  • aor - The AOR of the inserted record.

This event is raised when a new AOR is deleted from the USRLOC memory cache.

Parameters:

  • aor - The AOR of the deleted record.

This event is raised when a new contact is inserted in any of the existing AOR’s contact list. For each new contact, if its AOR does not exist in the memory, then both the E_UL_AOR_CREATE and E_UL_CONTACT_INSERT events will be raised.

Parameters:

  • aor - The AOR of the inserted contact.
  • uri - The contact URI of the inserted contact.
  • received - IP, port and protocol the registration message was received from. If these have the same value as the contact’s address (see the address parameter) then the received parameter will be an empty string.
  • path - The PATH header value of the registration message.(empty string if not present)
  • qval - The Q value (priority) of the contact (as integer value from 0 to 10).
  • socket - The SIP socket/listener (as string) used by OpenSIPS to receive the contact registations.
  • bflags - The branch flags (bflags) of the contact (in integer value of the bitmask)
  • expires - The expires value of the contact (as UNIX timestamp integer).
  • callid - The Call-ID header of the registration message.
  • cseq - The cseq number as an int value.
  • attr - The attributes string attached to the contact (the custom attributes attached from the script level). As this string is options, if missing in the contact, the event will push the empty string for this event field.
  • latency - The latency of the last successful ping for this contact. Until the first ping reply for a given contact arrives, its pinging latency will be 0.
  • shtag - The shared tag of the contact, which helps determine if the current node owns the contact (e.g. possibly using the $cluster.sh_tag pseudo-variable in order to perform the check). *NOTICE:*If a contact has no shared tag attached to it, the value of this parameter will be "" (empty string)!

This event is raised when a contact is deleted from an existing AOR’s contact list. If the contact is the only one in the list then both the E_UL_AOR_DELETE and E_UL_CONTACT_DELETE events will be raised.

Parameters: same as the E UL CONTACT INSERT event

This event is raised when a contact’s info is updated by receiving another registration message.

Parameters: same as the E UL CONTACT INSERT event

This event is raised when a contact pinging latency matches either of the latency event min us or latency event min us delta filters. If none of these filters is set, this event will get raised for each successful contact ping operation.

Parameters: same as the E UL CONTACT INSERT event

The function registers a new domain. Domain is just another name for table used in registrar. The function is called from fixups in registrar. It gets name of the domain as a parameter and returns pointer to a new domain structure. The fixup than ‘fixes’ the parameter in registrar so that it will pass the pointer instead of the name every time save() or lookup() is called. Some usrloc functions get the pointer as parameter when called. For more details see implementation of save function in registrar.

Meaning of the parameters is as follows:

  • const char name* - Name of the domain (also called table) to be registered.

ul_insert_urecord(domain, aor, rec, is_replicated)

Section titled “ul_insert_urecord(domain, aor, rec, is_replicated)”

The function creates a new record structure and inserts it in the specified domain. The record is structure that contains all the contacts for belonging to the specified username.

Meaning of the parameters is as follows:

  • udomain_t domain* - Pointer to domain returned by ul_register_udomain.
  • str aor* - Address of Record (aka username) of the new record (at this time the record will contain no contacts yet).
  • urecord_t* rec* - The newly created record structure.
  • char is_replicated - Specifies whether this function will be called from the context of a Binary Interface callback. If uncertain, simply use 0.

ul_delete_urecord(domain, aor, is_replicated)

Section titled “ul_delete_urecord(domain, aor, is_replicated)”

The function deletes all the contacts bound with the given Address Of Record.

Meaning of the parameters is as follows:

  • udomain_t domain* - Pointer to domain returned by ul_register_udomain.
  • str aor* - Address of record (aka username) of the record, that should be deleted.
  • char is_replicated - Specifies whether this function will be called from the context of a Binary Interface callback. If uncertain, simply use 0.

The function returns pointer to record with given Address of Record.

Meaning of the parameters is as follows:

  • udomain_t domain* - Pointer to domain returned by ul_register_udomain.

  • str aor* - Address of Record of request record.

The function lock the specified domain, it means, that no other processes will be able to access during the time. This prevents race conditions. Scope of the lock is the specified domain, that means, that multiple domain can be accessed simultaneously, they don’t block each other.

Meaning of the parameters is as follows:

  • udomain_t domain* - Domain to be locked.

Unlock the specified domain previously locked by ul_lock_udomain.

Meaning of the parameters is as follows:

  • udomain_t domain* - Domain to be unlocked.

Do some sanity checks - if all contacts have been removed, delete the entire record structure.

Meaning of the parameters is as follows:

  • urecord_t record* - Record to be released.
  • char is_replicated - Specifies whether this function will be called from the context of a Binary Interface callback. If uncertain, simply use 0.

ul_insert_ucontact(record, contact, contact_info, contact, is_replicated)

Section titled “ul_insert_ucontact(record, contact, contact_info, contact, is_replicated)”

The function inserts a new contact in the given record with specified parameters.

Meaning of the parameters is as follows:

  • urecord_t record* - Record in which the contact should be inserted.
  • str contact* - Contact URI.
  • ucontact_info_t contact_info* - Single structure containing the new contact information
  • char is_replicated - Specifies whether this function will be called from the context of a Binary Interface callback. If uncertain, simply use 0.

ul_delete_ucontact (record, contact, is_replicated)

Section titled “ul_delete_ucontact (record, contact, is_replicated)”

The function deletes given contact from record.

Meaning of the parameters is as follows:

  • urecord_t record* - Record from which the contact should be removed.

  • ucontact_t contact* - Contact to be deleted.

  • char is_replicated - Specifies whether this function will be called from the context of a Binary Interface callback. If uncertain, simply use 0.

ul_delete_ucontact_from_id (domain, contact_id)

Section titled “ul_delete_ucontact_from_id (domain, contact_id)”

The function deletes a contact with the given contact_id from the given domain.

Meaning of the parameters is as follows:

  • udomain_t domain* - Domain where the contact can be found.

  • uint64_t contact_id - Contact_id identifying the contact to be deleted.

The function tries to find contact with given Contact URI and returns pointer to structure representing the contact.

Meaning of the parameters is as follows:

  • urecord_t record* - Record to be searched for the contact.

  • str_t contact* - URI of the request contact.

ul_get_domain_ucontacts (domain, buf, len, flags)

Section titled “ul_get_domain_ucontacts (domain, buf, len, flags)”

The function retrieves all contacts of all registered users from the given doamin and returns them in the caller-supplied buffer. If the buffer is too small, the function returns positive value indicating how much additional space would be necessary to accommodate all of them. Please note that the positive return value should be used only as a “hint”, as there is no guarantee that during the time between two subsequent calls number of registered contacts will remain the same.

If flag parameter is set to non-zero value then only contacts that have the specified flags set will be returned. It is, for example, possible to list only contacts that are behind NAT.

Meaning of the parameters is as follows:

  • udomaint_t domain* - Domain from which to get the contacts

  • void buf* - Buffer for returning contacts.

  • int len - Length of the buffer.

  • unsigned int flags - Flags that must be set.

The function retrieves all contacts of all registered users and returns them in the caller-supplied buffer. If the buffer is too small, the function returns positive value indicating how much additional space would be necessary to accommodate all of them. Please note that the positive return value should be used only as a “hint”, as there is no guarantee that during the time between two subsequent calls number of registered contacts will remain the same.

If flag parameter is set to non-zero value then only contacts that have the specified flags set will be returned. It is, for example, possible to list only contacts that are behind NAT.

Meaning of the parameters is as follows:

  • void buf* - Buffer for returning contacts.

  • int len - Length of the buffer.

  • unsigned int flags - Flags that must be set.

ul_update_ucontact(record, contact, contact_info, is_replicated)

Section titled “ul_update_ucontact(record, contact, contact_info, is_replicated)”

The function updates contact with new values.

Meaning of the parameters is as follows:

  • urecord_t record* - Record in which the contact should be inserted.
  • ucontact_t contact* - Contact URI.
  • ucontact_info_t contact_info* - Single structure containing the new contact information
  • char is_replicated - Specifies whether this function will be called from the context of a Binary Interface callback. If uncertain, simply use 0.

The function imports all functions that are exported by the USRLOC module. Overs for other modules which want to user the internal USRLOC API an easy way to load and access the functions.

Meaning of the parameters is as follows:

  • usrloc_api_t api* - USRLOC API

The function register with USRLOC a callback function to be called when some event occures inside USRLOC.

Meaning of the parameters is as follows:

  • int types - type of event for which the callback should be called (see usrloc/ul_callback.h).
  • ul_cb f - callback function; see usrloc/ul_callback.h for prototype.
  • *void param - some parameter to be passed to the callback each time when it is called.

The function loops through all domains summing up the number of users.

Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)

#NameDevScoreCommitsLines++Lines—
1.Jan Janak (@janakj)4291171601810675
2.Liviu Chircu (@liviuchircu)25115565562367
3.Bogdan-Andrei Iancu (@bogdan-iancu)24814444193963
4.Ionut Ionita (@ionutrazvanionita)50241444758
5.Daniel-Constantin Mierla (@miconda)4229647411
6.Vlad Patrascu (@rvlad-patrascu)3820795658
7.Jiri Kuthan (@jiriatipteldotorg)3725976121
8.Stefan Darius (@dariusstefan)3342284495
9.Razvan Crainea (@razvancrainea)3124414155
10.Henning Westerholt (@henningw)2111464358

All remaining contributors: Andrei Pelinescu-Onciul, Vlad Paiu (@vladpaiu), Nils Ohlmeier, Eseanu Marius Cristian (@eseanucristian), Ovidiu Sas (@ovidiusas), Maksym Sobolyev (@sobomax), Ionel Cerghit (@ionel-cerghit), Andrei Dragus, Walter Doekes (@wdoekes), Andrei Datcu (@andrei-datcu), Anca Vamanu, Alessio Garzi (@Ozzyboshi), Zero King (@l2dy), Dusan Klinec (@ph4r05), Juha Heinanen (@juha-h), Marcus Hunger, Jamey Hicks, Peter Lemenkov (@lemenkov), Andreas Granig, Shlomi Gutman, @jalung, Jeffrey Magder, Phil D’Amore, Norman Brandinger (@NormB), David Sanders, Konstantin Bokarius, Klaus Darilion, Aron Podrigal (@ar45), Iouri Kharon, Dan Pascu (@danpascu), UnixDev, Matthew M. Boedicker, Edson Gellert Schubert, Elena-Ramona Modroiu, Stephane Alnet.

(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)

(2) including any documentation-related commits, excluding merge commits

(3) ignoring whitespace edits, renamed files and auto-generated files

#NameCommit Activity
1.Razvan Crainea (@razvancrainea)Jul 2011 - Jul 2026
2.Stefan Darius (@dariusstefan)Jun 2026 - Jul 2026
3.Walter Doekes (@wdoekes)Apr 2019 - Sep 2020
4.Liviu Chircu (@liviuchircu)Jan 2013 - Jul 2020
5.Bogdan-Andrei Iancu (@bogdan-iancu)Mar 2002 - Jun 2020
6.Zero King (@l2dy)Mar 2020 - Mar 2020
7.Peter Lemenkov (@lemenkov)Jun 2018 - Feb 2020
8.Aron Podrigal (@ar45)Aug 2019 - Aug 2019
9.Alessio Garzi (@Ozzyboshi)Aug 2019 - Aug 2019
10.Dan Pascu (@danpascu)May 2019 - May 2019

All remaining contributors: Vlad Patrascu (@rvlad-patrascu), Shlomi Gutman, @jalung, Vlad Paiu (@vladpaiu), Ionut Ionita (@ionutrazvanionita), Ionel Cerghit (@ionel-cerghit), Ovidiu Sas (@ovidiusas), Dusan Klinec (@ph4r05), Eseanu Marius Cristian (@eseanucristian), David Sanders, Andrei Datcu (@andrei-datcu), Stephane Alnet, Andrei Dragus, Phil D’Amore, UnixDev, Daniel-Constantin Mierla (@miconda), Henning Westerholt (@henningw), Iouri Kharon, Konstantin Bokarius, Edson Gellert Schubert, Anca Vamanu, Matthew M. Boedicker, Marcus Hunger, Elena-Ramona Modroiu, Jeffrey Magder, Norman Brandinger (@NormB), Andreas Granig, Juha Heinanen (@juha-h), Klaus Darilion, Jan Janak (@janakj), Andrei Pelinescu-Onciul, Jiri Kuthan (@jiriatipteldotorg), Maksym Sobolyev (@sobomax), Jamey Hicks, Nils Ohlmeier.

(1) including any documentation-related commits, excluding merge commits

Last edited by: Razvan Crainea (@razvancrainea), Liviu Chircu (@liviuchircu), Zero King (@l2dy), Vlad Patrascu (@rvlad-patrascu), Peter Lemenkov (@lemenkov), Bogdan-Andrei Iancu (@bogdan-iancu), Ionut Ionita (@ionutrazvanionita), Eseanu Marius Cristian (@eseanucristian), Ovidiu Sas (@ovidiusas), Andrei Datcu (@andrei-datcu), Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Henning Westerholt (@henningw), Marcus Hunger, Elena-Ramona Modroiu, Juha Heinanen (@juha-h), Jan Janak (@janakj), Maksym Sobolyev (@sobomax), Nils Ohlmeier.

All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0