b29eb2279ed0a03e9d125c2438f1e66e8519b590
[motion.git] / server / config / ami / socket.js
1 var _0xf34d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x72\x65\x64\x69\x73","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x52\x65\x70\x6F\x72\x74\x44\x69\x61\x6C","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72","\x55\x73\x65\x72","\x2E\x2E\x2F\x74\x72\x69\x67\x67\x65\x72\x73","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x61\x6D\x69","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x2E\x2F\x75\x74\x69\x6C\x73","\x72\x65\x64\x69\x73\x50\x77\x64","\x69\x70","\x63\x72\x65\x61\x74\x65\x43\x6C\x69\x65\x6E\x74","\x73\x6F\x63\x6B\x65\x74\x2E\x69\x6F\x2D\x65\x6D\x69\x74\x74\x65\x72","\x65\x78\x70\x6F\x72\x74\x73","\x65\x6D\x69\x74","\x74\x6F","\x65\x76\x65\x6E\x74","\x70\x72\x69\x76\x69\x6C\x65\x67\x65","\x6D\x65\x6D\x62\x65\x72\x73\x68\x69\x70","\x72\x69\x6E\x67\x69\x6E\x75\x73\x65","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x6E\x61\x6D\x65","\x69\x6E\x74\x65\x72\x66\x61\x63\x65","\x73\x74\x61\x74\x65\x69\x6E\x74\x65\x72\x66\x61\x63\x65","\x73\x74\x61\x74\x75\x73\x64\x65\x73\x63","\x55\x4E\x4B\x4E\x4F\x57\x4E","\x30","\x4E\x4F\x54\x5F\x49\x4E\x55\x53\x45","\x31","\x49\x4E\x55\x53\x45","\x32","\x42\x55\x53\x59","\x33","\x49\x4E\x56\x41\x4C\x49\x44","\x34","\x55\x4E\x41\x56\x41\x49\x4C\x41\x42\x4C\x45","\x35","\x52\x49\x4E\x47\x49\x4E\x47","\x36","\x52\x49\x4E\x47\x49\x4E\x55\x53\x45","\x37","\x4F\x4E\x48\x4F\x4C\x44","\x38","\x73\x74\x61\x74\x75\x73","\x70\x65\x6E\x61\x6C\x74\x79","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x63\x61\x6C\x6C\x73\x74\x61\x6B\x65\x6E","\x6C\x61\x73\x74\x63\x61\x6C\x6C","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x70\x61\x75\x73\x65\x64","\x71\x75\x65\x75\x65\x73","\x69\x6E\x62\x6F\x75\x6E\x64","\x67\x6C\x6F\x62\x61\x6C","\x69\x6E\x62\x6F\x75\x6E\x64\x20\x69\x6E\x69\x74\x20\x65\x72\x72\x6F\x72\x3A","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x71\x75\x65\x75\x65","\x74\x6F\x74\x61\x6C","\x69\x73\x57\x61\x69\x74\x69\x6E\x67","\x77\x61\x69\x74\x69\x6E\x67","\x69\x73\x41\x63\x74\x69\x76\x65","\x61\x63\x74\x69\x76\x65","\x69\x73\x43\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x68\x6F\x6C\x64\x74\x69\x6D\x65","\x74\x61\x6C\x6B\x74\x69\x6D\x65","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6C\x65\x61\x76\x65\x41\x74","\x73\x65\x63\x6F\x6E\x64\x73","\x64\x69\x66\x66","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x63\x6F\x6D\x70\x6C\x65\x74\x65\x41\x74","\x61\x76\x67\x48\x6F\x6C\x64\x74\x69\x6D\x65","\x72\x6F\x75\x6E\x64","\x61\x76\x67\x54\x61\x6C\x6B\x74\x69\x6D\x65","\x69\x73\x41\x62\x61\x6E\x64\x6F\x6E\x65\x64","\x61\x62\x61\x6E\x64\x6F\x6E\x65\x64","\x69\x73\x55\x6E\x6D\x61\x6E\x61\x67\x65\x64","\x75\x6E\x6D\x61\x6E\x61\x67\x65\x64","\x61\x6E\x73\x77\x65\x72\x52\x61\x74\x65","\x61\x62\x61\x6E\x64\x6F\x6E\x52\x61\x74\x65","\x74\x68\x65\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x65\x78\x69\x74","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x61\x62\x61\x6E\x64\x6F\x6E","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x20\x69\x6E\x69\x74\x20\x65\x72\x72\x6F\x72\x3A","\x66\x69\x6C\x74\x65\x72","\x74\x69\x67\x65\x72\x64\x69\x61\x6C","\x61\x6E\x73\x77\x65\x72\x65\x64","\x41\x4E\x53\x57\x45\x52\x45\x44","\x64\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x63\x6F\x75\x6E\x74\x42\x79","\x73\x75\x6D\x44\x75\x72\x61\x74\x69\x6F\x6E","\x62\x69\x6C\x6C\x61\x62\x6C\x65\x73\x65\x63\x6F\x6E\x64\x73","\x73\x75\x6D\x42\x79","\x61\x76\x67\x44\x75\x72\x61\x74\x69\x6F\x6E","\x72\x65\x73\x75\x6C\x74","\x64\x61\x79","\x73\x74\x61\x72\x74\x4F\x66","\x74\x79\x70\x65","\x72\x65\x73\x6F\x6C\x76\x65","\x61\x67\x65\x6E\x74\x73","\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C\x3A\x73\x61\x76\x65","\x76\x6F\x69\x63\x65\x2F\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2F\x67\x6C\x6F\x62\x61\x6C","\x76\x6F\x69\x63\x65\x3A\x6F\x75\x74\x62\x6F\x75\x6E\x64\x3A\x67\x6C\x6F\x62\x61\x6C","\x75\x6E\x69\x71\x75\x65\x69\x64","\x63\x68\x61\x6E\x6E\x65\x6C\x73","\x6C\x69\x6E\x6B\x65\x64\x69\x64","\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x61\x67\x65\x6E\x74\x3A\x25\x73","\x73\x70\x6C\x69\x74","\x63\x68\x61\x6E\x6E\x65\x6C","\x72\x65\x70\x6F\x72\x74\x5F\x64\x69\x61\x6C\x3A\x75\x70\x64\x61\x74\x65","\x61\x64\x6D\x69\x6E\x73","\x75\x73\x65\x72\x73","\x72\x65\x70\x6F\x72\x74\x44\x69\x61\x6C","\x64\x65\x76\x69\x63\x65\x73\x74\x61\x74\x65\x63\x68\x61\x6E\x67\x65\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x69\x6E\x66\x6F","\x69\x64","\x73\x74\x61\x74\x65","\x61\x73\x73\x69\x67\x6E","\x25\x73\x3A\x25\x73","\x72\x6F\x6C\x65","\x61\x67\x65\x6E\x74\x3A\x73\x61\x76\x65","\x53\x49\x50\x2F","","\x72\x65\x70\x6C\x61\x63\x65","\x64\x65\x76\x69\x63\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x74\x72\x75\x6E\x6B\x73","\x70\x65\x65\x72\x73\x74\x61\x74\x75\x73","\x76\x6F\x69\x63\x65\x2F\x74\x72\x75\x6E\x6B\x73","\x76\x6F\x69\x63\x65\x3A\x74\x72\x75\x6E\x6B\x73","\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x3A\x73\x61\x76\x65","\x72\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x43\x72\x65\x61\x74\x65","\x61\x67\x65\x6E\x74\x63\x61\x6C\x6C\x65\x64\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x63\x61\x6C\x6C\x65\x64","\x72\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x55\x70\x64\x61\x74\x65","\x76\x6F\x69\x63\x65\x3A\x69\x6E\x62\x6F\x75\x6E\x64","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x3A\x75\x70\x64\x61\x74\x65","\x72\x65\x61\x73\x6F\x6E","\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x3A\x75\x70\x64\x61\x74\x65","\x69\x64\x20\x44\x45\x53\x43","\x64\x65\x73\x74\x75\x6E\x69\x71\x75\x65\x69\x64","\x63\x6F\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x75\x6D","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x75\x6D","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x61\x6D\x65","\x72\x69\x6E\x67\x74\x69\x6D\x65","\x61\x67\x65\x6E\x74\x63\x6F\x6E\x6E\x65\x63\x74\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x63\x6F\x6E\x6E\x65\x63\x74","\x61\x6E\x73\x77\x65\x72\x65\x64\x5F\x65\x6C\x73\x65\x77\x68\x65\x72\x65","\x61\x67\x65\x6E\x74\x72\x69\x6E\x67\x6E\x6F\x61\x6E\x73\x77\x65\x72\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x72\x65\x6A\x65\x63\x74\x65\x64","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x72\x65\x6D\x6F\x76\x65\x64\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x76\x6F\x69\x63\x65\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65","\x71\x75\x65\x75\x65\x6D\x65\x6D\x62\x65\x72\x70\x61\x75\x73\x65\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x6D\x65\x72\x67\x65","\x63\x68\x61\x6E\x6E\x65\x6C\x73\x74\x61\x74\x65","\x63\x68\x61\x6E\x6E\x65\x6C\x73\x74\x61\x74\x65\x64\x65\x73\x63","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x65\x78\x74\x65\x6E","\x70\x72\x69\x6F\x72\x69\x74\x79","\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x63\x6F\x75\x6E\x74","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x72\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x72\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x6C\x61\x73\x74\x65\x76\x65\x6E\x74","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x5F\x63\x68\x61\x6E\x67\x65\x64","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x62\x61\x6E\x64\x6F\x6E","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6A\x6F\x69\x6E\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x63\x6F\x6E\x74\x65\x78\x74","\x64\x69\x61\x6C\x73\x74\x72\x69\x6E\x67","\x72\x65\x70\x6F\x72\x74\x5F\x64\x69\x61\x6C\x3A\x73\x61\x76\x65","\x64\x69\x61\x6C\x73\x74\x61\x74\x75\x73","\x64\x65\x73\x74\x6C\x69\x6E\x6B\x65\x64\x69\x64","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x72\x6F\x75\x74\x65\x69\x64","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x6C\x75\x65","\x76\x61\x72\x53\x65\x74","\x73\x6F\x63\x6B\x65\x74","\x63\x6F\x6E\x73\x6F\x6C\x65\x3A\x25\x73","\x64\x61\x74\x61","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x66\x6F\x72\x4F\x77\x6E","\x75\x70\x64\x61\x74\x65\x54\x72\x69\x67\x67\x65\x72\x73","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x25\x73\x5F\x71\x75\x65\x75\x65\x3A\x73\x61\x76\x65","\x75\x73\x65\x72\x5F\x68\x61\x73\x5F\x25\x73\x5F\x71\x75\x65\x75\x65\x3A\x72\x65\x6D\x6F\x76\x65","\x63\x68\x65\x63\x6B\x54\x72\x69\x67\x67\x65\x72\x73","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x72\x65\x70\x6F\x72\x74\x5F\x66\x61\x78\x3A\x75\x70\x64\x61\x74\x65","\x77\x69\x64\x67\x65\x74\x5F\x75\x70\x64\x61\x74\x65\x3A"];_0xf34d[0];var _=require(_0xf34d[1]);var util=require(_0xf34d[2]);var moment=require(_0xf34d[3]);var BPromise=require(_0xf34d[4]);var redis=require(_0xf34d[5]);var VoiceQueue=require(_0xf34d[7])[_0xf34d[6]];var ReportQueue=require(_0xf34d[7])[_0xf34d[8]];var ReportCall=require(_0xf34d[7])[_0xf34d[9]];var ReportAgent=require(_0xf34d[7])[_0xf34d[10]];var ReportDial=require(_0xf34d[7])[_0xf34d[11]];var ReportMember=require(_0xf34d[7])[_0xf34d[12]];var User=require(_0xf34d[7])[_0xf34d[13]];var Triggers=require(_0xf34d[14]);var config=require(_0xf34d[15]);var logger=require(_0xf34d[17])(_0xf34d[16]);var utils=require(_0xf34d[18]);var redisConf;if(config[_0xf34d[19]]){redisConf= {password:config[_0xf34d[19]]}};var redisClient=redis[_0xf34d[21]](6379,config[_0xf34d[20]],redisConf);var io=require(_0xf34d[22])(redisClient);var triggers= new Triggers(io);var params={trunks:[],inbound:{queues:{},channels:[],global:{waiting:0,active:0,completed:0,abandoned:0,unmanaged:0,holdtime:0,talktime:0,avgHoldtime:0,avgTalktime:0,answerRate:0,abandonRate:0,total:0}},outbound:{global:{total:0,answered:0,sumDuration:0,avgDuration:0,tigerdial:0},channels:[]}};module[_0xf34d[23]]= function(){var _0xbf49x16=function(_0xbf49x17,_0xbf49x18,_0xbf49x19){if(_0xbf49x17){io[_0xf34d[25]](_0xbf49x17)[_0xf34d[24]](_0xbf49x18,_0xbf49x19)}else {io[_0xf34d[24]](_0xbf49x18,_0xbf49x19)}};var _0xbf49x1a=function(_0xbf49x1b){delete _0xbf49x1b[_0xf34d[26]];delete _0xbf49x1b[_0xf34d[27]];delete _0xbf49x1b[_0xf34d[28]];delete _0xbf49x1b[_0xf34d[29]];_0xbf49x1b[_0xf34d[30]]= _0xbf49x1b[_0xf34d[31]]|| _0xbf49x1b[_0xf34d[30]];_0xbf49x1b[_0xf34d[32]]= _0xbf49x1b[_0xf34d[33]];_0xbf49x1b[_0xf34d[34]]= _0xf34d[35];switch(_0xbf49x1b[_0xf34d[53]]){case _0xf34d[36]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[35];break;case _0xf34d[38]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[37];break;case _0xf34d[40]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[39];break;case _0xf34d[42]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[41];break;case _0xf34d[44]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[43];break;case _0xf34d[46]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[45];break;case _0xf34d[48]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[47];break;case _0xf34d[50]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[49];break;case _0xf34d[52]:_0xbf49x1b[_0xf34d[34]]= _0xf34d[51];break;default:};_0xbf49x1b[_0xf34d[53]]= Number(_0xbf49x1b[_0xf34d[53]]);if(_0xbf49x1b[_0xf34d[55]](_0xf34d[54])){_0xbf49x1b[_0xf34d[54]]= Number(_0xbf49x1b[_0xf34d[54]])};if(_0xbf49x1b[_0xf34d[55]](_0xf34d[56])){_0xbf49x1b[_0xf34d[56]]= Number(_0xbf49x1b[_0xf34d[56]])};if(_0xbf49x1b[_0xf34d[55]](_0xf34d[57])){if(_0xbf49x1b[_0xf34d[57]]=== _0xf34d[36]){_0xbf49x1b[_0xf34d[57]]= null}else {_0xbf49x1b[_0xf34d[57]]= moment()[_0xf34d[59]](_0xf34d[58])}};_0xbf49x1b[_0xf34d[60]]= parseInt(_0xbf49x1b[_0xf34d[60]],10)?true:false};function _0xbf49x1c(_0xbf49x1d){if(!params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1d]){params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1d]= {agents:{},waiting:0,active:0,completed:0,abandoned:0,unmanaged:0,holdtime:0,talktime:0,avgHoldtime:0,avgTalktime:0,answerRate:0,abandonRate:0,total:0}}}function _0xbf49x1e(){return function(){params[_0xf34d[62]][_0xf34d[61]]= {};params[_0xf34d[62]][_0xf34d[63]]= {waiting:0,active:0,completed:0,abandoned:0,unmanaged:0,holdtime:0,talktime:0,avgHoldtime:0,avgTalktime:0,answerRate:0,abandonRate:0,total:0};return VoiceQueue[_0xf34d[97]]({attributes:[_0xf34d[31]],raw:true})[_0xf34d[92]](function(_0xbf49x20){if(_0xbf49x20){_[_0xf34d[93]](_0xbf49x20,function(_0xbf49x1d){_0xbf49x1c(_0xbf49x1d[_0xf34d[31]])});return ReportQueue[_0xf34d[97]]({attributes:[_0xf34d[69],_0xf34d[79],_0xf34d[82],_0xf34d[94],_0xf34d[95],_0xf34d[96],_0xf34d[77]],raw:true})}})[_0xf34d[92]](function(_0xbf49x20){if(_0xbf49x20){var _0xbf49x21;var _0xbf49x22;var _0xbf49x23=_0xbf49x20[_0xf34d[68]];for(var _0xbf49x24=0;_0xbf49x24< _0xbf49x23;_0xbf49x24++){_0xbf49x21= _0xbf49x20[_0xbf49x24];_0xbf49x22= _0xbf49x21[_0xf34d[69]];_0xbf49x1c(_0xbf49x22);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[70]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[70]]++;if(utils[_0xf34d[71]](_0xbf49x21)){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[72]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[72]]++};if(utils[_0xf34d[73]](_0xbf49x21)){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[74]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[74]]++};if(utils[_0xf34d[75]](_0xbf49x21)){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[76]]++;params[_0xf34d[62]][_0xf34d[63]][_0xf34d[77]]+= _0xbf49x21[_0xf34d[77]]|| 0;params[_0xf34d[62]][_0xf34d[63]][_0xf34d[78]]+= moment(_0xbf49x21[_0xf34d[82]])[_0xf34d[81]](moment(_0xbf49x21[_0xf34d[79]]),_0xf34d[80]);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[83]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[77]]/ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[76]]);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[85]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[78]]/ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[76]]);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[77]]+= _0xbf49x21[_0xf34d[77]]|| 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[78]]+= moment(_0xbf49x21[_0xf34d[82]])[_0xf34d[81]](moment(_0xbf49x21[_0xf34d[79]]),_0xf34d[80]);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[83]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[77]]/ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[76]]);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[85]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[78]]/ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[76]])};if(utils[_0xf34d[86]](_0xbf49x21)){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[87]]++};if(utils[_0xf34d[88]](_0xbf49x21)){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[89]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[89]]++};params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[90]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[76]]/ (params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[91]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[87]]/ (params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x22][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[90]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]/ (params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[91]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]]/ (params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]])* 100,2)}}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[64],_0xbf49x1f[_0xf34d[65]])})}}function _0xbf49x25(){return function(){params[_0xf34d[98]][_0xf34d[63]]= {total:0,answered:0,sumDuration:0,avgDuration:0,tigerdial:0};return ReportCall[_0xf34d[97]]({where:{type:[_0xf34d[98],_0xf34d[101]],createdAt:{$gte:moment()[_0xf34d[112]](_0xf34d[111])}},attributes:[_0xf34d[113],_0xf34d[104],_0xf34d[107]],raw:true})[_0xf34d[92]](function(_0xbf49x20){if(_0xbf49x20){var _0xbf49x26=_[_0xf34d[100]](_0xbf49x20,{type:_0xf34d[98]});var _0xbf49x27=_[_0xf34d[100]](_0xbf49x20,{type:_0xf34d[101]});if(_0xbf49x26[_0xf34d[68]]){params[_0xf34d[98]][_0xf34d[63]][_0xf34d[70]]= _0xbf49x26[_0xf34d[68]];params[_0xf34d[98]][_0xf34d[63]][_0xf34d[102]]= _[_0xf34d[105]](_0xbf49x26,_0xf34d[104])[_0xf34d[103]]|| 0;params[_0xf34d[98]][_0xf34d[63]][_0xf34d[106]]= _[_0xf34d[108]](_0xbf49x26,_0xf34d[107]);if(params[_0xf34d[98]][_0xf34d[63]][_0xf34d[102]]){params[_0xf34d[98]][_0xf34d[63]][_0xf34d[109]]= _[_0xf34d[84]]((_[_0xf34d[108]](_0xbf49x26[_0xf34d[110]],_0xf34d[107])/ params[_0xf34d[98]][_0xf34d[63]][_0xf34d[102]]));params[_0xf34d[98]][_0xf34d[63]][_0xf34d[90]]= _[_0xf34d[84]](params[_0xf34d[98]][_0xf34d[63]][_0xf34d[102]]/ params[_0xf34d[98]][_0xf34d[63]][_0xf34d[70]]* 100,1)}};if(_0xbf49x27[_0xf34d[68]]){params[_0xf34d[98]][_0xf34d[63]][_0xf34d[101]]= _0xbf49x27[_0xf34d[68]]}}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[99],_0xbf49x1f[_0xf34d[65]])})}}BPromise[_0xf34d[114]]()[_0xf34d[92]](_0xbf49x1e())[_0xf34d[92]](_0xbf49x25());return {cdr:function(_0xbf49x1b){return function(_0xbf49x20){_0xbf49x16(_0xf34d[115],_0xf34d[116],_0xbf49x1b);if(_0xbf49x1b[_0xf34d[113]]== _0xf34d[98]|| _0xbf49x1b[_0xf34d[113]]== _0xf34d[101]){if(_0xbf49x1b[_0xf34d[113]]== _0xf34d[98]){params[_0xf34d[98]][_0xf34d[63]][_0xf34d[70]]++;_0xbf49x1b[_0xf34d[104]]== _0xf34d[103]&& (params[_0xf34d[98]][_0xf34d[63]][_0xf34d[102]]++);params[_0xf34d[98]][_0xf34d[63]][_0xf34d[106]]+= Number(_0xbf49x1b[_0xf34d[107]]);if(params[_0xf34d[98]][_0xf34d[63]][_0xf34d[102]]){params[_0xf34d[98]][_0xf34d[63]][_0xf34d[109]]= _[_0xf34d[84]](params[_0xf34d[98]][_0xf34d[63]][_0xf34d[106]]/ params[_0xf34d[98]][_0xf34d[63]][_0xf34d[102]]);params[_0xf34d[98]][_0xf34d[63]][_0xf34d[90]]= _[_0xf34d[84]](params[_0xf34d[98]][_0xf34d[63]][_0xf34d[102]]/ params[_0xf34d[98]][_0xf34d[63]][_0xf34d[70]]* 100,1)}}else {params[_0xf34d[98]][_0xf34d[63]][_0xf34d[101]]++};_0xbf49x16(_0xf34d[117],_0xf34d[118],params[_0xf34d[98]][_0xf34d[63]])}}},send:function(_0xbf49x1b){return function(_0xbf49x20){return BPromise[_0xf34d[114]]()}},hangup:function(_0xbf49x1b){return function(_0xbf49x20){if(params[_0xf34d[98]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]){delete params[_0xf34d[98]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]};if(params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]){delete params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]};var _0xbf49x28={uniqueid:_0xbf49x1b[_0xf34d[119]],linkedid:_0xbf49x1b[_0xf34d[121]],endtime:moment()[_0xf34d[59]](_0xf34d[58]),lastevent:_0xf34d[122],updatedAt:moment()[_0xf34d[59]](_0xf34d[58])};_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x1b[_0xf34d[125]][_0xf34d[124]](/\/|-/)[1]),_0xf34d[126],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[126],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[126],_0xbf49x28);if(_0xbf49x20){triggers[_0xf34d[129]](_0xbf49x20)};return BPromise[_0xf34d[114]]()}},devicestatechange:function(_0xbf49x1b){return function(_0xbf49x20){return User[_0xf34d[142]]({where:{name:_0xbf49x1b[_0xf34d[141]][_0xf34d[140]](_0xf34d[138],_0xf34d[139])},raw:true})[_0xf34d[92]](function(_0xbf49x29){if(_0xbf49x29){var _0xbf49x28=_[_0xf34d[134]]({newValues:{id:_0xbf49x29[_0xf34d[132]],status:_0xbf49x1b[_0xf34d[133]],statusAt:moment()[_0xf34d[59]](_0xf34d[58])}},_0xbf49x29,{status:_0xbf49x1b[_0xf34d[133]],statusAt:moment()[_0xf34d[59]](_0xf34d[58])});_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x29[_0xf34d[136]],_0xbf49x29[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[131]](_0xf34d[130],_0xbf49x1f)})}},peerstatus:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20&& _0xbf49x20[0]){_[_0xf34d[93]](_0xbf49x20[1],function(_0xbf49x2a){if(!params[_0xf34d[143]][_0xbf49x2a[_0xf34d[31]]]){params[_0xf34d[143]][_0xbf49x2a[_0xf34d[31]]]= {name:_0xbf49x2a[_0xf34d[31]]}};params[_0xf34d[143]][_0xbf49x2a[_0xf34d[31]]][_0xf34d[144]]= _0xbf49x1b[_0xf34d[144]];_0xbf49x16(_0xf34d[145],_0xf34d[146],params[_0xf34d[143]][_0xbf49x2a[_0xf34d[31]]])})};return BPromise[_0xf34d[114]]()}},registry:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20&& _0xbf49x20[0]){_[_0xf34d[93]](_0xbf49x20[1],function(_0xbf49x2a){if(!params[_0xf34d[143]][_0xbf49x2a[_0xf34d[31]]]){params[_0xf34d[143]][_0xbf49x2a[_0xf34d[31]]]= {name:_0xbf49x2a[_0xf34d[31]]}};params[_0xf34d[143]][_0xbf49x2a[_0xf34d[31]]][_0xf34d[53]]= _0xbf49x1b[_0xf34d[53]];_0xbf49x16(_0xf34d[145],_0xf34d[146],params[_0xf34d[143]][_0xbf49x2a[_0xf34d[31]]])})};return BPromise[_0xf34d[114]]()}},agentcalled:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20){_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x20[_0xf34d[30]]),_0xf34d[147],_0xbf49x20);triggers[_0xf34d[148]](_0xbf49x20)};return User[_0xf34d[142]]({where:{name:_0xbf49x1b[_0xf34d[30]],voicePause:false},raw:true})[_0xf34d[92]](function(_0xbf49x29){if(_0xbf49x29){var _0xbf49x2b=moment()[_0xf34d[59]](_0xf34d[58]);var _0xbf49x28=_[_0xf34d[134]]({newValues:{id:_0xbf49x29[_0xf34d[132]],queueStatus:_0xf34d[150],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]}},_0xbf49x29,{queueStatus:_0xf34d[150],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x29[_0xf34d[136]],_0xbf49x29[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[149],_0xbf49x1f)})}},agentcomplete:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20){triggers[_0xf34d[151]](_0xbf49x20)};if(params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[74]]){params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[74]]--};if(params[_0xf34d[62]][_0xf34d[63]][_0xf34d[74]]){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[74]]--;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[74],amount:-1,queue:_0xbf49x1b[_0xf34d[69]]})};params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]++;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[122],amount:1,queue:_0xbf49x1b[_0xf34d[69]]});params[_0xf34d[62]][_0xf34d[63]][_0xf34d[90]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]/ (params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[91]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]]/ (params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[90]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]/ (params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[91]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[87]]/ (params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[78]]+= Number(_0xbf49x1b[_0xf34d[78]]);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[78]]+= Number(_0xbf49x1b[_0xf34d[78]]);_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[78],amount:Number(_0xbf49x1b[_0xf34d[78]]),queue:_0xbf49x1b[_0xf34d[69]]});params[_0xf34d[62]][_0xf34d[63]][_0xf34d[85]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[63]][_0xf34d[78]]/ params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[85]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[78]]/ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[77]]+= Number(_0xbf49x1b[_0xf34d[77]]);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[77]]+= Number(_0xbf49x1b[_0xf34d[77]]);_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[77],amount:Number(_0xbf49x1b[_0xf34d[77]]),queue:_0xbf49x1b[_0xf34d[69]]});params[_0xf34d[62]][_0xf34d[63]][_0xf34d[83]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[63]][_0xf34d[77]]/ params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[83]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[77]]/ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]);var _0xbf49x28;var _0xbf49x2b=moment()[_0xf34d[59]](_0xf34d[58]);return ReportAgent[_0xf34d[142]]({where:{uniqueid:_0xbf49x1b[_0xf34d[119]],destuniqueid:_0xbf49x1b[_0xf34d[158]]},raw:true})[_0xf34d[92]](function(_0xbf49x2c){if(_0xbf49x2c){_0xbf49x28= _[_0xf34d[134]]({},_0xbf49x2c,{lastevent:_0xf34d[122],agentcomplete:true,agentcompleteAt:_0xbf49x2b,talktime:Number(_0xbf49x1b[_0xf34d[78]]),reason:_0xbf49x1b[_0xf34d[155]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x2c[_0xf34d[30]]),_0xf34d[156],_0xbf49x28)};return ReportQueue[_0xf34d[142]]({where:{uniqueid:_0xbf49x1b[_0xf34d[119]]},order:_0xf34d[157],raw:true})})[_0xf34d[92]](function(_0xbf49x2c){if(_0xbf49x2c){_0xbf49x28= _[_0xf34d[134]]({},_0xbf49x2c,{queuecallercomplete:true,queuecallercompleteAt:_0xbf49x2b});_0xbf49x16(_0xbf49x2c[_0xf34d[69]],_0xf34d[154],_0xbf49x28)};return User[_0xf34d[142]]({where:{name:_0xbf49x1b[_0xf34d[30]]},raw:true})})[_0xf34d[92]](function(_0xbf49x29){if(_0xbf49x29){var _0xbf49x28=_[_0xf34d[134]]({newValues:{id:_0xbf49x29[_0xf34d[132]],queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]}},_0xbf49x29,{queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x29[_0xf34d[136]],_0xbf49x29[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[153],_0xbf49x1f)})}},agentconnect:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20){triggers[_0xf34d[151]](_0xbf49x20)};if(params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[72]]){params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[72]]--;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[72],amount:-1,queue:_0xbf49x1b[_0xf34d[69]]})};if(params[_0xf34d[62]][_0xf34d[63]][_0xf34d[72]]){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[72]]--};if(params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]){params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[159]]= _0xbf49x1b[_0xf34d[160]];params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[161]]= _0xbf49x1b[_0xf34d[161]];params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[77]]= Number(_0xbf49x1b[_0xf34d[77]]);params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[162]]= Number(_0xbf49x1b[_0xf34d[162]]);params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[32]]= _0xbf49x1b[_0xf34d[32]];params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[30]]= _0xbf49x1b[_0xf34d[30]]};params[_0xf34d[62]][_0xf34d[63]][_0xf34d[74]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[74]]++;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[74],amount:1,queue:_0xbf49x1b[_0xf34d[69]]});var _0xbf49x28;var _0xbf49x2b=moment()[_0xf34d[59]](_0xf34d[58]);return ReportQueue[_0xf34d[142]]({where:{uniqueid:_0xbf49x1b[_0xf34d[119]]},order:_0xf34d[157],raw:true})[_0xf34d[92]](function(_0xbf49x2c){if(_0xbf49x2c){_0xbf49x28= _[_0xf34d[134]]({},_0xbf49x2c,{queuecallerleaveAt:moment()[_0xf34d[59]](_0xf34d[58]),holdtime:_0xbf49x1b[_0xf34d[77]],assigned:true,lastAssignedTo:_0xbf49x1b[_0xf34d[30]]});_0xbf49x16(_0xbf49x2c[_0xf34d[69]],_0xf34d[154],_0xbf49x28)};return ReportAgent[_0xf34d[142]]({where:{uniqueid:_0xbf49x1b[_0xf34d[119]],destuniqueid:_0xbf49x1b[_0xf34d[158]]},raw:true})})[_0xf34d[92]](function(_0xbf49x2c){if(_0xbf49x2c){_0xbf49x28= _[_0xf34d[134]]({},_0xbf49x2c,{lastevent:_0xf34d[164],agentconnectAt:moment()[_0xf34d[59]](_0xf34d[58]),holdtime:_0xbf49x1b[_0xf34d[77]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x2c[_0xf34d[30]]),_0xf34d[156],_0xbf49x28)};return ReportAgent[_0xf34d[97]]({where:{uniqueid:_0xbf49x1b[_0xf34d[119]],destuniqueid:{$ne:_0xbf49x1b[_0xf34d[158]]},reason:null},raw:true})})[_0xf34d[92]](function(_0xbf49x2e){if(_0xbf49x2e&& _0xbf49x2e[_0xf34d[68]]){_[_0xf34d[93]](_0xbf49x2e,function(_0xbf49x2c){_0xbf49x28= _[_0xf34d[134]]({},_0xbf49x2c,{lastevent:_0xf34d[165],agentringnoanswer:true,agentringnoanswerAt:_0xbf49x2b,reason:_0xf34d[165],answeredelsewheredestinationuniqueid:_0xbf49x1b[_0xf34d[158]],answeredelsewheremembername:_0xbf49x1b[_0xf34d[30]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x2c[_0xf34d[30]]),_0xf34d[156],_0xbf49x28)})};return User[_0xf34d[142]]({where:{name:_0xbf49x1b[_0xf34d[30]]},raw:true})})[_0xf34d[92]](function(_0xbf49x29){if(_0xbf49x29){var _0xbf49x28=_[_0xf34d[134]]({newValues:{id:_0xbf49x29[_0xf34d[132]],queueStatus:_0xf34d[164],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]}},_0xbf49x29,{queueStatus:_0xf34d[164],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x29[_0xf34d[136]],_0xbf49x29[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)};return User[_0xf34d[97]]({where:{lastQueue:_0xbf49x1b[_0xf34d[69]],name:{$ne:_0xbf49x1b[_0xf34d[30]]}},raw:true})})[_0xf34d[92]](function(_0xbf49x2d){if(_0xbf49x2d&& _0xbf49x2d[_0xf34d[68]]){_[_0xf34d[93]](_0xbf49x2d,function(_0xbf49x29){var _0xbf49x28=_[_0xf34d[134]]({newValues:{id:_0xbf49x29[_0xf34d[132]],queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b}},_0xbf49x29,{queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b});_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x29[_0xf34d[136]],_0xbf49x29[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)})}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[163],_0xbf49x1f)})}},agentringnoanswer:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20){triggers[_0xf34d[151]](_0xbf49x20)};var _0xbf49x28;var _0xbf49x2b=moment()[_0xf34d[59]](_0xf34d[58]);return User[_0xf34d[142]]({where:{name:_0xbf49x1b[_0xf34d[30]]},raw:true})[_0xf34d[92]](function(_0xbf49x29){if(_0xbf49x29){var _0xbf49x28=_[_0xf34d[134]]({newValues:{id:_0xbf49x29[_0xf34d[132]],queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]}},_0xbf49x29,{queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x29[_0xf34d[136]],_0xbf49x29[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)};return ReportAgent[_0xf34d[142]]({where:{uniqueid:_0xbf49x1b[_0xf34d[119]],destuniqueid:_0xbf49x1b[_0xf34d[158]]},raw:true})})[_0xf34d[92]](function(_0xbf49x2c){if(_0xbf49x2c){_0xbf49x28= _[_0xf34d[134]]({},_0xbf49x2c,{lastevent:_0xf34d[167],agentringnoanswer:true,agentringnoanswerAt:moment()[_0xf34d[59]](_0xf34d[58]),reason:_0xf34d[167]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x2c[_0xf34d[30]]),_0xf34d[156],_0xbf49x28)}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[166],_0xbf49x1f)})}},queuememberadded:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20){_0xbf49x16(_0xbf49x20[_0xf34d[69]],_0xf34d[168],_0xbf49x20);_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x20.UserId),_0xf34d[168],_0xbf49x20)};return BPromise[_0xf34d[114]]()}},queuememberremoved:function(_0xbf49x1b){return function(_0xbf49x20){if(params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]]){delete params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[115]][_0xbf49x1b[_0xf34d[30]]]};return User[_0xf34d[142]]({where:{name:_0xbf49x1b[_0xf34d[32]][_0xf34d[140]](_0xf34d[138],_0xf34d[139])},raw:true})[_0xf34d[92]](function(_0xbf49x29){if(_0xbf49x29){_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[170],{queue:_0xbf49x1b[_0xf34d[69]],UserId:_0xbf49x29[_0xf34d[132]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x29[_0xf34d[132]]),_0xf34d[170],{queue:_0xbf49x1b[_0xf34d[69]],UserId:_0xbf49x29[_0xf34d[132]]})}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[169],_0xbf49x1f)})}},queuememberpause:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20){_0xbf49x16(_0xbf49x20[_0xf34d[69]],_0xf34d[168],_0xbf49x20);_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x20.UserId),_0xf34d[168],_0xbf49x20)};if(parseInt(_0xbf49x1b[_0xf34d[60]],10)){var _0xbf49x28;var _0xbf49x2b=moment()[_0xf34d[59]](_0xf34d[58]);return User[_0xf34d[142]]({where:{name:_0xbf49x1b[_0xf34d[30]]},raw:true})[_0xf34d[92]](function(_0xbf49x29){if(_0xbf49x29){var _0xbf49x2f={id:_0xbf49x29[_0xf34d[132]],voicePause:false};_[_0xf34d[172]](_0xbf49x2f,{voicePause:true,chatPause:true,mailPause:true,faxPause:true,smsPause:true,openchannelPause:true,pauseType:_0xbf49x1b[_0xf34d[155]],lastPauseAt:_0xbf49x2b});var _0xbf49x28=_[_0xf34d[134]]({newValues:_0xbf49x2f},_0xbf49x29,_0xbf49x2f);_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x29[_0xf34d[136]],_0xbf49x29[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[171],_0xbf49x1f)})}}},queuememberpenalty:function(_0xbf49x1b){return function(_0xbf49x20){return BPromise[_0xf34d[114]]()}},queuememberringinuse:function(_0xbf49x1b){return function(_0xbf49x20){return BPromise[_0xf34d[114]]()}},queuemember:function(_0xbf49x1b){return function(_0xbf49x20){_0xbf49x1a(_0xbf49x1b);_0xbf49x1c(_0xbf49x1b[_0xf34d[69]]);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[115]][_0xbf49x1b[_0xf34d[31]]]= _0xbf49x1b;return BPromise[_0xf34d[114]]()}},queuecallerjoin:function(_0xbf49x1b){return function(_0xbf49x20){if(!params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]]){params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]]= {};params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[72]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[74]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[87]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[89]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[77]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[78]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[83]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[85]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[90]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[91]]= 0;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[70]]= 0};params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]= {channel:_0xbf49x1b[_0xf34d[125]],channelstate:Number(_0xbf49x1b[_0xf34d[173]]),channelstatedesc:_0xbf49x1b[_0xf34d[174]],calleridnum:_0xbf49x1b[_0xf34d[175]],calleridname:_0xbf49x1b[_0xf34d[176]],exten:_0xbf49x1b[_0xf34d[177]],priority:Number(_0xbf49x1b[_0xf34d[178]]),uniqueid:_0xbf49x1b[_0xf34d[119]],queue:_0xbf49x1b[_0xf34d[69]],position:Number(_0xbf49x1b[_0xf34d[179]]),count:Number(_0xbf49x1b[_0xf34d[180]])};params[_0xf34d[62]][_0xf34d[63]][_0xf34d[72]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[72]]++;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[70],amount:1,queue:_0xbf49x1b[_0xf34d[69]]});params[_0xf34d[62]][_0xf34d[63]][_0xf34d[70]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[70]]++;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[72],amount:1,queue:_0xbf49x1b[_0xf34d[69]]});if(_0xbf49x20){_0xbf49x16(_0xbf49x20[_0xf34d[69]],_0xf34d[181],_0xbf49x20)};return BPromise[_0xf34d[114]]()}},queuecallerabandon:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20&& _0xbf49x20[_0xf34d[182]]&& _0xbf49x20[_0xf34d[182]][0]){_[_0xf34d[93]](_0xbf49x20[_0xf34d[182]][1],function(_0xbf49x2c){_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x2c[_0xf34d[30]]),_0xf34d[156],_0xbf49x2c)})};if(_0xbf49x20&& _0xbf49x20[_0xf34d[183]]){_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[154],_0xbf49x20[_0xf34d[183]]);_0xbf49x20[_0xf34d[183]][_0xf34d[185]][_0xf34d[184]]= _0xf34d[87];_0xbf49x20[_0xf34d[183]][_0xf34d[186]][_0xf34d[184]]= true;triggers[_0xf34d[151]](_0xbf49x20[_0xf34d[183]])};var _0xbf49x28;var _0xbf49x2b=moment()[_0xf34d[59]](_0xf34d[58]);if(params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[72]]){params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[72]]--;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[72],amount:-1,queue:_0xbf49x1b[_0xf34d[69]]})};if(params[_0xf34d[62]][_0xf34d[63]][_0xf34d[72]]){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[72]]--};if(params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]){params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[77]]= Number(_0xbf49x1b[_0xf34d[77]]);params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[179]]= Number(_0xbf49x1b[_0xf34d[179]]);params[_0xf34d[62]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[187]]= Number(_0xbf49x1b[_0xf34d[187]])};params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]]++;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[87]]++;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[188],amount:1,queue:_0xbf49x1b[_0xf34d[69]]});params[_0xf34d[62]][_0xf34d[63]][_0xf34d[90]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]/ (params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[63]][_0xf34d[91]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]]/ (params[_0xf34d[62]][_0xf34d[63]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[63]][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[90]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]/ (params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[87]])* 100,2);params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[91]]= _[_0xf34d[84]](params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[87]]/ (params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[76]]+ params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[87]])* 100,2);return User[_0xf34d[97]]({where:{lastQueue:_0xbf49x1b[_0xf34d[69]]},raw:true})[_0xf34d[92]](function(_0xbf49x30){if(_0xbf49x30&& _0xbf49x30[_0xf34d[68]]){var _0xbf49x28;_[_0xf34d[93]](_0xbf49x30,function(_0xbf49x31){_0xbf49x28= _[_0xf34d[134]]({newValues:{id:_0xbf49x31[_0xf34d[132]],queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]}},_0xbf49x31,{id:_0xbf49x31[_0xf34d[132]],queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x31[_0xf34d[136]],_0xbf49x31[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)})}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[189],_0xbf49x1f)})}},blindtransfer:function(_0xbf49x1b){return function(_0xbf49x20){_0xbf49x16(null,_0xbf49x1b[_0xf34d[26]][_0xf34d[190]](),_0xbf49x1b);return BPromise[_0xf34d[114]]()}},attendedtransfer:function(_0xbf49x1b){return function(_0xbf49x20){_0xbf49x16(null,_0xbf49x1b[_0xf34d[26]][_0xf34d[190]](),_0xbf49x1b);return BPromise[_0xf34d[114]]()}},dialbegin:function(_0xbf49x1b){return function(_0xbf49x20){params[_0xf34d[98]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]= {channel:_0xbf49x1b[_0xf34d[125]],channelstate:Number(_0xbf49x1b[_0xf34d[173]]),channelstatedesc:_0xbf49x1b[_0xf34d[174]],calleridnum:_0xbf49x1b[_0xf34d[175]],calleridname:_0xbf49x1b[_0xf34d[176]],context:_0xbf49x1b[_0xf34d[191]],exten:_0xbf49x1b[_0xf34d[177]],priority:Number(_0xbf49x1b[_0xf34d[178]]),dialstring:_0xbf49x1b[_0xf34d[192]]};if(_0xbf49x1b[_0xf34d[125]]){var _0xbf49x28=_[_0xf34d[172]](_0xbf49x1b,{starttime:moment()[_0xf34d[59]](_0xf34d[58]),lastevent:_0xf34d[150],updatedAt:moment()[_0xf34d[59]](_0xf34d[58])});_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x1b[_0xf34d[125]][_0xf34d[124]](/\/|-/)[1]),_0xf34d[193],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[126],_[_0xf34d[172]](_0xbf49x28,{role:_0xf34d[128]}));_0xbf49x16(_0xf34d[127],_0xf34d[126],_0xbf49x28,_[_0xf34d[172]](_0xbf49x28,{role:_0xf34d[127]}));if(_0xbf49x20){triggers[_0xf34d[129]](_0xbf49x20)}};return BPromise[_0xf34d[114]]()}},dialend:function(_0xbf49x1b){return function(_0xbf49x20){if(params[_0xf34d[98]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]]){params[_0xf34d[98]][_0xf34d[120]][_0xbf49x1b[_0xf34d[119]]][_0xf34d[194]]= _0xbf49x1b[_0xf34d[194]]};if(_0xbf49x1b[_0xf34d[125]]){var _0xbf49x2b=moment()[_0xf34d[59]](_0xf34d[58]);var _0xbf49x28={dialstatus:_0xbf49x1b[_0xf34d[194]],lastevent:(_0xbf49x1b[_0xf34d[194]]=== _0xf34d[103])?_0xf34d[164]:_0xf34d[122],answertime:(_0xbf49x1b[_0xf34d[194]]=== _0xf34d[103])?_0xbf49x2b:null,uniqueid:_0xbf49x1b[_0xf34d[119]],linkedid:_0xbf49x1b[_0xf34d[121]],destuniqueid:_0xbf49x1b[_0xf34d[158]],destlinkedid:_0xbf49x1b[_0xf34d[195]],updatedAt:_0xbf49x2b};_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x1b[_0xf34d[125]][_0xf34d[124]](/\/|-/)[1]),_0xf34d[126],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[126],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[126],_0xbf49x28);if(_0xbf49x20){triggers[_0xf34d[129]](_0xbf49x20)}};return BPromise[_0xf34d[114]]()}},varset:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x1b[_0xf34d[197]][_0xf34d[55]](_0xf34d[196])){_0xbf49x16(_0xf34d[128],_0xf34d[193],{uniqueid:_0xbf49x1b[_0xf34d[119]],routeId:_0xbf49x1b[_0xf34d[198]],updatedAt:moment()[_0xf34d[59]](_0xf34d[58])});_0xbf49x16(_0xf34d[127],_0xf34d[193],{uniqueid:_0xbf49x1b[_0xf34d[119]],routeId:_0xbf49x1b[_0xf34d[198]],updatedAt:moment()[_0xf34d[59]](_0xf34d[58])})};if(_0xbf49x1b){triggers[_0xf34d[199]](_0xbf49x1b)};return BPromise[_0xf34d[114]]()}},queuecallerunmanaged:function(_0xbf49x1b){return function(_0xbf49x20){if(_0xbf49x20){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[89]]+= 1;params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[89]]+= 1;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[89],amount:1,queue:_0xbf49x1b[_0xf34d[69]]});if(params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[72]]){params[_0xf34d[62]][_0xf34d[61]][_0xbf49x1b[_0xf34d[69]]][_0xf34d[72]]-= 1};if(params[_0xf34d[62]][_0xf34d[63]][_0xf34d[72]]){params[_0xf34d[62]][_0xf34d[63]][_0xf34d[72]]-= 1;_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[152],{type:_0xf34d[72],amount:-1,queue:_0xbf49x1b[_0xf34d[69]]})};_0xbf49x16(_0xbf49x1b[_0xf34d[69]],_0xf34d[154],_0xbf49x20);var _0xbf49x2b=moment()[_0xf34d[59]](_0xf34d[58]);return User[_0xf34d[97]]({where:{lastQueue:_0xbf49x1b[_0xf34d[69]]},raw:true})[_0xf34d[92]](function(_0xbf49x30){if(_0xbf49x30&& _0xbf49x30[_0xf34d[68]]){var _0xbf49x28;_[_0xf34d[93]](_0xbf49x30,function(_0xbf49x31){_0xbf49x28= _[_0xf34d[134]]({newValues:{id:_0xbf49x31[_0xf34d[132]],queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]}},_0xbf49x31,{id:_0xbf49x31[_0xf34d[132]],queueStatus:_0xf34d[122],queueStatusAt:_0xbf49x2b,lastQueue:_0xbf49x1b[_0xf34d[69]]});_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x31[_0xf34d[136]],_0xbf49x31[_0xf34d[132]]),_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x28);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x28)})}})[_0xf34d[67]](function(_0xbf49x1f){logger[_0xf34d[66]](_0xf34d[189],_0xbf49x1f)})}}},agentUpdate:function(_0xbf49x31){return function(){_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x31[_0xf34d[132]]),_0xf34d[137],_0xbf49x31);_0xbf49x16(_0xf34d[128],_0xf34d[137],_0xbf49x31);_0xbf49x16(_0xf34d[127],_0xf34d[137],_0xbf49x31)}},console:function(_0xbf49x32){_0xbf49x16(_0xbf49x32[_0xf34d[200]],util[_0xf34d[59]](_0xf34d[201],_0xbf49x32[_0xf34d[113]]),_0xbf49x32[_0xf34d[202]])},realtimeQueueMembers:function(_0xbf49x33){return function(){_[_0xf34d[204]](params[_0xf34d[62]][_0xf34d[61]],function(_0xbf49x1d,_0xbf49x22){if(_[_0xf34d[203]](_0xbf49x33,_0xbf49x22)){_[_0xf34d[204]](_0xbf49x1d[_0xf34d[115]],function(_0xbf49x31){_0xbf49x16(_0xbf49x22,_0xf34d[168],_0xbf49x31)})}})}},updateTriggers:function(_0xbf49x32){return function(){return triggers[_0xf34d[205]](_0xbf49x32)}},queueAdd:function(_0xbf49x34,_0xbf49x35){return function(){if(_0xbf49x34&& _0xbf49x35){_[_0xf34d[93]](_0xbf49x34,function(_0xbf49x20){_0xbf49x16(null,util[_0xf34d[59]](_0xf34d[206],_0xbf49x35),_0xbf49x20[0])})}}},queueRemove:function(_0xbf49x20,_0xbf49x35){return function(){if(_0xbf49x20&& _0xbf49x35){_0xbf49x16(null,util[_0xf34d[59]](_0xf34d[207],_0xbf49x35),_0xbf49x20)}}},checkTriggers:function(_0xbf49x32){return function(){return triggers[_0xf34d[208]](_0xbf49x32)}},inboundInit:function(){return function(){return BPromise[_0xf34d[114]]()[_0xf34d[92]](_0xbf49x1e())}},outboundInit:function(){return function(){return BPromise[_0xf34d[114]]()[_0xf34d[92]](_0xbf49x25())}},reportFaxUpdate:function(_0xbf49x36){return function(){_0xbf49x16(util[_0xf34d[59]](_0xf34d[123],_0xbf49x36[_0xf34d[209]]),_0xf34d[137],_0xbf49x36);_0xbf49x16(_0xf34d[127],_0xf34d[210],_0xbf49x36)}},widgetValues:function(_0xbf49x37,_0xbf49x29){return function(){_[_0xf34d[204]](_0xbf49x37,function(_0xbf49x38,_0xbf49x39){_0xbf49x16(util[_0xf34d[59]](_0xf34d[135],_0xbf49x29[_0xf34d[136]],_0xbf49x29[_0xf34d[132]]),_0xf34d[211]+ _0xbf49x39,_0xbf49x38)})}}}}