Browse Source

cdr events

svetlana 3 years ago
parent
commit
60c6311dbf
1 changed files with 16 additions and 1 deletions
  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):