def set_context_outcall(context, entity): Session.add( Context(name='to-extern', displayname=context['display_name'], entity=entity, contexttype='outcall', description=''))
def set_context_switchboard(entity): Session.add( Context(name='__switchboard_directory', displayname='Switchboard', entity=entity, contexttype='others', description=''))
def associate_sccp_device(line, device): device_name = "SEP" + device.mac.replace(":", "").upper() sccpdevice = (Session.query(SCCPDevice).filter( SCCPDevice.device == device_name).first()) if sccpdevice: sccpdevice.line = line.name else: Session.add( SCCPDevice(name=device_name, device=device_name, line=line.name)) Session.flush()
def set_resolvconf(hostname, domain, nameservers): row = Session.query(Resolvconf).first() row.hostname = hostname row.domain = domain row.search = domain row.description = 'Wizard Configuration' row.nameserver1 = nameservers[0] if len(nameservers) > 1: row.nameserver2 = nameservers[1] if len(nameservers) > 2: row.nameserver3 = nameservers[2] Session.add(row)
def set_context_internal(context, entity): Session.add( Context(name='default', displayname=context['display_name'], entity=entity, contexttype='internal', description='')) Session.add( ContextNumbers(context='default', type='user', numberbeg=context['number_start'], numberend=context['number_end']))
def set_netiface(interface, address, netmask, gateway): Session.add( Netiface(ifname=interface, hwtypeid=1, networktype='voip', type='iface', family='inet', method='static', address=address, netmask=netmask, broadcast='', gateway=gateway, mtu=1500, options='', description='Wizard Configuration'))
def set_context_incall(context, entity): Session.add( Context(name='from-extern', displayname=context['display_name'], entity=entity, contexttype='incall', description='')) if context.get('number_start') and context.get('number_end'): Session.add( ContextNumbers(context='from-extern', type='incall', numberbeg=context['number_start'], numberend=context['number_end'], didlength=context['did_length']))
def set_language(language): row = Session.query(StaticSIP).filter( StaticSIP.var_name == 'language').first() row.var_val = language Session.add(row) row = Session.query(StaticIAX).filter( StaticIAX.var_name == 'language').first() row.var_val = language Session.add(row) row = (Session.query(SCCPGeneralSettings).filter( SCCPGeneralSettings.option_name == 'language').first()) row.option_value = language Session.add(row)
def set_xivo_configured(): row = Session.query(General).first() row.configured = True Session.add(row)
def set_timezone(timezone): row = Session.query(General).first() row.timezone = timezone Session.add(row)
def set_default_entity(display_name, name): row = Entity(displayname=display_name, name=name, description='Wizard Entity') Session.add(row)
def set_autoprov_name(autoprov_username): Session.add( StaticSIP(category='general', filename='sip.conf', var_name='autocreate_prefix', var_val=autoprov_username))
def set_admin_password(password): row = Session.query(User).filter(User.login == 'root').first() row.passwd = password Session.add(row)
def include_outcall_context_in_internal_context(): Session.add( ContextInclude(context='default', include='to-extern', priority=0))
def update(provisioning_networking): Session.add(provisioning_networking) Session.flush()