Failover de tronco SIP: como projetar e testar
Design SIP trunk failover that works on the day: DNS SRV, OPTIONS health checks, a backup carrier with your caller IDs on it, enough capacity and a test plan.
Resposta rápida
SIP trunk failover needs four things working together: a health check that detects failure (SIP OPTIONS pings plus quality triggers such as ASR and PDD), a rule that moves traffic, a backup carrier that already has your caller IDs and enough channels and CPS, and a test you have actually run. DNS SRV records help clients find a second server, but they do not replace health checks or provisioning.
Most outbound teams have a backup trunk on paper. On the day the primary carrier has a bad hour, a surprising number of those backups turn out not to work: the caller IDs were never added, the channel limit is a tenth of the primary's, the IP address was never allow-listed, or the switch simply never triggered because the primary was "up" but answering nothing. Failover is not a feature you switch on; it is a design you test.
This guide covers what failover must protect against, how DNS and SIP OPTIONS fit in, how to choose between primary and secondary and weighted routing, the provisioning details that cause most real failures, and a test plan. It extends the single paragraphs on redundancy in our BYOC setup guide e o guide to choosing a SIP trunk provider.
What failover must cover
Three different failures need three different responses. Treat them separately.
| Failure | What you see | What detects it |
|---|---|---|
| Carrier down | No answer to signalling, timeouts, refused connections | OPTIONS pings, INVITE timeouts |
| Route degraded | Calls connect but answer rate falls, post-dial delay climbs, audio is poor | Quality thresholds: ASR, ACD, PDD, MOS |
| Media node down | Your own side fails: calls do not set up or have no audio | Load-balancer checks, more than one media node |
The middle row is the one most designs miss. A carrier that answers every OPTIONS ping with a 200 can still be sending calls into a black hole for a given country. Only quality measures, such as answer-seizure ratio, average call duration and post-dial delay, catch that.
DNS-based failover: SRV and NAPTR
RFC 3263 describes how SIP uses DNS. A client resolves a SIP URI into the IP address, port and transport of the next hop, using both SRV and NAPTR records. The RFC's abstract also says DNS is used to let a server send a response to a backup client if the primary client has failed (RFC 3263, abstract). In practice, when a carrier publishes several SRV records for one service name, the client tries them in order: RFC 3263 treats a 503 response, a transport failure or a request that never gets any response as a failure, and says the client should then send the request to the next server in the list (RFC 3263, section 4.3). The order comes from each SRV record's priority, with weight sharing traffic among records of equal priority (RFC 2782). NAPTR records add transport selection: they map a domain to the SRV record for a particular transport, with service values such as SIP+D2U for UDP, SIP+D2T for TCP and SIPS+D2T for TLS over TCP (RFC 3263, section 4.1).
That is useful, and it has limits you should plan for:
- It handles reachability, not quality. A server that is up and responding badly stays at the top of the list.
- It depends on the client. Not every platform or PBX implements the full RFC 3263 behaviour. Some resolve once and stick to one address. Test what your platform actually does.
- DNS caching sets the timing. A client that caches the answer will not notice a change until the cached record expires.
- It is the carrier's design. The records are theirs, so you choose a carrier that publishes redundant endpoints, and you ask how they behave in an outage.
- It does not cross carriers. SRV records point inside one provider. Failing over to a different carrier is a routing decision in your own platform.
Health checks: OPTIONS pings and quality triggers
SIP OPTIONS
RFC 3261 section 11 defines the OPTIONS method as a way for a UA to query another UA or a proxy server about its capabilities without ringing the other party, and states that all UAs must support it. Section 11.2 adds that the response code must be the same one an INVITE would have received: a 200 if the UAS is ready to accept a call, a 486 if it is busy, and so on. This allows an OPTIONS request to be used to determine the basic state of a UAS, and an indication of whether it will accept an INVITE (RFC 3261, sections 11 and 11.2). The same section notes limitations from differences in how proxies handle OPTIONS and INVITE, so a good OPTIONS result is a strong hint and not a promise.
Settings to agree on:
- Interval. Every few seconds to every thirty. Shorter detects faster and costs more signalling.
- Failures before action. Require several misses in a row. One lost UDP packet should not move all your traffic.
- Recovery rule. Decide when traffic returns to the primary: automatically after sustained success, or only after a person approves. Without a rule, a flapping route bounces calls back and forth.
- INVITE timeout. How long to wait for a response to a real call before trying the next route. Too long and callers hear dead air; too short and a slow-but-working route is abandoned.
Quality triggers
Add triggers on measurements of real calls:
- ASR, the share of attempts that are answered. A sharp drop on one route usually means a problem there.
- ACD, average call duration. A fall suggests calls connect and then fail or are abandoned.
- PDD, post-dial delay, the wait before ringing begins.
Set the thresholds from your own baseline, measured over a normal period for each destination, not from an industry number. ASR varies widely with list quality and country, so a threshold that is right for one campaign may fire constantly on another. Use a minimum number of attempts before a trigger can fire, otherwise a handful of calls swings the percentage.
Primary and secondary or weighted routing
| Pattern | Como funciona | Strength | Weakness |
|---|---|---|---|
| Primary and secondary | All traffic on the primary; the backup carries calls only when the primary is marked down | Simple; you know where calls go | The backup is idle, so problems on it stay hidden until you need it |
| Weighted multi-carrier | Traffic is shared between carriers by weight, for example 70 and 30 | Both routes are proven by live traffic; each carrier can lose its share without a full switch | More to manage; each carrier needs caller IDs and capacity for its share, and more when it must absorb all of it |
| By destination | Different carriers per country or number type, each backing up the other | Uses each carrier's strengths | The most rules to maintain |
A common middle path is primary and secondary, plus a small, steady share of live traffic sent to the secondary so that it is never cold. It costs a little extra management and removes the "we never knew it was broken" risk.
Your caller IDs must be on the backup carrier too
This is the failure that surprises people most. The number you present as caller ID has to be authorised with the carrier that sends the call. If the backup carrier has never seen that number on your account, it may reject the call, replace the number with its own, or accept the call and have it labelled differently by the receiving network. On the day of the switch, the campaign may continue, but with a different caller ID than your customers recognise, and answer rates can fall.
- List every DID and caller ID you present, per campaign.
- For each, confirm in writing that the backup carrier authorises it, and for which destinations.
- Check how the backup carrier treats a number it does not own: reject, replace, or pass through.
- Check that the number format (E.164 or national) your platform sends is what the backup expects. See the guide on connecting your SIP trunk for the field-by-field setup.
Other provisioning items travel with the same checklist: the source IP address of your platform must be on the backup carrier's allow-list, authentication must be set up, and codecs and the DTMF mode must be compatible.
CPS and channel capacity on the backup
The backup route must carry the whole load for as long as the primary is down. Compare two numbers on both carriers:
- Concurrent channels. If the primary allows 200 and the backup allows 40, failover turns an outage into a bottleneck. Our guide on de quantos canais SIP você precisa shows how to size this.
- Calls per second (CPS). A predictive dialer can burst. A backup with a lower CPS limit will reject the excess with errors that look like carrier faults. See SIP trunk CPS limits for a predictive dialer.
If the backup cannot carry everything, decide in advance what to cut: lower the dialing pace automatically, drop to the highest-value campaigns, or pause outbound and keep inbound. A planned reduction is better than a surprise.
Testing failover before you need it
- Write down the expected behaviour. What marks the primary as down, how long does it take, where does traffic go, how does it come back?
- Test the backup alone. Place real calls through the backup with the production caller IDs, to representative destinations. Check two-way audio, DTMF, caller ID display and recording.
- Take the primary out of service. In a quiet window, disable it in your platform, or block it at the firewall, and watch live calls move. Measure the time from failure to the first successful call on the backup.
- Test a soft failure. Simulate the middle row of the table: a route that answers pings but fails calls. If your triggers are right, they will fire.
- Test capacity. Run at your normal peak pace on the backup for a short period and watch for CPS or channel rejections.
- Test recovery. Re-enable the primary. Confirm traffic returns the way you designed, with no flapping.
- Check the alert. Somebody must be told when the switch happens. Silence reads as health.
- Record and repeat. Put the result and date in your runbook and repeat after changes and on a schedule.
Como DialerBee se encaixa
On the gateway form for BYOC (traga sua própria operadora) trunks, the Routing tab holds a Gateway de Failover field where you choose the backup trunk. Priority (1 to 10, with 1 the highest) and Weight (1 to 100) decide how traffic is shared across gateways, and the same tab has Max Concurrent Calls, a CPS limit, a Health Check Interval, the number of retries before failover and an INVITE timeout. DialerBee monitors trunk health in real time (ASR, ACD and PDD), and if a trunk fails or its quality drops below a threshold you configure, calls fail over to the backup carrier. On the media side, DialerBee runs two FreeSWITCH media nodes, with a SIP load balancer that distributes calls round-robin across them so carrier traffic does not depend on one node (see Confiabilidade da plataforma). The setup guide's go-live list includes a failover test: disable the primary gateway and confirm traffic moves.
The platform supplies the switch. The parts that only you can do are the ones in this article: caller IDs on the backup carrier, enough capacity there, and a test you have run.
Failover checklist
- Failure types listed: carrier down, route degraded, media node down.
- OPTIONS interval, failure count and recovery rule agreed and documented.
- Quality triggers set from a measured baseline, with a minimum number of attempts.
- Backup carrier has every caller ID and DID you present, confirmed in writing.
- Platform source IPs allow-listed and authentication set up on the backup.
- Backup channel and CPS limits match or exceed the primary, or a reduced-pace plan exists.
- Codecs and DTMF mode compatible on both carriers.
- Failover, soft-failure, capacity and recovery tests run, dated and recorded.
- Alert on every route change, delivered to a person.
- Test repeated after any change and on a schedule.
Perguntas frequentes
What is SIP trunk failover?
It is the ability to send calls through a second route when the first one fails or degrades. The second route can be another carrier, another endpoint of the same carrier, or another media server. It works only if the backup is provisioned in advance with the same caller IDs, enough capacity and rules that trigger the switch.
Does DNS SRV give me failover?
It helps, but only for reachability. RFC 3263 describes how a SIP client resolves a URI through NAPTR and SRV records into an address, port and transport, and SRV records, defined in RFC 2782, let a domain list several servers with a priority and a weight. It does not tell you if the carrier is up but answering badly, and DNS caching decides how quickly clients move.
How do SIP OPTIONS pings work as a health check?
A UA sends an OPTIONS request to the far end. RFC 3261 says all UAs must support OPTIONS and that the response code must be the one an INVITE would have received: 200 if the server is ready to accept a call, 486 if it is busy. A timeout with no response is a failed check. It tests signalling, not audio or number routing.
Why do calls fail on the backup carrier even when it is up?
The most common reason is that the caller IDs you present are not provisioned on the backup account, so the carrier rejects or relabels the calls. Other reasons are a lower channel or calls-per-second limit than the primary, an IP address that is not on the backup carrier's allow-list, and codecs or DTMF settings that differ.
Should failover be automatic or manual?
Use both. Automatic failover covers outages at 3 a.m. Manual control matters for planned maintenance and for stopping a flapping route from bouncing traffic back and forth. Whatever you choose, make the switch visible: an alert that says the route has moved.
How often should I test failover?
Test it before launch, after any change to either trunk, and on a schedule, for example every quarter. A failover path that has never carried live traffic is an assumption. The test is simple: take the primary out of service on purpose, in a quiet window, and watch real calls complete on the backup.
Fontes
- RFC 3263, Session Initiation Protocol (SIP): Locating SIP Servers (abstract, section 4.1 NAPTR transport selection, section 4.3 trying the next server on failure). rfc-editor.org/rfc/rfc3263 (consultado em 7 de novembro de 2026)
- RFC 2782, A DNS RR for specifying the location of services (DNS SRV) (priority and weight fields). rfc-editor.org/rfc/rfc2782 (consultado em 7 de novembro de 2026)
- RFC 3261, SIP: Session Initiation Protocol (section 11 and 11.2: OPTIONS; all UAs must support it; the response code matches what an INVITE would receive). rfc-editor.org/rfc/rfc3261 (consultado em 7 de novembro de 2026)
Leituras relacionadas
- Traga sua própria operadora
- Como conectar seu trunk SIP (configuração BYOC)
- Choosing a SIP trunk provider for a dialer
- SIP trunk CPS limits
- How many SIP channels do I need
- What is answer-seizure ratio
- Confiabilidade da plataforma
Leitura relacionada: 99.9% vs 99.95% Uptime: What an SLA Covers · Modelo de plano de continuidade de negócios para call center
Artigos relacionados
SIP Trunk Registration Failed: How to Fix It
11 minutos de leitura
TecnologiaWebRTC Agent Audio Problems: A Fix Guide
Leitura de 10 minutos
ConformidadeSpain Ley 10/2025 Customer Service Law: 3-Minute Rule
Leitura de 10 minutos
OperaçõesSpeed to Lead: Call Web Leads in Minutes
Tempo de leitura: 9 minutos
Pronto para ver DialerBee em ação?
Solicite uma demo ao vivo de 15 minutos ou comece um teste grátis de 14 dias — sem slides, sem compromisso. As ligações começam assim que o seu próprio SIP trunk ou PBX estiver conectado e aprovado.
Teste grátis de 14 dias · crédito de IA gratuito · sem cartão · 11 idiomas · BYOC · controles de apoio à conformidade