def repeat_dob(call_slot): aws_polly.text_to_voice("I am sorry can you repeat again", "Raveena") play_recording("output.wav", call_slot) try: text = recorder(call_slot) answer = response_checking.dob(text) except: answer = None print answer if answer == "1": verified_phone(call_slot) # aws_polly.text_to_voice("Sir.., please also confirm your mailing address with the pin code.","Raveena") # play_recording("output.wav",call_slot)# next_question(call_slot) # text = recorder(call_slot) # answer = response_checking.dob(text) elif answer == "2": verify_dob_year(call_slot) elif answer == "3": verify_dob_month(call_slot) else: aws_polly.text_to_voice( "I am sorry, i didn't get that. Please use your phone touch pad and enter your date of birth. For example, if your date of birth is 31st August 1986 then press 3... 1... 0... 8... 1... 9... 8... 6... ", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) # sorry_intent(call_slot) get_dob_dtmf(call_slot)
def listen_and_respond(): global current_call aws_polly.text_to_voice( "Good Evening... My name is Singularity.... and this is a verification call on behalf of HDFC Life for your Secure your life plan..., purchased from HDFC Bank recently. May I speak to... Ankur Jyoti please", "Raveena") # aws_polly.text_to_voice("Good Evening","Raveena") play_recording("output.wav", call_slot) # try: # text = recorder(call_slot) # print "#"*20 # print text # reply = response_checking.text_got(text) # print reply,"%"*20 # except: # reply = None text = recorder(call_slot) print text reply = response_checking.text_got(text) print reply print "11" * 10 if reply == "1": nextquestion(call_slot) elif reply == "2": end_the_call(call_slot) else: get_dtmf_answer(call_slot) current_call.hangup() current_call = None
def nextquestion(call_slot): aws_polly.text_to_voice( "Ankur jyoti, we are happy to welcome you to the HDFC Life family...Sir..., please note this call may be recorded for our internal quality and training purposes.,For security purpose, please confirm your Date of Birth", "Raveena") play_recording("output.wav", call_slot) # aws_polly.text_to_voice("Sir..., please note this call may be recorded for our internal quality and training purposes.,","Raveena") # play_recording("output.wav",call_slot) # aws_polly.text_to_voice("For security purpose, please confirm your Date of Birth","Raveena") # play_recording("output.wav",call_slot) try: text = recorder(call_slot) answer = response_checking.dob(text) except: answer = None print answer if answer == "1": verified_phone(call_slot) # aws_polly.text_to_voice("Sir.., please also confirm your mailing address with the pin code.","Raveena") # play_recording("output.wav",call_slot)# next_question(call_slot) # text = recorder(call_slot) # answer = response_checking.dob(text) elif answer == "2": verify_dob_year(call_slot) elif answer == "3": verify_dob_month(call_slot) else: repeat_dob(call_slot)
def saleguywillcallback(call_slot): aws_polly.text_to_voice( "One of our sale representative will call back to resolve your query , Thank you have a great day", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) global current_call current_call.hangup() resetAll()
def thankyouintent(call_slot): aws_polly.text_to_voice( "Sir, We take your agreements to the terms of the policy and verification is completed. Thank you for your valuable time. Have a great day", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) global current_call current_call.hangup() resetAll()
def verified_phone(call_slot): aws_polly.text_to_voice("Sir.., please also confirm your phone number.", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) try: text = recorder(call_slot) answer = response_checking.phonenumber(text) except: answer = None if answer == "1": verify_email(call_slot) else: get_dtmf_phone(call_slot)
def get_dtmf_phone(call_slot): global dt aws_polly.text_to_voice( "I am sorry, Please use your phone touch pad and enter your 10 digits phone number", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) while True: if len(dt) >= 10: break print dt phone = "".join(str(x) for x in dt) if phone == "9920482274": dt = [] verify_email(call_slot) else: unverified_phone(call_slot)
def end_the_call(call_slot): aws_polly.text_to_voice("What is the best time to speak to him", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) try: answer = recorder(call_slot) print answer except: aws_polly.text_to_voice( "I am sorry, i didn't get that Please repeat that", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) try: answer = recorder(call_slot) print answer except: saleguywillcallback(call_slot) play_recording("./voice/thanksyoucallbacklater.wav", call_slot)
def verified_everything(call_slot): aws_polly.text_to_voice( "The premium amount is INR 20,000 which you need to pay for 10 years. The next premium will be due after every 3 months from the policy issue date. We request you to pay the premium for the entire term. In absence of same fund value may impact due to charges applicable.", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) aws_polly.text_to_voice( "Sir, I would also like to inform you that life insurance is a stand alone product and is neither a fixed deposit nor loan nor is it linked to any other banking products. to confirm the policy say, I agree... else no", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) try: text = recorder(call_slot) answer = response_checking.agree(text) except: answer = None if answer == "1": thankyouintent(call_slot) elif answer == "2": saleguywillcallback(call_slot) else: get_dtmf_confirmation(call_slot)
def verify_dob_year(call_slot): aws_polly.text_to_voice( "I am sorry, i didn't get the year. Which year were you born in?", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) try: text = recorder(call_slot) answer = response_checking.take_dob_year(text) except: answer = None if answer == "1": verified_phone(call_slot) else: aws_polly.text_to_voice( "I am sorry, i didn't get that. Please use your phone touch pad and enter your date of birth. For example, if your date of birth is 31st August 1986 then press 3... 1... 0... 8... 1... 9... 8... 6... ", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) # sorry_intent(call_slot) get_dob_dtmf(call_slot)
def verify_dob_month(call_slot): aws_polly.text_to_voice( "I am sorry, i didn't get the month. Which month were you born in?", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) try: text = recorder(call_slot) answer = response_checking.take_dob_month(text) except: answer = None if answer == "1": verified_phone(call_slot) else: aws_polly.text_to_voice( "I am sorry, i didn't get that. Please use your phone touch pad and enter your birth month if you birth month is august then press 0.. 8..", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) # sorry_intent(call_slot) get_dob_month_dtmf(call_slot)
def get_dtmf_confirmation(call_slot): # def get_dtmf_answer(call_slot): global dt aws_polly.text_to_voice( "Please press 1 for yes and press 2 for no or to speak to a representative press 0", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) # print dt while True: if len(dt) >= 1: break print dt if dt[0] == "1": dt = [] thankyouintent(call_slot) elif dt[0] == "2": dt = [] saleguywillcallback(call_slot) elif dt[0] == "0": dt = [] transfer_to_agent()
def verify_email(call_slot): global verify if verify < 1: aws_polly.text_to_voice( "Sir.., please confirm your email address for example if your email address is [email protected], then say india. november. foxtort, oscar at gmail dot com.", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) try: text = recorder(call_slot) answer = response_checking.email(text) except: answer = None if answer == "1": verified_everything(call_slot) else: aws_polly.text_to_voice("I didn't get that , please try again", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) #verify_email(call_slot) try: text = recorder(call_slot) answer = response_checking.email(text) except: answer = None if answer == "1": verified_everything(call_slot) verify += 1 else: aws_polly.text_to_voice("I am sorry, I am unable to verify", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) saleguywillcallback(call_slot) else: aws_polly.text_to_voice("I am sorry, I am unable to verify", "Raveena") play_recording("output.wav", call_slot) # next_question(call_slot) saleguywillcallback(call_slot)