Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save benasse/a60c6a0532a967c89828f54db035924f to your computer and use it in GitHub Desktop.

Select an option

Save benasse/a60c6a0532a967c89828f54db035924f to your computer and use it in GitHub Desktop.
Generate wazo conference rooms
#!/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