Skip to content

Commit

Permalink
Fixed issue with CDR's not working
Browse files Browse the repository at this point in the history
  • Loading branch information
mackhendricks committed Mar 31, 2021
1 parent ec4219d commit cdecaf5
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions gui/modules/api/api_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2499,8 +2499,25 @@ def generateCDRS(gwgroupid, type=None, email=False, dtfilter=datetime.min, cdrfi
ORDER BY t1.call_start_time DESC;"""
).format(gwgroupid=gwgroupid, dtfilter=dtfilter)

rows = db.execute(query)
cdrs = [OrderedDict(row.items()) for row in rows]
rows = db.execute(query)
cdrs = []
for row in rows:
data = {}
data['cdr_id'] = row[0]
data['call_start_time'] = row[1]
data['call_duration'] = str(row[2])
data['call_direction'] = row[3]
data['src_gwgroupid'] = row[4]
data['src_gwgroupname'] = row[5]
data['dst_gwgroupid'] = row[6]
data['dst_gwgroupname'] = row[7]
data['src_username'] = row[8]
data['dst_username'] = row[9]
data['src_address'] = row[10]
data['dst_address'] = row[11]
data['call_id'] = row[12]

cdrs.append(data)

response_payload['status'] = "200"
response_payload['cdrs'] = cdrs
Expand Down

0 comments on commit cdecaf5

Please sign in to comment.