Forked from pc-m/gist:080b7baaa12ea97f795422d5ef4d18c7
Created
September 17, 2020 13:32
-
-
Save benasse/a60c6a0532a967c89828f54db035924f to your computer and use it in GitHub Desktop.
Generate wazo conference rooms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import os | |
| import sys | |
| from wazo_confd_client import Client | |
| TOKEN = os.getenv('TOKEN') | |
| c = Client('localhost', verify_certificate=False, token=TOKEN) | |
| conferences = [] | |
| with open('conferences', 'r') as f: | |
| for line in f: | |
| id, meetmeid, pin, name, number, context, tenant_uuid = line.split(' ') | |
| conferences.append({ | |
| 'id': id, | |
| 'meetme_id': meetmeid, | |
| 'name': name, | |
| 'pin': pin, | |
| 'number': number, | |
| 'context': context, | |
| 'tenant_uuid': tenant_uuid.strip(), | |
| }) | |
| from pprint import pprint | |
| pprint(conferences) | |
| for conf in conferences: | |
| extension = c.extensions.create({'exten': conf['number'], 'context': conf['context']}, tenant_uuid=conf['tenant_uuid']) | |
| body = {'name': conf['name']} | |
| if conf['pin']: | |
| body['pin'] = conf['pin'] | |
| conference = c.conferences.create(body, tenant_uuid=conf['tenant_uuid']) | |
| c.conferences(conference).add_extension(extension) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment