Skip to content

[FEATURE] uac_registrant match URI to Contact header partially #2557

@vasilevalex

Description

@vasilevalex

Is your feature request related to a problem? Please describe.

If we have a lot of external registrations, let's say 100000, we can distribute them through several, for example 10 servers. Put accounts to the DB, connect all OpenSIPS servers to this DB, create cluster of servers.Create for example 10 different tags for cluster, so each server will process only 10% of total amount of registrations. And if one server dies, just move its' tag to another server. It will increase load twice, but everything will be reliable.
Very simple scheme. Just every server substitutes its' IP-address instead of the hostname in "binding_URI" when sending outgoing REGISTER:

local_route {
	if (is_method("REGISTER") && $(ct.fields(uri){uri.host}) == "local.opensips") {
		$var(subst) = "/local.opensips/$socket_out(ip):$socket_out(port)/g";
		$var(new_contact) = $(ct{re.subst,$var(subst)});
		remove_hf("Contact");
		append_hf("Contact: $var(new_contact)\r\n");
	}
}

Everything works, except one problem. Expiration time for registration, provided in "200 OK" from external system is not applied to OpenSIPS. Because module uac_registrant compares URI from Contact header from "200 OK" to the full value of "binding_URI". They are different, as we are changing Contact in outgoing REGISTER.
It would be nice to have parameter for matching contact URI, to choose what parts of URI must match. And just ignore the rest.

Describe the solution you'd like
Parameter to uac_registrant module to choose what parts of URI use to match.

Implementation
I'll send PR

Describe alternatives you've considered
Store in reg_record->contact not just raw value of binding_URI, but dynamic value with host depending on sending socket.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions