예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
    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
예제 #5
0
 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)
예제 #6
0
 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
예제 #7
0
 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
예제 #8
0
 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
예제 #9
0
 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']))
예제 #10
0
 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
예제 #11
0
 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'])