def detailAnalytics(cid): r = kookoo.Response() g = r.append(kookoo.CollectDtmf(maxDigits=1)) g.append(kookoo.PlayText("Press 1 for this week")) g.append(kookoo.PlayText("Press 2 for this month")) g.append(kookoo.PlayText("Press 3 for this year")) return r
def handleNewCall(self, response): response.addPlayText("Welcome To Tribal Fusion HR Desk") response.addPlayText("Press 1 to record your audio resume") response.addPlayText("Press 2 to know your interview status") response.addPlayText("Press 3 to know about current opportunites") response.addPlayText("Press 4 to speak to HR") response.append(kookoo.CollectDtmf(termchar='#'))
def welcome(): r = kookoo.Response() r.addPlayText( "welcome to expense management system.") # change to app name g = r.append(kookoo.CollectDtmf(maxDigits=1)) g.append(kookoo.PlayText("Press 1 for adding an expense entry")) g.append(kookoo.PlayText("Press 2 for analysis")) g.append(kookoo.PlayText("Press 3 for transaction")) return r
def GET(self): from conf.app_settings import LOCALT_PATH,AUDIO_FILE web.header('Content-Type', 'text/xml') input= web.input() APP_LOGGER.debug("KOOKOO CALLED ME:"+json.dumps(input)) # Dump.objects.get_or_create(type="INPUT",data=json.dumps(input)) if input.has_key('event'): if input['event']=='NewCall': SID[input['sid']]=input['cid'] Dump.objects.get_or_create(type='NEW CALL',data=json.dumps(input)) r = kookoo.Response() g = r.append(kookoo.CollectDtmf(maxDigits=1)) g.append(kookoo.PlayAudio(LOCALT_PATH+'/static/'+AUDIO_FILE)) return r if input['event']=='GotDTMF': digit=input['data'] if digit=='1': Dump.objects.create(type='INTERESTED',data=SID[input['sid']]) r = kookoo.Response() r.addPlayText('Thank you, we will call you back in 5 minutes') r.addHangup() return r if digit=='2': Dump.objects.create(type='CALL BACK',data=SID[input['sid']]) r = kookoo.Response() r.addPlayText('Thank You') r.addHangup() return r if digit=='3': Dump.objects.create(type='NOT INTERESTED',data=SID[input['sid']]) r = kookoo.Response() r.addPlayText('Thank You') r.addHangup() return r if digit=='4': Dump.objects.get_or_create(type='REPLAYED',data=SID[input['sid']]) r = kookoo.Response() g = r.append(kookoo.CollectDtmf(maxDigits=1)) g.append(kookoo.PlayAudio(LOCALT_PATH+'/static/'+AUDIO_FILE)) return r else: return '<response>invalid call</response>'
def addEntry(): r = kookoo.Response() r.addPlayText("What category did you spend on") g = r.append(kookoo.CollectDtmf(maxDigits=1)) g.append(kookoo.PlayText("Press 1 for food")) g.append(kookoo.PlayText("Press 2 for transport")) g.append(kookoo.PlayText("Press 3 for shopping")) g.append(kookoo.PlayText("Press 4 for entertainment")) g.append(kookoo.PlayText("Press 5 for heathcare")) g.append(kookoo.PlayText("Press 6 for education")) g.append(kookoo.PlayText("Press 7 for others")) return r
def call_ivr(request): if request.method == 'GET': print request.GET event = request.GET.get('event', None) print event if event == "GotDTMF": pincode = int(request.GET['data']) top_10_schools = SchoolNames.Query.all().limit(2) s = "The schools near you are " for school in top_10_schools: s += school.SCHOOL_NAME s += " and" r = kookoo.Response() r.addPlayText(s) r.addHangup() return HttpResponse(r) else: r = kookoo.Response() pincode = r.append(kookoo.CollectDtmf(maxDigits=6)) pincode.append(kookoo.PlayText("Please enter the pincode")) return HttpResponse(r)
def getSpendingDetails(): r = kookoo.Response() g = r.append(kookoo.CollectDtmf(maxDigits=1)) g.append(kookoo.PlayText("Press 1 for quick analytics")) g.append(kookoo.PlayText("Press 2 for detailed analytics")) return r
limittime="1000", timeout="30", moh='default', promptToCalledNumber='no', caller_id='9180XXXXXX') print(r) """ Outputs: <Response> <dial record="true" limittime="1000" timeout="30" moh="default" promptToCalledNumber="no" caller_id="9180XXXXXX">9XXXXXX</dial> </Response> """ # =========================================================================== # Collecting user input r = kookoo.Response() r.append(kookoo.CollectDtmf(maxDigits=1, timeout=4, termchar="#")) r.append(kookoo.PlayText("Press 1 followed by hash")) print(r) """ outputs: <Response> <CollectDtmf l="1"> <PlayText>Press 1</PlayText> </CollectDtmf> </Response> """ # =========================================================================== # Using voice recognition tag
def enterAmount(): r = kookoo.Response() g = r.append(kookoo.CollectDtmf()) g.append(kookoo.PlayText("How much did you spend")) return r
# =========================================================================== # Using Conference r = kookoo.Response() r.addPlayText("Welcome to the conference") r.addConference("12345") print r """ Outputs: <Response> <PlayText>Welcome to the conference</PlayText> <Conference>12345</Conference> </Response> """ # =========================================================================== # Collecting user input r = kookoo.Response() g = r.append(kookoo.CollectDtmf(maxDigits=1)) g.append(kookoo.PlayText("Press 1")) print r """ outputs: <Response> <CollectDtmf l="1"> <PlayText>Press 1</PlayText> </CollectDtmf> </Response> """