Hal De пре 3 година
родитељ
комит
382087aa17
1 измењених фајлова са 7 додато и 10 уклоњено
  1. 7 10
      app/app.py

+ 7 - 10
app/app.py

@@ -331,14 +331,14 @@ async def getCDR(start=None,
     cdr.append(_cdr[_id])
   return cdr
 
-async def getCallInfo(linked_id):
+async def getCallInfo(linkedid):
   _q = '''SELECT *
           FROM cel 
           WHERE linkedid=:linkedid and eventtype = :eventtype'''
   _v = {'linkedid': linkedid, 'eventtype': 'ATTENDEDTRANSFER'}
   _f = True
   uniqueids = set(linkedid) #get ids of transferred calls
-  async for row in _db.iterate(query=_q, values=_v):
+  async for row in db.iterate(query=_q, values=_v):
     extra  = json.loads(row['extra'])
     uniqueids.add(extra['channel2_uniqueid'])
     
@@ -350,7 +350,7 @@ async def getCallInfo(linked_id):
   _f = True
   unique_ids = set()
   events = CdrEvents()
-  async for row in _db.iterate(query=_q, values=_v):
+  async for row in db.iterate(query=_q, values=_v):
     events.add(row)
   return events.simple()
 
@@ -1275,16 +1275,13 @@ class UserCalls(Resource):
 @app.route('/call/<call_id>')
 class CallInfo(Resource):
   @authRequired
-  @app.param('call_id', 'call_id for ', 'query')
+  @app.param('call_id', 'call_id for ', 'path')
   @app.response(HTTPStatus.OK, 'JSON data {"status":status,"data":data,"message":message}')
   @app.response(HTTPStatus.UNAUTHORIZED, 'Authorization required')
   async def get(self, call_id):
-    '''Returns call info.
-    '''
-    if (user != request.user) and (not request.admin):
-      abort(401)
-    call = await getCallInfo(user,
-                           request.args.get('call_id', None))
+    '''Returns call info.'''
+
+    call = await getCallInfo(call_id)
     return successReply(call)
 
 @app.route('/device/<device>/callback')