Skip to content

Commit

Permalink
usrloc: do not ignore contacts that don't match a listener
Browse files Browse the repository at this point in the history
(cherry picked from commit 3b99412)
  • Loading branch information
razvancrainea committed Feb 22, 2017
1 parent b4c3e02 commit e6dcfac
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 46 deletions.
79 changes: 41 additions & 38 deletions modules/usrloc/README
Expand Up @@ -8,17 +8,13 @@ Edited by

Jan Janak

Edited by

Bogdan-Andrei Iancu

Edited by

Ovidiu Sas

Copyright © 2003 FhG FOKUS
Copyright 2003 FhG FOKUS

Copyright © 2005-2008 Voice Sistem SRL
Copyright 2005-2008 Voice Sistem SRL
Revision History
Revision $Revision: 8740 $ $Date$
__________________________________________________________
Expand Down Expand Up @@ -199,7 +195,7 @@ Chapter 1. Admin Guide

For more details on how to control/select the contact matching
algorithm, please see the module parameter matching_mode at
Section 1.3.23, matching_mode (integer).
Section 1.3.23, "matching_mode (integer)".

1.1.2. Contact replication

Expand Down Expand Up @@ -232,6 +228,13 @@ Chapter 1. Admin Guide
accept_replicated_contacts and replicate_contacts_to parameters
of the module.

Note that for certain scenarios, where NAT or multihomed
interfaces are involved, you might need to preserve the same
interface among all the OpenSIPS servers within the replication
cluster. Otherwise when an instance receives a replicated
contact for whom it does not have a listener, it will use a
different listener of his.

1.2. Dependencies

1.2.1. OpenSIPS Modules
Expand All @@ -257,7 +260,7 @@ Chapter 1. Admin Guide
module.

WARNING: Setting INT flags is deprecated! Use quoted strings
instead! Default value is NULL (not set).
instead! Default value is "NULL" (not set).

Example 1.1. Set nat_bflag parameter
...
Expand All @@ -268,7 +271,7 @@ modparam("usrloc", "nat_bflag", "NAT_BFLAG")

Name of column containing usernames.

Default value is username.
Default value is "username".

Example 1.2. Set user_column parameter
...
Expand All @@ -279,7 +282,7 @@ modparam("usrloc", "user_column", "username")

Name of column containing domains.

Default value is domain.
Default value is "domain".

Example 1.3. Set user_column parameter
...
Expand All @@ -290,7 +293,7 @@ modparam("usrloc", "domain_column", "domain")

Name of column containing contacts.

Default value is contact.
Default value is "contact".

Example 1.4. Set contact_column parameter
...
Expand All @@ -301,7 +304,7 @@ modparam("usrloc", "contact_column", "contact")

Name of column containing expires value.

Default value is expires.
Default value is "expires".

Example 1.5. Set expires_column parameter
...
Expand All @@ -312,7 +315,7 @@ modparam("usrloc", "expires_column", "expires")

Name of column containing q values.

Default value is “q”.
Default value is "q".

Example 1.6. Set q_column parameter
...
Expand All @@ -323,7 +326,7 @@ modparam("usrloc", "q_column", "q")

Name of column containing callid values.

Default value is callid.
Default value is "callid".

Example 1.7. Set callid_column parameter
...
Expand All @@ -334,7 +337,7 @@ modparam("usrloc", "callid_column", "callid")

Name of column containing cseq numbers.

Default value is cseq.
Default value is "cseq".

Example 1.8. Set cseq_column parameter
...
Expand All @@ -345,7 +348,7 @@ modparam("usrloc", "cseq_column", "cseq")

Name of column containing supported methods.

Default value is methods.
Default value is "methods".

Example 1.9. Set methods_column parameter
...
Expand All @@ -356,7 +359,7 @@ modparam("usrloc", "methods_column", "methods")

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

Default value is flags.
Default value is "flags".

Example 1.10. Set flags_column parameter
...
Expand All @@ -367,7 +370,7 @@ modparam("usrloc", "flags_column", "flags")

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

Default value is cflags.
Default value is "cflags".

Example 1.11. Set cflags_column parameter
...
Expand All @@ -378,7 +381,7 @@ modparam("usrloc", "cflags_column", "cflags")

Name of column containing user-agent values.

Default value is user_agent.
Default value is "user_agent".

Example 1.12. Set user_agent_column parameter
...
Expand All @@ -390,7 +393,7 @@ 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.
Default value is "received".

Example 1.13. Set received_column parameter
...
Expand All @@ -402,7 +405,7 @@ modparam("usrloc", "received_column", "received")
Name of column containing the received socket information
(IP:port) for the REGISTER message.

Default value is socket.
Default value is "socket".

Example 1.14. Set socket_column parameter
...
Expand All @@ -413,7 +416,7 @@ modparam("usrloc", "socket_column", "socket")

Name of column containing the Path header.

Default value is path.
Default value is "path".

Example 1.15. Set path_column parameter
...
Expand All @@ -424,7 +427,7 @@ modparam("usrloc", "path_column", "path")

Name of column containing the SIP instance.

Default value is NULL.
Default value is "NULL".

Example 1.16. Set sip_instance_column parameter
...
Expand All @@ -436,7 +439,7 @@ modparam("usrloc", "sip_instance_column", "sip_instance")
Name of column containing additional registration-related
information.

Default value is NULL.
Default value is "NULL".

Example 1.17. Set attr_column parameter
...
Expand All @@ -449,7 +452,7 @@ modparam("usrloc", "attr_column", "attr")
for identifing the user (along with the username part). Useful
in multi domain scenarios. Non 0 value means true.

Default value is 0 (false).
Default value is "0 (false)".

Example 1.18. Set use_domain parameter
...
Expand All @@ -462,7 +465,7 @@ modparam("usrloc", "use_domain", 1)
otherwise the contact will be ordered based on q value. Non 0
value means true.

Default value is 0 (false).
Default value is "0 (false)".

Example 1.19. Set desc_time_order parameter
...
Expand All @@ -487,7 +490,7 @@ modparam("usrloc", "timer_interval", 120)
URL of the database that should be used.

Default value is
mysql://opensips:opensipsrw@localhost/opensips.
"mysql://opensips:opensipsrw@localhost/opensips".

Example 1.21. Set db_url parameter
...
Expand Down Expand Up @@ -547,7 +550,7 @@ modparam("usrloc", "db_mode", 2)
1.3.23. matching_mode (integer)

What contact matching algorithm to be used. Refer to section
Section 1.1.1, Contact matching for the description of the
Section 1.1.1, "Contact matching" for the description of the
algorithms.

The parameter may take the following values:
Expand All @@ -574,7 +577,7 @@ modparam("usrloc", "matching_mode", 1)

A value of 0 disable the retransmission detection.

Default value is 20 seconds.
Default value is "20 seconds".

Example 1.24. Set cseq_delay parameter
...
Expand All @@ -588,12 +591,12 @@ modparam("usrloc", "cseq_delay", 5)
instances, that belong to the specified cluster id, through the
Binary Interface.

Default value is “0” (no cluster id specified) - Binary
Default value is "0" (no cluster id specified) - Binary
Interface listeners (if any) will simply ignore any
usrloc-related packets

More details on the user location replication mechanism are
available in Section 1.1.2, Contact replication
available in Section 1.1.2, "Contact replication"

Example 1.25. Setting the accept_replicated_contacts parameter
...
Expand All @@ -610,7 +613,7 @@ modparam("usrloc", "accept_replicated_contacts", 1)
Default value is 0 (no cluster id specified)

More details on the user location replication mechanism are
available in Section 1.1.2, Contact replication
available in Section 1.1.2, "Contact replication"

Example 1.26. Setting the replicate_contacts_to parameter
...
Expand All @@ -627,7 +630,7 @@ modparam("usrloc", "replicate_contacts_to", 1)
Interface events, DB queries may be freely performed)

More details on the user location replication mechanism are
available in Section 1.1.2, Contact replication
available in Section 1.1.2, "Contact replication"

Example 1.27. Setting the skip_replicated_db_ops parameter
...
Expand Down Expand Up @@ -656,7 +659,7 @@ modparam("usrloc", "max_contact_delete", 10)
the maximu size of this parameter is 16, meaning that the hash
supports maximum 65536 entries.

Default value is “9”.
Default value is "9".

Example 1.29. Set hash_size parameter
...
Expand All @@ -673,7 +676,7 @@ modparam("usrloc", "hash_size", 10)
parameter is changed. Enabling this parameter will regenerate
broken contact id's based on current configurations.

Default value is 0(not enabled)
Default value is "0(not enabled)"

Example 1.30. Set regen_broken_contactid parameter
...
Expand Down Expand Up @@ -713,7 +716,7 @@ modparam("usrloc", "regen_broken_contactid", 1)

Parameters:
* brief - (optional, may not be present); if equals to string
brief, a brief dump will be done (only AOR and contacts,
"brief", a brief dump will be done (only AOR and contacts,
with no other details)

1.5.4. ul_flush
Expand Down Expand Up @@ -1003,7 +1006,7 @@ is_replicated)
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
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.

Expand All @@ -1027,7 +1030,7 @@ is_replicated)
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
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.

Expand Down
8 changes: 8 additions & 0 deletions modules/usrloc/doc/usrloc_admin.xml
Expand Up @@ -119,6 +119,14 @@
<emphasis role='bold'><xref linkend="replicate_contacts_to"/></emphasis> parameters of the
module.
</para>
<para>
<emphasis>Note</emphasis> that for certain scenarios, where NAT or
multihomed interfaces are involved, you might need to preserve the
same interface among all the &osips; servers within the replication
cluster. Otherwise when an instance receives a replicated contact
for whom it does not have a listener, it will use a different
listener of his.
</para>
</section>
</section>

Expand Down
12 changes: 4 additions & 8 deletions modules/usrloc/ureplication.c
Expand Up @@ -301,10 +301,8 @@ static int receive_ucontact_insert(void)
}

ci.sock = grep_sock_info(&host, (unsigned short) port, (unsigned short) proto);
if (!ci.sock) {
LM_ERR("non-local socket <%.*s>\n", sock.len, sock.s);
goto error;
}
if (!ci.sock)
LM_DBG("non-local socket <%.*s>\n", sock.len, sock.s);

bin_pop_int(&ci.cseq);
bin_pop_int(&ci.flags);
Expand Down Expand Up @@ -402,10 +400,8 @@ static int receive_ucontact_update(void)
}

ci.sock = grep_sock_info(&host, (unsigned short) port, (unsigned short) proto);
if (!ci.sock) {
LM_ERR("non-local socket <%.*s>\n", sock.len, sock.s);
goto error;
}
if (!ci.sock)
LM_DBG("non-local socket <%.*s>\n", sock.len, sock.s);

bin_pop_int(&ci.cseq);
bin_pop_int(&ci.flags);
Expand Down

0 comments on commit e6dcfac

Please sign in to comment.