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 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 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
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 r = kookoo.Response()
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> """