|
|
@@ -169,8 +169,11 @@ async def getCDR(start=None, end=None, **kwargs):
|
|
|
dst_cnam,
|
|
|
peeraccount
|
|
|
FROM cdr
|
|
|
+ WHERE linkedid
|
|
|
+ IN (SELECT DISTINCT(linkedid)
|
|
|
+ FROM cdr
|
|
|
WHERE calldate
|
|
|
- BETWEEN :start AND :end
|
|
|
+ BETWEEN :start AND :end)
|
|
|
ORDER BY linkedid,
|
|
|
calldate,
|
|
|
uniqueid;''',
|
|
|
@@ -205,8 +208,11 @@ async def getCEL(start=None, end=None, **kwargs):
|
|
|
uniqueid,
|
|
|
linkedid
|
|
|
FROM cel
|
|
|
+ WHERE linkedid
|
|
|
+ IN (SELECT DISTINCT(linkedid)
|
|
|
+ FROM cel
|
|
|
WHERE eventtime
|
|
|
- BETWEEN :start AND :end
|
|
|
+ BETWEEN :start AND :end)
|
|
|
ORDER BY linkedid,
|
|
|
uniqueid,
|
|
|
eventtime;''',
|
|
|
@@ -802,7 +808,7 @@ class DeviceUnBind(Resource):
|
|
|
|
|
|
@app.route('/cdr')
|
|
|
class CDR(Resource):
|
|
|
- @app.param('end', 'End of datetime range. Defaults to now. Allowed formats are: timestamp, ISO 8601 and ddmmyyyyHHMMSS', 'query')
|
|
|
+ @app.param('end', 'End of datetime range. Defaults to now. Allowed formats are: timestamp, ISO 8601 or yyyymmddHHMMSS', 'query')
|
|
|
@app.param('start', 'Start of datetime range. Defaults to end-24h. Allowed formats are: timestamp, ISO 8601 and ddmmyyyyHHMMSS', 'query')
|
|
|
@app.response(HTTPStatus.OK, 'JSON reply')
|
|
|
@app.response(HTTPStatus.UNAUTHORIZED, 'Authorization required')
|
|
|
@@ -817,7 +823,7 @@ class CDR(Resource):
|
|
|
|
|
|
@app.route('/cel')
|
|
|
class CEL(Resource):
|
|
|
- @app.param('end', 'End of datetime range. Defaults to now. Allowed formats are: timestamp, ISO 8601 and ddmmyyyyHHMMSS', 'query')
|
|
|
+ @app.param('end', 'End of datetime range. Defaults to now. Allowed formats are: timestamp, ISO 8601 or yyyymmddHHMMSS', 'query')
|
|
|
@app.param('start', 'Start of datetime range. Defaults to end-24h. Allowed formats are: timestamp, ISO 8601 and ddmmyyyyHHMMSS', 'query')
|
|
|
@app.response(HTTPStatus.OK, 'JSON reply')
|
|
|
@app.response(HTTPStatus.UNAUTHORIZED, 'Authorization required')
|
|
|
@@ -837,7 +843,7 @@ class Calls(Resource):
|
|
|
@app.response(HTTPStatus.OK, 'JSON reply')
|
|
|
@app.response(HTTPStatus.UNAUTHORIZED, 'Authorization required')
|
|
|
async def get(self):
|
|
|
- '''Returns aggregated call data JSON.
|
|
|
+ '''Returns aggregated call data JSON. NOT IMPLEMENTED.
|
|
|
All request arguments are optional.
|
|
|
'''
|
|
|
calls = []
|
|
|
@@ -846,7 +852,7 @@ class Calls(Resource):
|
|
|
cdr = await getCDR(start, end)
|
|
|
for _call in cdr:
|
|
|
_call0 = _call['events'][0]
|
|
|
- context = _call0['dcontext']
|
|
|
+ dcontext = _call0['dcontext']
|
|
|
call = {'id':_call['id'],
|
|
|
'start':_call0['calldate'],
|
|
|
'type': None,
|
|
|
@@ -862,23 +868,26 @@ class Calls(Resource):
|
|
|
('recordingfile','url')):
|
|
|
if _c in _call0:
|
|
|
call[_r] = _call0[_c]
|
|
|
- src = _call0['src'] if 'src' in _call0 else None
|
|
|
- dst = _call0['dst'] if 'dst' in _call0 else None
|
|
|
- if src in (*app.cache['ustates'].keys(), *app.cache['devices']):
|
|
|
- if dst in (*app.cache['ustates'].keys(),
|
|
|
- *app.cache['devices'],
|
|
|
- *app.cache['queues'].keys()):
|
|
|
- call['type'] = 'local'
|
|
|
- else:
|
|
|
- call['type'] = 'out'
|
|
|
- call['numberB'] = _call0['dst']
|
|
|
- else:
|
|
|
- call['type'] = 'in'
|
|
|
- if 'did' in _call0:
|
|
|
- call['line'] = _call0['did']
|
|
|
- if len(_call['events']) > 1:
|
|
|
- for step in _call['events'][1:]:
|
|
|
- pass
|
|
|
+ # if context in ('from-internal'):
|
|
|
+
|
|
|
+ # if context in ('ext-queues'):
|
|
|
+ # call['type'] = 'in'
|
|
|
+ # if 'did' in _call0:
|
|
|
+ # call['line'] = _call0['did']
|
|
|
+
|
|
|
+
|
|
|
+ # call['type'] = 'local'
|
|
|
+ # else:
|
|
|
+ # call['type'] = 'out'
|
|
|
+ # call['numberB'] = _call0['dst']
|
|
|
+ # else:
|
|
|
+ # call['type'] = 'in'
|
|
|
+ # if 'did' in _call0:
|
|
|
+ # call['line'] = _call0['did']
|
|
|
+ # if len(_call['events']) > 1:
|
|
|
+ # for step in _call['events'][1:]:
|
|
|
+
|
|
|
+ # pass
|
|
|
calls.append(call)
|
|
|
return successReply(calls)
|
|
|
|