def _generate_guest_line(self, output): print >> output, format_ast_section_using_tpl(_GUEST_LINE_NAME, self._TPL_NAME) print >> output, format_ast_option('type', 'line') print >> output, format_ast_option('context', 'xivo-initconfig') print >> output, format_ast_option('cid_name', 'Autoprov') print >> output, format_ast_option('cid_num', 'autoprov') print >> output
def generate(self, sccpspeeddial, output): for item in sccpspeeddial: print >> output, format_ast_section( '%d-%d' % (item['user_id'], item['fknum'])) print >> output, format_ast_option('type', 'speeddial') print >> output, format_ast_option('extension', item['exten']) if item['label']: print >> output, format_ast_option('label', item['label']) print >> output, format_ast_option('blf', item['supervision']) print >> output
def _generate_devices(self, sccpdevice, output): for item in sccpdevice: print >> output, format_ast_section_using_tpl( item['name'], self._TPL_NAME) print >> output, format_ast_option('type', 'device') if item['line']: print >> output, format_ast_option('line', item['line']) if item['voicemail']: print >> output, format_ast_option('voicemail', item['voicemail']) self._generate_speeddials(output, item['device']) print >> output
def _generate_template(self, line_items, output): print >> output, format_ast_section_tpl(self._TPL_NAME) for item in line_items: option_name = item['option_name'] option_value = item['option_value'] if option_name == 'allow': if not option_value: continue print >> output, format_ast_option('disallow', 'all') elif option_name == 'disallow': continue elif option_name == 'directmedia': option_value = '0' if option_value == 'no' else '1' print >> output, format_ast_option(option_name, option_value) print >> output
def _gen_general_section(self, output): print >> output, u'[general]' for item in self._voicemail_settings: if item['category'] == u'general': opt_name = item['var_name'] if opt_name == u'emailbody': opt_val = self._format_emailbody(item['var_val']) else: opt_val = item['var_val'] print >> output, format_ast_option(opt_name, opt_val)
def _generate_template(self, device_items, output): print >> output, format_ast_section_tpl(self._TPL_NAME) for item in device_items: print >> output, format_ast_option(item['option_name'], item['option_value']) print >> output
def generate(self, general_items, output): print >> output, u'[general]' for item in general_items: print >> output, format_ast_option(item['option_name'], item['option_value']) print >> output
def _generate_lines(self, sccplines, output): for item in sccplines: print >> output, format_ast_section_using_tpl( item['name'], self._TPL_NAME) print >> output, format_ast_option('type', 'line') print >> output, format_ast_option('cid_name', item['cid_name']) print >> output, format_ast_option('cid_num', item['cid_num']) print >> output, format_ast_option( 'setvar', u'XIVO_ORIGINAL_CALLER_ID="{cid_name}" <{cid_num}>'.format( **item)) print >> output, format_ast_option( 'setvar', 'XIVO_USERID=%s' % item['user_id']) print >> output, format_ast_option( 'setvar', 'XIVO_USERUUID=%s' % item['uuid']) print >> output, format_ast_option( 'setvar', 'WAZO_TENANT_UUID=%s' % item['tenant_uuid']) print >> output, format_ast_option( 'setvar', 'PICKUPMARK=%(number)s%%%(context)s' % item) print >> output, format_ast_option( 'setvar', 'TRANSFER_CONTEXT=%s' % item['context']) print >> output, format_ast_option( 'setvar', 'WAZO_CHANNEL_DIRECTION=from-wazo') print >> output, format_ast_option('setvar', 'WAZO_LINE_ID=%s' % item['id']) if item['enable_online_recording']: print >> output, format_ast_option( 'setvar', 'DYNAMIC_FEATURES=togglerecord') if item['language']: print >> output, format_ast_option('language', item['language']) print >> output, format_ast_option('context', item['context']) if 'disallow' in item: print >> output, format_ast_option('disallow', item['disallow']) if 'allow' in item: print >> output, format_ast_option('allow', item['allow']) if 'callgroup' in item: print >> output, format_ast_option( 'namedcallgroup', ','.join(str(i) for i in item['callgroup'])) if 'pickupgroup' in item: print >> output, format_ast_option( 'namedpickupgroup', ','.join(str(i) for i in item['pickupgroup'])) print >> output
def _generate_speeddials(self, output, device): for item in self._sccpspeeddialdevices: if item['device'] == device: print >> output, format_ast_option( 'speeddial', '%d-%d' % (item['user_id'], item['fknum']))
def _generate_guest_device(self, output): print >> output, format_ast_section_using_tpl(_GUEST_DEVICE_NAME, self._TPL_NAME) print >> output, format_ast_option('type', 'device') print >> output, format_ast_option('line', _GUEST_LINE_NAME) print >> output
def _gen_zonemessages_section(self, output): print >> output, u'[zonemessages]' for item in self._voicemail_settings: if item['category'] == u'zonemessages': print >> output, format_ast_option(item['var_name'], item['var_val'])