updated switch version detection

will now work with both git and packaged version numbers
added bits to detect_switch
This commit is contained in:
Matthew Vale 2015-12-10 10:51:38 +00:00
parent daa0f9bb70
commit 45d9c2039d
2 changed files with 5 additions and 3 deletions

View File

@ -108,7 +108,7 @@ $document['title'] = $text['title-sys-status'];
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_version = event_socket_request($fp, 'api version');
preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(\s*(\d+\w+)\s*\)/", $switch_version, $matches);
preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(.*?(\d+\w+)\s*\)/", $switch_version, $matches);
$switch_version = $matches[1];
$switch_bits = $matches[2];
echo "<tr>\n";

View File

@ -40,10 +40,12 @@ require_once "resources/classes/EventSocket.php";
protected $_major;
protected $_minor;
protected $_build;
protected $_bits;
public function major() { return $this->_major; }
public function minor() { return $this->_minor; }
public function build() { return $this->_build; }
public function version() { return $this->_major.".".$this->_minor.".".$this->_build; }
public function bits() { return $this->_bits; }
public function version() { return $this->_major.".".$this->_minor.".".$this->_build." (".$this->_bits.")"; }
// dirs - detected by from the switch
protected $_base_dir = '';
@ -126,7 +128,7 @@ require_once "resources/classes/EventSocket.php";
throw new Exception('Failed to use event socket');
}
$FS_Version = $this->event_socket_request('api version');
preg_match("/FreeSWITCH Version (\d+)\.(\d+)\.(\d+(?:\.\d+)?)/", $FS_Version, $matches);
preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(.*?(\d+\w+)\s*\)/", $FS_Version, $matches);
$this->_major = $matches[1];
$this->_minor = $matches[2];
$this->_build = $matches[3];