def create(self, **kw): ''' Add new group to DB ''' g = Group() g.group_name = kw['group_name'] g.display_name = kw['display_name'] DBSession.add(g) flash(u'Nouveau groupe "%s" créé' % (kw['group_name'])) redirect('/groups/')
def create(self, **kw): ''' Add new queue to DB ''' q = Queue() q.name = kw['name'] q.comment = kw['comment'] id = int(kw['music']) if id!=-1: q.music_id = id id = int(kw['announce']) if id!=-1: q.announce_id = id q.strategy = kw['strategy'] q.wrapuptime = int(kw['wrapuptime']) q.announce_frequency = int(kw['announce_frequency']) q.min_announce_frequency = int(kw['min_announce_frequency']) q.announce_holdtime = 1 if kw['announce_holdtime']=='yes' else 0 q.announce_position = 1 if kw['announce_position']=='yes' else 0 q.priority = int(kw['priority']) q.monitor = True if kw['monitor']=='1' else False q.connectdelay = int(kw['connectdelay']) q.connecturl = kw['connecturl'] q.hangupurl = kw['hangupurl'] q.timeout = kw['timeout'] DBSession.add(q) # Create new group for supervisors g = Group() g.group_name = u'SV %s' % q.name g.display_name = u'Superviseurs groupe d\'appels %s' % q.name DBSession.add(g) # Create new group for members g = Group() g.group_name = u'AG %s' % q.name g.display_name = u'Agents groupe d\'appels %s' % q.name DBSession.add(g) # Create Asterisk queue asterisk_update_queue(q) # Add to list of queues Globals.asterisk.queues[q.name] = {} Globals.manager.send_action({'Action': 'QueueStatus'}) flash(u'Nouveau groupe d\'appel "%s" créé' % (kw['name'])) redirect('/queues/')