Last active
February 24, 2021 17:39
-
-
Save pc-m/080b7baaa12ea97f795422d5ef4d18c7 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') | |
| TENANT_UUID = sys.argv[1] | |
| c = Client('localhost', verify_certificate=False, token=TOKEN) | |
| conferences = [] | |
| with open('conferences', 'r') as f: | |
| for line in f: | |
| if not line: | |
| continue | |
| id, meetmeid, pin, name, number, context = line.split(' ') | |
| conferences.append({ | |
| 'id': id, | |
| 'meetme_id': meetmeid, | |
| 'name': name, | |
| 'pin': pin, | |
| 'number': number, | |
| 'context': context.strip(), | |
| }) | |
| from pprint import pprint | |
| pprint(conferences) | |
| for conf in conferences: | |
| extension = c.extensions.create({'exten': conf['number'], 'context': conf['context']}, tenant_uuid=TENANT_UUID) | |
| body = {'name': conf['name']} | |
| if conf['pin']: | |
| body['pin'] = conf['pin'] | |
| conference = c.conferences.create(body, tenant_uuid=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