예제 #1
0
 def announce(self, eventid, numorder, ghid):
     result = sqlitedb.geteventinfo(self, eventid)
     record = result[0]
     language = record['language'].encode('utf-8')
     message = record['message'].encode('utf-8')
     headmsg = record['headmsg'].encode('utf-8')
     footmsg = record['footmsg'].encode('utf-8')
     hostname = record['hostname'].encode('utf-8')
     text1 = '<?xml version="1.0" encoding="UTF-8"?>\n'
     text2 = '<Response><Gather action=\"./status/%s/%s/%s\" method=\"POST\" timeout=\"10\" numDigits=\"1\">' % \
             (eventid.encode('utf-8'), numorder.encode('utf-8'), ghid.encode('utf-8'))
     text3 = '<Say voice=\"woman\" language=\"%s\" loop=\"2\">' % language
     #text4 = '%s%s%s' % (headmsg, message, footmsg)
     text4 = '%s%s%s%s' % (headmsg, hostname, message, footmsg)
     text5 = '</Say></Gather><Say voice=\"woman\" language=\"%s\" loop=\"2\">%s</Say></Response>' % (language, options_response_timeout)
     result = '%s%s%s%s%s' % (text1, text2, text3, text4, text5)
     print '%s' % result
     return result
예제 #2
0
 def callrequest(self, eventid):
     events = sqlitedb.geteventinfo(self, eventid)
     for event in events:
         if event['calltype'] == int(define.CALL_TYPE['sequential']):
             answer = sqlitedb.findAnswer(self, eventid)
             #print answer
             if answer:
                 print 'callrequest:found answer, finished'
                 result = sqlitedb.finishevent(self, event)
                 return             
         calls = sqlitedb.getactivecall(self, eventid, int(event['frequency']))
         if not calls:
             print 'callrequest:calls not found, finished'
             result = sqlitedb.finishevent(self, event)
         else:
             if event['calltype'] == int(define.CALL_TYPE['paralell']):
                 print 'callrequest:paralell proc'
                 self._call(event, calls)
             else: #define.CALL_TYPE['sequential']
                 print 'callrequest:sequential call'
                 seccall = []
                 seccall.append(calls[0])
                 self._call(event, seccall)
     return