def leave_conference(conf_number, callerid): if not asterisk_is_authenticated(): return 'NOTAUTH' message = gettext('Number %(num)s has left the conference.', num=callerid) conference = Conference.query.filter_by(number=conf_number).first_or_404() conference.log(message) sse_notify(conference.id, 'update_participants') return 'OK'
def unmute_request(conf_number, callerid): if not asterisk_is_authenticated(): return 'NOTAUTH' message = gettext('Unmute request from number %(num)s.', num=callerid) conference = Conference.query.filter_by(number=conf_number).first_or_404() conference.log(message) sse_notify(conference.id, 'unmute_request', callerid) return 'OK'
def enter_conference(conf_number, callerid): if not asterisk_is_authenticated(): return 'NOTAUTH' message = gettext('Number %(num)s has entered the conference.', num=callerid) conference = Conference.query.filter_by(number=conf_number).first_or_404() conference.log(message) sse_notify(conference.id, 'update_participants') return 'OK'
def unlock(self, conf_id): conf = Conference.query.get_or_404(conf_id) confbridge_unlock(conf.number) msg = gettext('The conference has been unlocked.') flash(msg) conf.log(msg) sse_notify(conf.id, 'update_participants') time.sleep(1) return redirect(url_for('.details_view', id=conf_id))
def leave_conference(conf_number, callerid): if not asterisk_is_authenticated(): return 'NOTAUTH' message = gettext('Number %(num)s has left the conference.', num=callerid) conference = Conference.query.filter_by(number=conf_number).first_or_404() conference.log(message) sse_notify(conference.id, 'update_participants') for num in talkers: if ( num == callerid ): talkers.remove(callerid) return 'OK'
def kick(self, conf_id, channel=None): conf = Conference.query.filter_by(id=conf_id).first_or_404() if channel: confbridge_kick(conf.number, channel) msg = gettext('Channel %(channel)s is kicked.', channel=channel) flash(msg) conf.log(msg) else: confbridge_kick_all(conf.number) msg = gettext('All participants have been kicked from the conference.') conf.log(msg) flash(msg) sse_notify(conf.id, 'update_participants') time.sleep(1) return redirect(url_for('.details_view', id=conf.id))
def unmute(self, conf_id, channel=None): conf = Conference.query.get_or_404(conf_id) if channel: confbridge_unmute(conf.number, channel) msg = gettext('Participant %(channel)s unmuted.', channel=channel) flash(msg) conf.log(msg) else: # Mute all for p in confbridge_list_participants(conf.number): confbridge_unmute(conf.number, p['channel']) msg = gettext('Conference unmuted.') flash(msg) conf.log(msg) sse_notify(conf.id, 'update_participants') time.sleep(1) return redirect(url_for('.details_view', id=conf_id))
def update_talkers_off(conf_number,callerid): message = gettext('Number %(num)s is shut up.', num=callerid) conference = Conference.query.filter_by(number=conf_number).first_or_404() conference.log(message) sse_notify(conference.id, 'update_participants') return 'OK'
def log(self, message): post = ConferenceLog(conference=self, message=message) db.session.add(post) db.session.commit() sse_notify(self.id, 'log_message', message)