How not to meet the apocalypse or minimize its likelihood
After reading the article “How did we meet the apocalypse or how did 3,500 companies go without calls?” a feeling of bewilderment appeared, and then a desire arose to share experience.
So, if you have, as yagodkinvs had :
Then welcome to cat.

Participating in one project, he was responsible for the initial setup and further maintenance of telephony. The project grew over time, the requirements changed, one of which was the uninterrupted work of the call center, with the exception of cases of loss of electricity and / or main accidents at providers (Internet and / or telephony).
I would like to note that it is impossible to reserve a phone number for 100%, if you have ONE. In the event of an accident with a telecom operator, you cannot do anything.
Therefore, they acted as follows. The main telephony server was taken out, roughly speaking, from the office to the cloud. For its reservation, the second in a cheap hosting has been raised.
Settings on the backup - a copy of the main, with the exception of minor nuances.
The project manager was offered the following options for automatically switching telephony between servers:
It should be noted that in the first option, the SIP-clients will switch to the new server after the registration timeout has worked.
In the second case, the authorization has been moved outside of Asterisk to the balancer itself.
But, the customer, having beaten the option with DNS, refused this. Justifying that updating the information in the DNS servers of the end devices can be very long.
The second option was postponed, since there are not so many operators so far, and the customer did not want to complicate this scheme yet. Well, the balancer would have been a weak point in the second option, and it would have to be reserved.
The customer suggested thinking of another option - he sets up two accounts for operators in SIP clients. They are essentially identical, the only differences are in the connection server. And for my part, it is necessary to work out the switching of telephony between servers.
That is, part of the scheme on the part of the subscribers took the following form:

Not perfect, but the customer insisted on such a decision, and all the labor costs for setting up SIP clients were undertaken by him. Assigned to the existing system administrator :)
Next. In order for calls to arrive anyway, an additional landline number was rented, but from a different service provider.
The number is posted on the site, along with the main one.
In the personal accounts of both telephone service providers, both servers were connected as sip clients.
The scripts for processing incoming calls were configured according to the following scheme:
Almost all VOIP providers allow you to configure this scheme either in your personal account or upon request to the support service. At least for those chosen by us, we set it up in your personal account.
The following scheme turned out:

Since the servers are external to the SIP clients, the customer has the opportunity to reserve Internet access channels for the call center without any problems. Although, I must say, he went even further and reserved a call center, opening part of it in another city.
The implemented scheme allowed avoiding downtime of the call center in such cases:
Of course, in any of these cases, the current calls were torn, and the subsequent ones already arrived according to the backup scheme.
I remember that feeling of satisfaction when in the evening in monitoring I saw a case of switching to a backup circuit.
And while no one called me with screams of panic, as this was practically not noticed.
Thank you for your attention! Hope anyone this material will be helpful.
So, if you have, as yagodkinvs had :
The backup was a server for the web, but with telephony is not so simple ...
Then welcome to cat.

Participating in one project, he was responsible for the initial setup and further maintenance of telephony. The project grew over time, the requirements changed, one of which was the uninterrupted work of the call center, with the exception of cases of loss of electricity and / or main accidents at providers (Internet and / or telephony).
How was this solved?
I would like to note that it is impossible to reserve a phone number for 100%, if you have ONE. In the event of an accident with a telecom operator, you cannot do anything.
Therefore, they acted as follows. The main telephony server was taken out, roughly speaking, from the office to the cloud. For its reservation, the second in a cheap hosting has been raised.
Settings on the backup - a copy of the main, with the exception of minor nuances.
The project manager was offered the following options for automatically switching telephony between servers:
- Use DNS, in particular - from Amazon. There you can configure a very quick name switching, for example voip.company.pro between the IP addresses of our two servers, by fail-over and other parameters.
- Use a balancer. Settings options for Kamailio and Asterisk, and not only it, are on the open spaces of the network.
It should be noted that in the first option, the SIP-clients will switch to the new server after the registration timeout has worked.
In the second case, the authorization has been moved outside of Asterisk to the balancer itself.
But, the customer, having beaten the option with DNS, refused this. Justifying that updating the information in the DNS servers of the end devices can be very long.
The second option was postponed, since there are not so many operators so far, and the customer did not want to complicate this scheme yet. Well, the balancer would have been a weak point in the second option, and it would have to be reserved.
The customer suggested thinking of another option - he sets up two accounts for operators in SIP clients. They are essentially identical, the only differences are in the connection server. And for my part, it is necessary to work out the switching of telephony between servers.
That is, part of the scheme on the part of the subscribers took the following form:

Not perfect, but the customer insisted on such a decision, and all the labor costs for setting up SIP clients were undertaken by him. Assigned to the existing system administrator :)
Next. In order for calls to arrive anyway, an additional landline number was rented, but from a different service provider.
The number is posted on the site, along with the main one.
In the personal accounts of both telephone service providers, both servers were connected as sip clients.
The scripts for processing incoming calls were configured according to the following scheme:
- When an incoming call arrives, it was sent to the main server, the dial-up time was 20 seconds.
- If the main server is unavailable, the call was sent to the backup, the dialing time is 20 seconds.
- When the backup server was unavailable, the call was sent to voicemail.
Almost all VOIP providers allow you to configure this scheme either in your personal account or upon request to the support service. At least for those chosen by us, we set it up in your personal account.
The following scheme turned out:

Since the servers are external to the SIP clients, the customer has the opportunity to reserve Internet access channels for the call center without any problems. Although, I must say, he went even further and reserved a call center, opening part of it in another city.
conclusions
The implemented scheme allowed avoiding downtime of the call center in such cases:
- Failure, for any reason, of one of the telephony servers.
- Loss of electricity and / or all communication channels to the Internet at one of the call centers
- An accident at one of the communication service providers
Of course, in any of these cases, the current calls were torn, and the subsequent ones already arrived according to the backup scheme.
I remember that feeling of satisfaction when in the evening in monitoring I saw a case of switching to a backup circuit.
And while no one called me with screams of panic, as this was practically not noticed.
Thank you for your attention! Hope anyone this material will be helpful.