HAAst can't connect to Asterisk / AMI

Configuring synchronization, sensors, and optimizations
Post Reply
User avatar
CRM User
Posts: 139
Joined: Sun Nov 27, 2016 3:41 pm

HAAst can't connect to Asterisk / AMI

Post by CRM User » Sat Apr 28, 2018 3:35 am

My new HAAst installation keeps promoting and demoting because it doesn't think that Asterisk is running. I confirmed the Asterisk AMI is running:

Code: Select all

[root@pbx1texas:~] $ netstat -anp | grep 5038      
tcp        0      0 127.0.0.1:5038            0.0.0.0:*               LISTEN      31671/asterisk 
and I confirmed that the haast.conf file, in the [asterisk] section, is trying to connect to itself at the management IP address:

Code: Select all

[asterisk]  ;=================================================================
hostname = 192.168.1.44
and I confirmed that is the local IP address:

Code: Select all

[root@pbx1texas:~] $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.44  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 00:21:43:f2:28:ac  txqueuelen 1000  (Ethernet)
        RX packets 32396345  bytes 4993774309 (4.6 GiB)
        RX errors 0  dropped 24948  overruns 0  frame 0
        TX packets 37744901  bytes 21043799055 (19.5 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xd0020000-d0040000 


Why can HAAst not find or talk to Asterisk?
Account for questions transferred from CRM system
User avatar
Telium Support
Posts: 185
Joined: Sun Nov 27, 2016 3:27 pm

Re: HAAst can't connect to Asterisk / AMI

Post by Telium Support » Sat Apr 28, 2018 3:40 am

The answer can be found in your question above. Notice that the Asterisk server / AMI is listening on 127.0.0.1 ? That is a special address known as "localhost"

You have configured HAAst to try to find the Asterisk server at 192.168.1.44. Even though that is the address of your PBX (actually the IPv4 address on one interface of your PBX), it is not the same as localhost. Localhost is a different interface, and is special in that it cannot be accessed from the network side (only from the LOCAL HOST side).

So the AMI is listening on one interface, and HAAst is trying to connect to it on another, and that's the problem. I recommend you modify your haast.conf file to connect to asterisk at "localhost" (the default), or its IPv4 equivalent 127.0.0.1

You don't mention if you are using pure Asterisk or a configuration generator, but you could alternatively modify manager.conf to tell Asterisk to listen on a different IP/interface. This is not normally recommended - but since you modified the haast.conf away from defaults I assume you might have had a reason to do so.
Post Reply