def checkVersion(self, verstr): """Checks if Asterisk version is higher than or equal to version identified by verstr. @param version: Version string. """ return self._asterisk_version >= util.SoftwareVersion(verstr)
def _initAsteriskVersion(self): """Query Asterisk Manager Interface for Asterisk Version to configure system for compatibility with multiple versions . CLI Command - core show version """ if self._ami_version > util.SoftwareVersion('1.0'): cmd = "core show version" else: cmd = "show version" cmdresp = self.executeCommand(cmd) mobj = re.match('Asterisk\s*(SVN-branch-|\s)(\d+(\.\d+)*)', cmdresp) if mobj: self._asterisk_version = util.SoftwareVersion(mobj.group(2)) else: raise Exception('Asterisk version cannot be determined.')
def checkVersion(self, verstr): """Checks if PostgreSQL Server version is higher than or equal to version identified by verstr. @param version: Version string. """ return self._version >= util.SoftwareVersion(verstr)
def _connect(self): """Establish connection to PostgreSQL Database.""" if self._connParams: self._conn = psycopg2.connect(**self._connParams) else: self._conn = psycopg2.connect('') try: ver_str = self._conn.get_parameter_status('server_version') except AttributeError: ver_str = self.getParam('server_version') self._version = util.SoftwareVersion(ver_str)
def _getGreeting(self): """Read and parse Asterisk Manager Interface Greeting to determine and set Manager Interface version. """ greeting = self._conn.read_until("\r\n", connTimeout) mobj = re.match('Asterisk Call Manager\/([\d\.]+)\s*$', greeting) if mobj: self._ami_version = util.SoftwareVersion(mobj.group(1)) else: raise Exception("Asterisk Manager Interface version cannot be determined.")