if self.REGISTRAR_BACKUP and self.REGISTRAR_BACKUP == self.PROXY_BACKUP: register = 1 else: register = 0 lines.append('reg.1.server.2.register="%s"' % register) backup_pbx = '\n'.join(lines) else: backup_pbx = '' txt = xivo_config.txtsubst( template_lines, PhoneVendorMixin.set_provisioning_variables( provinfo, { 'user_vmail_addr': self.xml_escape(provinfo['vmailaddr']), 'function_keys': fkeys_config_lines, 'language': language, 'timezone': timezone, 'backup_pbx': backup_pbx, }, self.xml_escape, clean_extension), cfg_filename, 'utf8') if dry_run: return ''.join(txt) else: self._write_cfg(tmp_filename, cfg_filename, txt) @classmethod def __format_function_keys(cls, funckey, model): max_fkey_no_map = {
errno, errstr, template_common_path) template_file = open(template_common_path) template_lines = template_file.readlines() tmp_filename = os.path.join(self.SIEMENS_COMMON_DIR, "%s.tmp" % phone_file) cfg_filename = tmp_filename[:-4] provinfo['subscribemwi'] = str(int(bool(int(provinfo.get('subscribemwi', 0))))) txt = xivo_config.txtsubst( template_lines, PhoneVendorMixin.set_provisioning_variables( provinfo, { 'config_sha1sum': provinfo['sha1sum'], }, format_extension=clean_extension), cfg_filename, 'utf8') self._write_cfg(tmp_filename, cfg_filename, txt) def __get_config_sha1sum(self): "Get sha1sum value from configuration." rcp = Siemens.get_config(self.SIEMENS_COMMON_DIR, self.phone['model'], self.phone['macaddr']) if rcp.has_option('miscellaneous', 'config_sha1sum'): sha1sum = rcp.get('miscellaneous', 'config_sha1sum') else: sha1sum = '1'