Exemplo n.º 1
0
class Request(object):
    request_schema = Schema({
        "janus": StrRe(r"^\S+$"),
        "transaction": StrRe(r"^\S+$"),
        Optional("session_id"): IntVal(),
        Optional("handle_id"): IntVal(),
        Optional("apisecret"): StrVal(),
        DoNotCare(str): object  # for all other key we don't care
    })

    def __init__(self, transport_session, message):
        message = self.request_schema.validate(message)
        self.transport = transport_session
        self.message = message
        self.janus = message['janus']
        self.transaction = message['transaction']
        self.session_id = message.get('session_id', 0)
        self.handle_id = message.get('handle_id', 0)
        self.apisecret = message.get('apisecret', '')
Exemplo n.º 2
0
    def read_config(config_file):

        p2pcall_config_schema = Schema({
            Optional("general"): Default({
                Optional("user_db"): Default(StrVal(), default='memory'),
                AutoDel(str): object  # for all other key we don't care
            }, default={}),
            DoNotCare(str): object  # for all other key we don't care

        })
        #print('config file:', config_file)
        if config_file is None or config_file == '':
            config = p2pcall_config_schema.validate({})
        else:
            log.info('P2Pcall plugin loads the config file: {}'.format(os.path.abspath(config_file)))
            config = parse_config(config_file, p2pcall_config_schema)

        # check other configure option is valid or not

        return config
Exemplo n.º 3
0
    def read_config(config_file):

        videocall_config_schema = Schema({
            Optional("general"):
            Default(
                {
                    Optional("user_db"): Default(StrVal(), default='memory'),
                    AutoDel(str): object  # for all other key we don't care
                },
                default={}),
            DoNotCare(str):
            object  # for all other key we don't care
        })
        #print('config file:', config_file)
        if config_file is None or config_file == '':
            config = videocall_config_schema.validate({})
        else:
            config = parse_config(config_file, videocall_config_schema)

        # check other configure option is valid or not

        return config
Exemplo n.º 4
0
        {
            Optional("json"):
            Default(EnumVal(['indented', 'plain', 'compact']),
                    default='indented'),
            Optional("http_listen"):
            Default(StrRe('^\S+:\d+$'), default='0.0.0.0:8200'),
            AutoDel(str):
            object  # for all other key we don't care
        },
        default={}),
    Optional("posters"):
    Default(
        [{
            "post_type": StrVal(min_len=1, max_len=64),
            "name": StrVal(min_len=0, max_len=64),
            DoNotCare(str): object  # for all other key we don't care
        }],
        default=[]),
})
http_poster_schema = Schema({
    "post_type":
    StrVal(min_len=1, max_len=64),
    "name":
    StrVal(min_len=0, max_len=64),
    "post_urls": [StrRe(r'(http|https)://')],
    Optional("expire"):
    Default(IntVal(min=1, max=3600), default=60),
    Optional("http_timeout"):
    Default(IntVal(min=1, max=3600), default=10),
    AutoDel(str):
    object  # for all other key, remove