コード例 #1
0
ファイル: app.py プロジェクト: T-G-P/Prank-Roulette
def voice():
    number1 = request.values.get('PhoneNumber1', None)
    number2 = request.values.get('PhoneNumber2', None)
    state = int(request.values.get('State', None))
    #cid = request.values.get('state', None)
    resp = twilio.twiml.Response()

    global error
    global room
    if room > 100000:
        room = 0

#'[0-9]{10}'
    room += 1
    numbers = []
    theNums = [number1, number2]

    for num in theNums:
        if num is not None and re.search('^[\d\(\)\- \+]+$', num):
            numbers.append(num)
    if len(numbers) < 2:
        return error

    for num in numbers:
        print num

    # Nest <Client> TwiML inside of a <Dial> verb
    with resp.dial(callerId=caller_id[0]) as r:
        r.conference('pr' + str(room))

    sid = twrapper.setUpCall(state, numbers, 'pr' + str(room))

    if sid == -1:
        return "llderp"
    return str(resp)
コード例 #2
0
ファイル: app.py プロジェクト: zamzam2121/Prank-Roulette
def voice():
    number1 = request.values.get('PhoneNumber1', None)
    number2 = request.values.get('PhoneNumber2', None)
    state = int(request.values.get('State', 0))
    resp = twilio.twiml.Response()

    global error
    global room
    if room > 100000:
        room = 0

    room += 1
    numbers = []
    theNums = [number1, number2]

    for num in theNums:
        if num is not None and re.search('^[\d\(\)\- \+]+$', num):
            numbers.append(num)
    if len(numbers) < 2:
        return error

    # Nest <Client> TwiML inside of a <Dial> verb
    with resp.dial(callerId=caller_id[0]) as r:
        r.conference('pr' + str(room))

    sid = twrapper.setUpCall(state, numbers, 'pr' + str(room))

    if sid == -1:
        return "llderp"
    return str(resp)
コード例 #3
0
ファイル: app.py プロジェクト: benhgreen/Prank-Roulette
def prank():
    userNumber = request.form['userNumber']
    call1 = request.form['caller1']
    call2 = request.form['caller2']
    call3 = request.form['caller3']
    call4 = request.form['caller4']
    call5 = request.form['caller5']
    potentialCallers = [userNumber, call1, call2, call3, call4, call5]
    callers = []
    state = request.form['states']

    for caller in potentialCallers:
        if not caller == "":
            callers.append(str(caller))

    print callers
    twilio_wrapper.setUpCall(int(state), callers)
    return render_template('index.html')