What would make Dashboard Asterisk in Error state?

freePBX 2.8.1.4
asterisk 1.8.3.1

This is a recent upgrade of freePBX [from an inherited Trixbox …which may explain everything!]

The system is running from what I can tell normally [i.e. I can make/receive calls etc] but the Dashboard is showing Asterisk Server status as “ERROR” in that scary red.

Usually I see this happen when I have changes passwords for the AMI or something [which will then usually make certain navigation links like to “Extensions” greyed out and inaccessible] but that is not the case here. freePBX is working fine with one other exception:

http://www.freepbx.org/forum/freepbx/users/wrongs-values-like-301value-301-in-cid-num-alias-field-of-extensions-module-v2-8#comment-36086

I am getting these odd values show up in the CID Alias and the Language fields in the extensions form.

Is there somewhere in the MySQL database I can look to see what underlies these issues? I could then compare that the the original TB database to see if something was lost in translation.

Usually it’s the AMI connection as you indicated.

The code that does this is as follows:

[php]

<?php if ($astver = $astinfo->check_asterisk()) { $out .= draw_status_box(_("Asterisk"), "ok", sprintf(_('Asterisk is running: %s'),$astver)); } else { $out .= draw_status_box(_("Asterisk"), "error", _('Asterisk is not running, this is a critical service!')); } [/php] and the call to $astinfo->check_asterisk() is simply: [php] <?php function check_asterisk() { if (!$this->astman) { return false; } if (version_compare($this->version, "1.6", "ge")) { $response = $this->astman->send_request('Command',array('Command'=>"core show version")); } else { $response = $this->astman->send_request('Command',array('Command'=>"show version")); } $astout = explode("\n",$response['data']); if (!preg_match('/^Asterisk /i', $astout[1])) { return false; } else { return $astout[1]; } } [/php] so one guess is your version information is not being interpreted correctly and you are getting the wrong syntax sent to the AMI, though this is easy enough to throw in some debug statements and check what's up. The version information gets pulled form the standard FreePBX engine_getinfo();

Thanks Philippe.

I stuck in some debug statements and $this->version shows up correctly as 1.8.3.1

Somehow something breakdown from there.

If I run “core show version” from the CLI it gives me the usual “Asterisk 1.8.3.1 built by…” However, the response inside the program I get
Privilege: Command
Response: Follows
Privilege: Command
Asterisk 1.8.3.1 …
Asterisk 1.8.3.1 …

So the test where you are looking preg_match(’/^Asterisk /i’, $astout[1]) is never finding the owrd Asterisk. It changed the test to use $astout[3] and now all is well.

That said, if this is common response, the test should probably be looping through all the lines of response rather than counting on it being in the second line only?

BTW Philippe, did you have insight into the other problem on this system:

http://www.freepbx.org/forum/freepbx/users/wrongs-values-like-301value-301-in-cid-num-alias-field-of-extensions-module-v2-8#comment-36086

I am really scratching my head as to how this actually happens.

just checked that the AMI “double response” is an asterisk bug which has just been corrected in 1.8.3.2

nope have not looked at that thread listed above.

Hi Guys,

I seem to have the same Asterisk error status on the Dasboard witch i did not notice before but checked sinds Mudslide567 also point out to have the extension edit problem that he referse to.

So i checked with some other systems for the AMI respone and i get the response below, it seems that the whole AMI response has changed sinds 1.8.3 witch now includes a response header.

Array ( 
[0] => Privilege: Command 
[1] => Asterisk 1.8.3 built by root on a i686 running Linux on 2011-03-03 17:03:02 UTC 
[2] => ) 
Array ( 
[0] => Privilege: Command 
[1] => Response: Follows 
[2] => Privilege: Command 
[3] => Asterisk 1.8.3.1 built by root on a i686 running Linux on 2011-03-18 08:57:21 UTC 
[4] => Asterisk 1.8.3.1 built by root on a i686 running Linux on 2011-03-18 08:57:21 UTC 
[5] => ) 

So as mudslide567 points out, the line :

preg_match('/^Asterisk /i', $astout[1])

Sould be changed sinds this version.

Regards,
Richard

Make sure you load the latest stable (1.8.3.2).

There was an issue a few weeks ago, I believe when 1.8.3 just came out, that broke a bunch of systems but was quickly fixed by the Asterisk team.

I believe this is the issue that you may be encountering. APIs like the AMI are not suppose to change within a major release and they usually try to keep them consistent across major releases also, though don’t always.