Changeset 3572

Show
Ignore:
Timestamp:
01/17/07 03:38:08 (6 years ago)
Author:
gregmac
Message:

Fix engine_getinfo() to do better checking for astman connection (see r3571), added fallback to using exec('asterisk -V')

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r3567 r3572  
    181181  switch ($amp_conf['AMPENGINE']) { 
    182182    case 'asterisk': 
    183       if ($astman) { 
     183      if (isset($astman) && $astman->connected()) { 
    184184        //get version 
    185185        $response = $astman->send_request('Command', array('Command'=>'show version')); 
    186186        $verinfo = $response['data']; 
    187187      } else { 
    188         // could not connect to asterisk manager 
    189         return array('engine'=>'ERROR-UNABLE-TO-CONNECT', 'version'=>'0', 'additional' => '0'); 
     188        // could not connect to asterisk manager, try console 
     189        $verinfo = exec('asterisk -V'); 
    190190      } 
    191191       
     
    196196        return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[4]); 
    197197      } 
     198 
     199      return array('engine'=>'ERROR-UNABLE-TO-CONNECT', 'version'=>'0', 'additional' => '0'); 
    198200    break; 
    199201  }