示例#1
0
def doivrregister():
    lang = session['lang']
    msgs = ivrtext.get(lang)
    resp = twilio.twiml.Response()
    with resp.gather(numDigits=1, action="/register-gender", method="POST", timeout=5) as g:
        g.say(msgs.get('askGender'), voice=twilio.twiml.Say.WOMAN, language=lang)
    resp.say(msgs.get('sorry'), language=lang)
    return str(resp)
示例#2
0
def registerStart():
    lang = session['lang']
    msgs = ivrtext.get(lang)
    
    session_obj = {"gender": session['gender'], "country": session['country_choice'], "name_url":session['name_url'], "tribe_url": session['tribe_url'], "memo_url":session['memo_url']}
    logging.info(session_obj)
    resp = twilio.twiml.Response()
    resp.say(msgs.get('thanks'), language=lang,  voice=twilio.twiml.Say.WOMAN)
    return str(resp)
示例#3
0
def registerGender():
    gender = request.values.get('Digits', None)
    logging.log(logging.INFO, "Gender choice: " + str(gender))
    session['gender'] = str(gender)
    lang = session['lang']
    msgs = ivrtext.get(lang)

    resp = twilio.twiml.Response()
    resp.say(msgs.get('askName').format('your'), voice=twilio.twiml.Say.WOMAN, language=lang)
    resp.record(maxLength="10", action="/register-name")
    return str(resp)
示例#4
0
def registerMemo():
    memo_url = request.values.get('RecordingUrl', None)
    logging.log(logging.INFO, "Memo recording: " + str(memo_url))
    session['memo_url'] = memo_url
    
    lang = session['lang']
    msgs = ivrtext.get(lang)
    
    resp = twilio.twiml.Response()
    resp.say(msgs.get('pleaseWaitRegistering'), voice=twilio.twiml.Say.WOMAN, language=lang)
    resp.redirect("/register-start")
    return str(resp)
示例#5
0
def registerTribe():
    tribe_url = request.values.get('RecordingUrl', None)
    logging.log(logging.INFO, "Tribe name recording: " + str(tribe_url))
    session['tribe_url'] = tribe_url
    
    lang = session['lang']
    msgs = ivrtext.get(lang)
    
    resp = twilio.twiml.Response()
    resp.say(msgs.get('askMemo'), voice=twilio.twiml.Say.WOMAN, language=lang)
    resp.record(maxLength="10", action="/register-memo")
    return str(resp)
示例#6
0
def registerCountry():
    country_choice = request.values.get('Digits', None)
    logging.log(logging.INFO, "Country choice: " + str(country_choice))
    session['country_choice'] = country_choice

    lang = session['lang']
    msgs = ivrtext.get(lang)
    
    resp = twilio.twiml.Response()
    resp.say(msgs.get('askTribe').format('your'), voice=twilio.twiml.Say.WOMAN, language=lang)
    resp.record(maxLength="10", action="/register-tribe")
    return str(resp)
示例#7
0
def registerTribe():
    tribe_url = request.values.get('RecordingUrl', None)
    logging.log(logging.INFO, "Tribe name recording: " + str(tribe_url))
    session['tribe_url'] = tribe_url

    lang = session['lang']
    msgs = ivrtext.get(lang)

    resp = twilio.twiml.Response()
    resp.say(msgs.get('askMemo'), voice=twilio.twiml.Say.WOMAN, language=lang)
    resp.record(maxLength="10", action="/register-memo")
    return str(resp)
示例#8
0
def searchCountry():
    country_choice = request.values.get('Digits', None)
    logging.log(logging.INFO, "Country choice: " + str(country_choice))
    session['country_choice'] = country_choice
    
    lang = session['lang']
    msgs = ivrtext.get(lang)
    
    resp = twilio.twiml.Response()
    resp.say(msgs.get('pleaseWaitSearching'), voice=twilio.twiml.Say.WOMAN, language=lang)
    resp.redirect("/search-start")
    return str(resp)
示例#9
0
def registerName():
    name_url = request.values.get('RecordingUrl', None)
    logging.log(logging.INFO, "Name recording: " + str(name_url))
    session['name_url'] = name_url
    
    lang = session['lang']
    msgs = ivrtext.get(lang)
    
    resp = twilio.twiml.Response()
    with resp.gather(numDigits=1, action="/register-country", method="POST", timeout=5) as g:
        g.say(msgs.get('askCountry').format('your'), voice=twilio.twiml.Say.WOMAN, language=lang)
    resp.say(msgs.get('sorry'), language=lang)
    return str(resp)
示例#10
0
def doivrregister():
    lang = session['lang']
    msgs = ivrtext.get(lang)
    resp = twilio.twiml.Response()
    with resp.gather(numDigits=1,
                     action="/register-gender",
                     method="POST",
                     timeout=5) as g:
        g.say(msgs.get('askGender'),
              voice=twilio.twiml.Say.WOMAN,
              language=lang)
    resp.say(msgs.get('sorry'), language=lang)
    return str(resp)
示例#11
0
def registerGender():
    gender = request.values.get('Digits', None)
    logging.log(logging.INFO, "Gender choice: " + str(gender))
    session['gender'] = str(gender)
    lang = session['lang']
    msgs = ivrtext.get(lang)

    resp = twilio.twiml.Response()
    resp.say(msgs.get('askName').format('your'),
             voice=twilio.twiml.Say.WOMAN,
             language=lang)
    resp.record(maxLength="10", action="/register-name")
    return str(resp)
示例#12
0
def registerMemo():
    memo_url = request.values.get('RecordingUrl', None)
    logging.log(logging.INFO, "Memo recording: " + str(memo_url))
    session['memo_url'] = memo_url

    lang = session['lang']
    msgs = ivrtext.get(lang)

    resp = twilio.twiml.Response()
    resp.say(msgs.get('pleaseWaitRegistering'),
             voice=twilio.twiml.Say.WOMAN,
             language=lang)
    resp.redirect("/register-start")
    return str(resp)
示例#13
0
def registerCountry():
    country_choice = request.values.get('Digits', None)
    logging.log(logging.INFO, "Country choice: " + str(country_choice))
    session['country_choice'] = country_choice

    lang = session['lang']
    msgs = ivrtext.get(lang)

    resp = twilio.twiml.Response()
    resp.say(msgs.get('askTribe').format('your'),
             voice=twilio.twiml.Say.WOMAN,
             language=lang)
    resp.record(maxLength="10", action="/register-tribe")
    return str(resp)
示例#14
0
def registerStart():
    lang = session['lang']
    msgs = ivrtext.get(lang)

    session_obj = {
        "gender": session['gender'],
        "country": session['country_choice'],
        "name_url": session['name_url'],
        "tribe_url": session['tribe_url'],
        "memo_url": session['memo_url']
    }
    logging.info(session_obj)
    resp = twilio.twiml.Response()
    resp.say(msgs.get('thanks'), language=lang, voice=twilio.twiml.Say.WOMAN)
    return str(resp)
示例#15
0
def registerName():
    name_url = request.values.get('RecordingUrl', None)
    logging.log(logging.INFO, "Name recording: " + str(name_url))
    session['name_url'] = name_url

    lang = session['lang']
    msgs = ivrtext.get(lang)

    resp = twilio.twiml.Response()
    with resp.gather(numDigits=1,
                     action="/register-country",
                     method="POST",
                     timeout=5) as g:
        g.say(msgs.get('askCountry').format('your'),
              voice=twilio.twiml.Say.WOMAN,
              language=lang)
    resp.say(msgs.get('sorry'), language=lang)
    return str(resp)
示例#16
0
def lang():
    digit_pressed = request.values.get('Digits', None)
    logging.info("Language choice: " + str(digit_pressed))
    logging.info("Session[from_number]: " +
                 str(session.get('from_number', '0')))
    if digit_pressed == "2":
        lang = twilio.twiml.Say.FRENCH
    else:
        lang = twilio.twiml.Say.ENGLISH

    session['lang'] = lang

    msgs = ivrtext.get(lang)
    resp = twilio.twiml.Response()
    resp.say(msgs.get('welcome'), language=lang, voice=twilio.twiml.Say.WOMAN)
    with resp.gather(numDigits=1,
                     action="/handle-option",
                     method="POST",
                     timeout=5) as g:
        g.say(msgs.get('askRegisterOrSearch'),
              voice=twilio.twiml.Say.WOMAN,
              language=lang)
    resp.say(msgs.get('sorry'), language=lang)
    return str(resp)