Sync registered peers between 2 Asterisks

Hello all,

I’ve been doing some failover configuration with 2 Asterisk machines and a webswitch. I do have now 1 Asterisk machine in production and one waiting in backup in case the other one fails. Both are being represented externally with a single virtual IP.

My problem is: how can I keep info regarding the registered peers synced between the 2 machines so I can achieve the next 2 cases:
1 - In case the first one fails the other one goes up and registers the users that were registered on the first one.
2 - When the first one goes back up, it registers exactly the ones that where registered on the backup one.

Yes, I am thinking that the end-user doesn’t have a VoIP-phone that reconnects by itself and I am trying to not use any database-dependent solution, I need it to be strictly based on files, since now I do have all my data in files. All the calls are SIP.

Asterisk version : running on Debian 5.0.6

Does anybody has any suggestions? Thanks

-Joel Oliveira


I assume you are using heartbeat ? and you are rsyncing the files beween servers and using drbd for the voicemail ? correct.

If you rsync the astdb then asterisk will know where the peers are on asterisk starting and the sets will send calls to the virtual IP /



First of all, thanks for your reply :smile: .

And now to answer your opinion and give my input on my present situation: Well, no… I am not using the heartbeat because I am only interested in using fail-over methods and that I can accomplish with an Alteon Web switch. And for rsyncing, that is for sure a future option for syncing the .conf files for sure.

The problem and maybe the option to that problem is from what I can understand from the AstDB ( … ECT-6.html) I need to use the application functions to populate the database, yes? There is no other way to sync the info regarding the registered users?

Best regards,
Joel Oliveira


My answer was ore of a statement than question.

If you rsync the astdb between servers or use drbd then Astrisk will more or less know know the registered peers

Do a database show on the server .

another simpler option we use on multi continent servers, (One of Our backup hosted servers is in the US and main server in the UK) is to use handsets that support backup registrar servers such as the Aastra range.



Sorry for only posting the reply now but once again thanks for your answer.

I started to look into the AstDB but I can’t seem to find how I manage to do the actions below:
1 - Set a record of the registered users in an Asterisk machine. What I’ve understand is that I can insert DB functions in the dialplan so I can have a record of the calls that are being made by the users. My problem is a little different, I need to know which users are registered so I can register them in the Backup Asterisk machine. Is there anything wrong with my thinking?
2 - Register the users into the Backup Asterisk machine. Even though I don’t know how to do the action above I guess I’ll have problems on register the users that I can fetch from the DB. Is it possible to accomplish that?

I guess my problem is to understand how the AstDB can help me. I found some info on … ECT-6.html but it doesn’t seems to be able to have a record on the registered users so I can register them afterwards.

I know it’s asking to much but can you provide a little example explaining how can I make Asterisks know the registered users?

Once again thanks for your time,
Joel Oliveira


To look at this another way, as you are providing limited info on what your users are using,

  1. use a hanset that supports backup registration settings
  2. which proberly would be teh case for you , is to set the handsets registration period low susch as 2 minutes so that if the systems failed overs the sets would be off air for incoming calls for 2 mins at the max.

I assume the backup server is off air and shut down till needed ? and brought online when server A fails


Hello Ian,

Sorry for taking so much time to answer you back.

In response of what you ask me: I don’t have control on what the users are using, so I cannot set the backup registration settings or even put the intervals of registration between 2 minutes. And finally no, the backup-server is not off-air, he’s alive in supposedely good-health state waiting for being served with users in case the primary-server goes “boom-boom”.

After seeing your post, something clicked in my mind and I finally understoud what I should’ve done. I only need to sync the astdb file between servers and the in case the primary server fails the backup will be there waiting for the requests of the new users and in between it’ll register the already registered users. Note that I had to restart Asterisk for each sync of the file because the Asterisk wouldn’t know the new table of registered peers.

Thanks for your time,
Joel Oliveira