svetlana %!s(int64=3) %!d(string=hai) anos
pai
achega
60c6311dbf
Modificáronse 1 ficheiros con 16 adicións e 1 borrados
  1. 16 1
      app/cel.py

+ 16 - 1
app/cel.py

@@ -93,6 +93,20 @@ class CdrUserEvents(CdrEvents):
           else:
             lo = mid+1
         self._events.insert(lo, event)
+       
+  def simple(self):
+    res = []
+    for event in self._events:
+        simple_event = {'start': event.calldate,
+            'answered': event.disposition=='ANSWERED',
+            'duration': event.duration,
+            #'waiting': event.waiting,
+            'application': event.lastapp
+            'dst': event.dst,
+            'uniqueid': self.uniqueid,
+            'file': self.recordingfile}
+        res.append(simple_event)
+    return res
 
 class CelEvents(CdrEvents):
   def has(self, value, key='eventtype'):
@@ -223,7 +237,8 @@ class CdrUserCall(CdrCall):
             'dst': self.dst,
             'did': self.did,
             'linkedid': self.linkedid,
-            'file': self.file}
+            'file': self.file,
+            'events': self.events.simple()}
 
 class CelCall:
   def __init__(self, event=None):