Simple HA architecture for Asterisk

I have a simple HA architecture configured for VoIP. On server #1, Asterisk + FreePBX are running. On the second server, Asterisk + FreePBX are also installed, but these services are only started when server #1 is inactive. Both servers use a database cluster and share the same database. Configuration between the servers is fully synchronized. I’ve tested it, and the solution works well.

Both Asterisk servers use a VIP address. Phones connect to the Asterisk instance on the first server correctly and everything works fine. However, after switching to the failover server, I see that the phones connect and register (they also appear as registered on the Asterisk side). However, when I try to make a call, the phone displays the message “Service not available.”

I’m using Ubuntu 24.04 LTS, Asterisk 20.6 (from Ubuntu packages), and FreePBX 17.

My question is: why is this happening? Besides configuration, is there anything else that needs to be synchronized?

On Monday 13 October 2025 at 22:41:44, autominus via Asterisk Community wrote:

I have a simple HA architecture configured for VoIP.

after switching to the failover server, I see that the phones connect and
register (they also appear as registered on the Asterisk side). However,
when I try to make a call, the phone displays the message “Service not
available.”

Show us a SIP packet capture from the failover server of such a call, and also
the output of “pjsip show endpoints” from the same server at that time.

Antony.


“It wouldn’t be a good idea to talk about him behind his back in front of
him.”

  • murble

When an IP floats from one box to the other, make sure ARP tables are updated appropriately. Without this, IP phones may keep sending traffic to the previous box.

After switching to failover, I see the following in the communication:

Request: INVITE sip:9910@voip.voipsystems.lan |
Status: 100 Trying |
Status: 503 Service Unavailable | 
Request: ACK sip:9910@vip.voipsystems.lan | 

On the phone, the message “Service Unavailable” is displayed.

I checked and I can see that all the phones are registered.


 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  9910/9910                                            Not in use    0 of inf
     InAuth:  9910-auth/9910
        Aor:  9910                                               1
      Contact:  9910/sip:9910@10.200.5.53:5060             5d17dad8ad Avail        10.482

 Endpoint:  9920/9920                                            Not in use    0 of inf
     InAuth:  9920-auth/9920
        Aor:  9920                                               1
      Contact:  9920/sip:9920@10.200.5.38:5060             625740274b Avail        10.667

The communication log file [failover] - VoIP calls not working.

The communication log file [promary] - VoIP calls working.

When capturing traffic on the interface that previously hosted the floating IP, can you see the above INVITE message coming in ?

INVITE messages are being delivered correctly — that is to the server that currently has the floating IP address assigned.

While troubleshooting and enabling pjsip set logger on, I found the source of the problem:

– Executing [s@macro-dial-one:27] GosubIf(“PJSIP/9910-00000004”, “1?dstring,1():dlocal,1()”) in new stack
– Executing [dstring@macro-dial-one:1] Set(“PJSIP/9910-00000004”, “DSTRING=”) in new stack
– Executing [s@macro-dial-one:63] NoOp(“PJSIP/9910-00000004”, “Returned from dial-one with nothing to call and DIALSTATUS: NOANSWER”).

Digging deeper, after running the command database show AMPUSER/9910/device, I see:

0 results found

On the failover server, there’s an inconsistency between the astdb.sqlite3 files — the one on the primary server is larger in size. It’s clear that the database is missing the necessary entries.

When I copied the astdb.sqlite3 file from the primary server to the failover server, the calls started working. However, I think that copying or synchronizing this file is not the best idea. I have the impression that this file should be rebuilt during the startup of Asterisk and FreePBX.

Any ideas?