

Routr fronts media servers, it doesn’t replace them
Routr handles signaling. Asterisk, FreeSWITCH, and similar servers handle media: IVRs, conferences, recordings, and voicemail. Putting Routr in front of them gives you one SIP entry point for phones and carriers, and lets you add or remove media servers without changing anything on the phone or carrier side. Load balancing picks a server when a call starts. It doesn’t move calls that are already up: if a media server goes away, the calls on it end.Group servers under one address of record
A Peer has an address of record (aor), such as sip:conference@sip.local, and Credentials. When a server registers using the Peer’s username and password, Connect stores its route under the Peer’s aor, not under the server’s own address. Register three Asterisk servers with the same Credentials, and the aor holds three routes.
- From the PSTN, through a Number whose
aorLinkis the Peer’saor. - From an Agent, as an
agent-to-peercall.
loadBalancing settings and asks the Location Service for one route.
Algorithms
round-robin
The Location Service takes turns: the first call goes to the first registered route, the next call to the second, and so on, starting over after the last. The turn counter lives in the memory of each Location Service instance. If you run several instances, each keeps its own counter, so the spread is even per instance rather than across the whole cluster.least-sessions
The Location Service sends each call to the route reporting the fewest active sessions. Each server reports its count in anX-Session-Count header on the REGISTER requests it sends to Routr. Routr doesn’t count calls itself, so:
- A server that doesn’t send
X-Session-Countis stored with a count of-1, which sorts first. - Counts are only as fresh as the last
REGISTER. Shorter registration intervals give the Location Service a more current picture.
least-sessions when you run more than one Location instance, so every instance sees the same routes and counts. See Scale with Redis.
Session affinity
WithwithSessionAffinity: true, calls that belong together reach the same server. This matters for conferences: every participant in a room must land on the Asterisk server that hosts it.
Affinity is keyed by a header you choose on the Number. Set the Number’s sessionAffinityHeader, for example X-Room-Id. When a call from the PSTN carries that header, the Location Service:
- Looks up the server already assigned to that header value.
- If there’s none, picks the server with the fewest sessions and remembers the assignment.
algorithm. The assignment is stored in the Location Service cache, so use Redis when you run several Location instances.
Requests within a call
Load balancing happens once per call. The Location Service remembers the route it chose for each Call-ID, so later requests for the same call go to the same server.Related pages
Load balance Asterisk
Put Routr in front of several Asterisk servers.
Connect a PBX as a Peer
Register Asterisk or FreeSWITCH with Routr.
Location Service
Configure the cache provider.
Peers
See every Peer field, including
loadBalancing.