|
@@ -9,6 +9,7 @@ import json
|
|
|
from datetime import date as date
|
|
from datetime import date as date
|
|
|
from datetime import datetime as dt
|
|
from datetime import datetime as dt
|
|
|
from datetime import timedelta as td
|
|
from datetime import timedelta as td
|
|
|
|
|
+from datetime import timezone as dtz
|
|
|
from typing import Any, Optional
|
|
from typing import Any, Optional
|
|
|
from functools import wraps
|
|
from functools import wraps
|
|
|
from secrets import compare_digest
|
|
from secrets import compare_digest
|
|
@@ -28,7 +29,7 @@ from aiohttp.resolver import AsyncResolver
|
|
|
class ApiJsonEncoder(JSONEncoder):
|
|
class ApiJsonEncoder(JSONEncoder):
|
|
|
def default(self, o):
|
|
def default(self, o):
|
|
|
if isinstance(o, dt):
|
|
if isinstance(o, dt):
|
|
|
- return o.isoformat() + 'Z'
|
|
|
|
|
|
|
+ return o.astimezone(dtz.utc).replace(tzinfo=None).isoformat() + 'Z'
|
|
|
if isinstance(o, CdrChannel):
|
|
if isinstance(o, CdrChannel):
|
|
|
return str(o)
|
|
return str(o)
|
|
|
if isinstance(o, CdrEvent):
|
|
if isinstance(o, CdrEvent):
|
|
@@ -225,7 +226,7 @@ async def celCallback(mngr: Manager, msg: Message):
|
|
|
second = extra['channel2_uniqueid'] #linked
|
|
second = extra['channel2_uniqueid'] #linked
|
|
|
firstname = extra['transferee_channel_name']
|
|
firstname = extra['transferee_channel_name']
|
|
|
secondname = extra['channel2_name']
|
|
secondname = extra['channel2_name']
|
|
|
- if (msg.CallerIDrdnis == '78124254209'):
|
|
|
|
|
|
|
+ if (True or msg.CallerIDrdnis == '78124254209'):
|
|
|
res = await amiStopMixMonitor(firstname);
|
|
res = await amiStopMixMonitor(firstname);
|
|
|
app.logger.warning('{}'.format(res))
|
|
app.logger.warning('{}'.format(res))
|
|
|
filename = "transfer-{}-{}-{}.wav".format(msg.Exten, msg.CallerIDnum, msg.LinkedID);
|
|
filename = "transfer-{}-{}-{}.wav".format(msg.Exten, msg.CallerIDnum, msg.LinkedID);
|
|
@@ -1190,7 +1191,8 @@ class SetPresenceState(Resource):
|
|
|
if user not in app.cache['ustates']:
|
|
if user not in app.cache['ustates']:
|
|
|
return noUser(user)
|
|
return noUser(user)
|
|
|
# app.logger.warning('state={}, getUserStateCombined({})={}'.format(state, user, getUserStateCombined(user)))
|
|
# app.logger.warning('state={}, getUserStateCombined({})={}'.format(state, user, getUserStateCombined(user)))
|
|
|
- if (state.lower() in ('available','away','not_set','xa','chat')) and (getUserStateCombined(user) in ('dnd')):
|
|
|
|
|
|
|
+ # if (state.lower() in ('available','away','not_set','xa','chat')) and (getUserStateCombined(user) in ('dnd')):
|
|
|
|
|
+ if (state.lower() not in ('dnd')):
|
|
|
result = await amiDBDel('DND', '{}'.format(user))
|
|
result = await amiDBDel('DND', '{}'.format(user))
|
|
|
result = await amiSetVar('PRESENCE_STATE(CustomPresence:{})'.format(user), state)
|
|
result = await amiSetVar('PRESENCE_STATE(CustomPresence:{})'.format(user), state)
|
|
|
if result is not None:
|
|
if result is not None:
|