This module allows building clusters of servers for a single domain. All nodes are equivalent and they can be addressed from within the cluster by their Node Name.
When a user registers (on any protocol) the name of the server it registered to is added in front of the user's location.
Later, when a call is to be made to an user the call will be initiated from the same server the user registered to. This avoids problems with firewalls and NAT and with calls accepted only from the registrar the endpoint is connected to.
How it works
The module works by selectively altering resource names in Yate's messages. Relevant parameters are prefixed with the node name of the server that should handle them.
When a resource is to be used (like for target of a call) the node name in the resource is compared with the local node name. If they are the same the call is for the local server so the cluster prefix and node name are simply removed from the resource name. If the resource is remote (node name is not empty and is not the local node name either) the call is forwarded inside the cluster to the desired server.
Additionally, cluster nodes can be allocated at call time by specifying * as node name. A cluster.locate message is issued to locate the node serving a specific resource (conference room, parking orbit, etc.) or optionally to allocate a new one.
The following messages are examined:
- user.register - to add node name to the user's location so it will be known which server it registered with
- call.execute - so calls are forwarded to the server that can place them to the final target
- call.route - to detect internal calls within the cluster
[general] ; Global settings of the clustering module ; enabled: boolean: Enable clustering module operation ;enabled=true if regexp and callto are set, false if any of them is empty ; prefix: string: Prefix used for cluster resources ;prefix=cluster ; regexp: string: Regular expression describing node name match rules ;regexp= ; callto: string: Template for forwarding the call to target node ;callto= ; locate: string: Message used for locating dynamic resources on cluster nodes ;locate=cluster.locate ; user.register: boolean: Enable modifying registration messages for clustering ;user.register=yes ; call.cdr: boolean: Enable adding prefix and node information to CDR messages ;call.cdr=yes [priorities] ; Handler priorities for each message, applied only on first initialization ; call.route: int: Priority of route message handler (on target node) ;call.route=50 ; call.execute: int: Priority of execute message handler (on source node) ;call.execute=50 ; user.register: int: Priority of registration message handler (on registrar) ;user.register=50 ; call.cdr: int: Priority of CDR message handler (all nodes) ;call.cdr=25
Settings for parameter prefix
The prefix must be the same on all nodes in a cluster. It can be set to empty, in that case cluster resource names will start with a slash, like: