36eee90bbeb29aa24f26354b9551251bd360ce08
[motion.git] / server / config / ami / socket.js
1 var _0xe4bc=["\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","\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","\x64\x65\x76\x69\x63\x65\x73\x74\x61\x74\x65\x63\x68\x61\x6E\x67\x65","\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","\x65\x78\x74\x72\x61\x76\x61\x72","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\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","\x61\x67\x65\x6E\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","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65","\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\x67\x65\x6E\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","\x61\x67\x65\x6E\x74\x72\x69\x6E\x67\x6E\x6F\x61\x6E\x73\x77\x65\x72","\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","\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","\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","\x6D\x65\x72\x67\x65","\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","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x75\x6E\x6D\x61\x6E\x61\x67\x65\x64","\x61\x67\x65\x6E\x74\x75\x70\x64\x61\x74\x65","\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","\x76\x69\x64\x65\x6F\x4F\x6E","\x72\x65\x70\x6F\x72\x74\x66\x61\x78\x75\x70\x64\x61\x74\x65","\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","\x72\x65\x63\x65\x69\x76\x65\x66\x61\x78","\x72\x65\x70\x6F\x72\x74\x71\x75\x65\x75\x65\x75\x70\x64\x61\x74\x65"];_0xe4bc[0];var _=require(_0xe4bc[1]);var util=require(_0xe4bc[2]);var moment=require(_0xe4bc[3]);var BPromise=require(_0xe4bc[4]);var redis=require(_0xe4bc[5]);var VoiceQueue=require(_0xe4bc[7])[_0xe4bc[6]];var ReportQueue=require(_0xe4bc[7])[_0xe4bc[8]];var ReportCall=require(_0xe4bc[7])[_0xe4bc[9]];var ReportAgent=require(_0xe4bc[7])[_0xe4bc[10]];var ReportDial=require(_0xe4bc[7])[_0xe4bc[11]];var ReportMember=require(_0xe4bc[7])[_0xe4bc[12]];var User=require(_0xe4bc[7])[_0xe4bc[13]];var Triggers=require(_0xe4bc[14]);var config=require(_0xe4bc[15]);var logger=require(_0xe4bc[17])(_0xe4bc[16]);var utils=require(_0xe4bc[18]);var redisConf;if(config[_0xe4bc[19]]){redisConf= {password:config[_0xe4bc[19]]}};var redisClient=redis[_0xe4bc[21]](6379,config[_0xe4bc[20]],redisConf);var io=require(_0xe4bc[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[_0xe4bc[23]]= function(){var _0x11f2x16=function(_0x11f2x17,_0x11f2x18,_0x11f2x19){if(_0x11f2x17){io[_0xe4bc[25]](_0x11f2x17)[_0xe4bc[24]](_0x11f2x18,_0x11f2x19)}else {io[_0xe4bc[24]](_0x11f2x18,_0x11f2x19)}};var _0x11f2x1a=function(_0x11f2x1b){delete _0x11f2x1b[_0xe4bc[26]];delete _0x11f2x1b[_0xe4bc[27]];delete _0x11f2x1b[_0xe4bc[28]];delete _0x11f2x1b[_0xe4bc[29]];_0x11f2x1b[_0xe4bc[30]]= _0x11f2x1b[_0xe4bc[31]]|| _0x11f2x1b[_0xe4bc[30]];_0x11f2x1b[_0xe4bc[32]]= _0x11f2x1b[_0xe4bc[33]];_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[35];switch(_0x11f2x1b[_0xe4bc[53]]){case _0xe4bc[36]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[35];break;case _0xe4bc[38]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[37];break;case _0xe4bc[40]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[39];break;case _0xe4bc[42]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[41];break;case _0xe4bc[44]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[43];break;case _0xe4bc[46]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[45];break;case _0xe4bc[48]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[47];break;case _0xe4bc[50]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[49];break;case _0xe4bc[52]:_0x11f2x1b[_0xe4bc[34]]= _0xe4bc[51];break;default:};_0x11f2x1b[_0xe4bc[53]]= Number(_0x11f2x1b[_0xe4bc[53]]);if(_0x11f2x1b[_0xe4bc[55]](_0xe4bc[54])){_0x11f2x1b[_0xe4bc[54]]= Number(_0x11f2x1b[_0xe4bc[54]])};if(_0x11f2x1b[_0xe4bc[55]](_0xe4bc[56])){_0x11f2x1b[_0xe4bc[56]]= Number(_0x11f2x1b[_0xe4bc[56]])};if(_0x11f2x1b[_0xe4bc[55]](_0xe4bc[57])){if(_0x11f2x1b[_0xe4bc[57]]=== _0xe4bc[36]){_0x11f2x1b[_0xe4bc[57]]= null}else {_0x11f2x1b[_0xe4bc[57]]= moment()[_0xe4bc[59]](_0xe4bc[58])}};_0x11f2x1b[_0xe4bc[60]]= parseInt(_0x11f2x1b[_0xe4bc[60]],10)?true:false};function _0x11f2x1c(_0x11f2x1d){if(!params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1d]){params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1d]= {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 _0x11f2x1e(){return function(){params[_0xe4bc[62]][_0xe4bc[61]]= {};params[_0xe4bc[62]][_0xe4bc[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[_0xe4bc[97]]({attributes:[_0xe4bc[31]],raw:true})[_0xe4bc[92]](function(_0x11f2x20){if(_0x11f2x20){_[_0xe4bc[93]](_0x11f2x20,function(_0x11f2x1d){_0x11f2x1c(_0x11f2x1d[_0xe4bc[31]])});return ReportQueue[_0xe4bc[97]]({attributes:[_0xe4bc[69],_0xe4bc[79],_0xe4bc[82],_0xe4bc[94],_0xe4bc[95],_0xe4bc[96],_0xe4bc[77]],raw:true})}})[_0xe4bc[92]](function(_0x11f2x20){if(_0x11f2x20){var _0x11f2x21;var _0x11f2x22;var _0x11f2x23=_0x11f2x20[_0xe4bc[68]];for(var _0x11f2x24=0;_0x11f2x24< _0x11f2x23;_0x11f2x24++){_0x11f2x21= _0x11f2x20[_0x11f2x24];_0x11f2x22= _0x11f2x21[_0xe4bc[69]];_0x11f2x1c(_0x11f2x22);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[70]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[70]]++;if(utils[_0xe4bc[71]](_0x11f2x21)){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[72]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[72]]++};if(utils[_0xe4bc[73]](_0x11f2x21)){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[74]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[74]]++};if(utils[_0xe4bc[75]](_0x11f2x21)){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[76]]++;params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[77]]+= _0x11f2x21[_0xe4bc[77]]|| 0;params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[78]]+= moment(_0x11f2x21[_0xe4bc[82]])[_0xe4bc[81]](moment(_0x11f2x21[_0xe4bc[79]]),_0xe4bc[80]);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[83]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[77]]/ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[76]]);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[85]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[78]]/ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[76]]);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[77]]+= _0x11f2x21[_0xe4bc[77]]|| 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[78]]+= moment(_0x11f2x21[_0xe4bc[82]])[_0xe4bc[81]](moment(_0x11f2x21[_0xe4bc[79]]),_0xe4bc[80]);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[83]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[77]]/ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[76]]);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[85]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[78]]/ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[76]])};if(utils[_0xe4bc[86]](_0x11f2x21)){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[87]]++};if(utils[_0xe4bc[88]](_0x11f2x21)){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[89]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[89]]++};params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[90]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[76]]/ (params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[91]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[87]]/ (params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x22][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[90]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]/ (params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[91]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]]/ (params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]])* 100,2)}}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[64],_0x11f2x1f[_0xe4bc[65]])})}}function _0x11f2x25(){return function(){params[_0xe4bc[98]][_0xe4bc[63]]= {total:0,answered:0,sumDuration:0,avgDuration:0,tigerdial:0,answerRate:0};return ReportCall[_0xe4bc[97]]({where:{type:[_0xe4bc[98],_0xe4bc[101]],createdAt:{$gte:moment()[_0xe4bc[111]](_0xe4bc[110])}},attributes:[_0xe4bc[112],_0xe4bc[104],_0xe4bc[107]],raw:true})[_0xe4bc[92]](function(_0x11f2x20){if(_0x11f2x20){var _0x11f2x26=_[_0xe4bc[100]](_0x11f2x20,{type:_0xe4bc[98]});var _0x11f2x27=_[_0xe4bc[100]](_0x11f2x20,{type:_0xe4bc[101]});if(_0x11f2x26[_0xe4bc[68]]){params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[70]]= _0x11f2x26[_0xe4bc[68]];params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[102]]= _[_0xe4bc[105]](_0x11f2x26,_0xe4bc[104])[_0xe4bc[103]]|| 0;params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[106]]= _[_0xe4bc[108]](_0x11f2x26,_0xe4bc[107]);if(params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[102]]){params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[109]]= _[_0xe4bc[84]]((_[_0xe4bc[108]](_0x11f2x26,_0xe4bc[107])/ params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[102]]));params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[90]]= _[_0xe4bc[84]](params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[102]]/ params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[70]]* 100,1)}};if(_0x11f2x27[_0xe4bc[68]]){params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[101]]= _0x11f2x27[_0xe4bc[68]]}}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[99],_0x11f2x1f[_0xe4bc[65]])})}}BPromise[_0xe4bc[113]]()[_0xe4bc[92]](_0x11f2x1e())[_0xe4bc[92]](_0x11f2x25());return {cdr:function(_0x11f2x1b){return function(_0x11f2x20){_0x11f2x16(_0xe4bc[114],_0xe4bc[115],_0x11f2x1b);if(_0x11f2x1b[_0xe4bc[112]]== _0xe4bc[98]|| _0x11f2x1b[_0xe4bc[112]]== _0xe4bc[101]){if(_0x11f2x1b[_0xe4bc[112]]== _0xe4bc[98]){params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[70]]++;_0x11f2x1b[_0xe4bc[104]]== _0xe4bc[103]&& (params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[102]]++);params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[106]]+= Number(_0x11f2x1b[_0xe4bc[107]]);if(params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[102]]){params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[109]]= _[_0xe4bc[84]](params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[106]]/ params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[102]]);params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[90]]= _[_0xe4bc[84]](params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[102]]/ params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[70]]* 100,1)}}else {params[_0xe4bc[98]][_0xe4bc[63]][_0xe4bc[101]]++};_0x11f2x16(_0xe4bc[116],_0xe4bc[117],params[_0xe4bc[98]][_0xe4bc[63]])}}},send:function(_0x11f2x1b){return function(_0x11f2x20){return BPromise[_0xe4bc[113]]()}},hangup:function(_0x11f2x1b){return function(_0x11f2x20){if(params[_0xe4bc[98]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]){delete params[_0xe4bc[98]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]};if(params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]){delete params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]};var _0x11f2x28={uniqueid:_0x11f2x1b[_0xe4bc[118]],linkedid:_0x11f2x1b[_0xe4bc[120]],endtime:moment()[_0xe4bc[59]](_0xe4bc[58]),lastevent:_0xe4bc[121],updatedAt:moment()[_0xe4bc[59]](_0xe4bc[58])};_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x1b[_0xe4bc[124]][_0xe4bc[123]](/\/|-/)[1]),_0xe4bc[125],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[125],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[125],_0x11f2x28);if(_0x11f2x20){triggers[_0xe4bc[128]](_0x11f2x20)};return BPromise[_0xe4bc[113]]()}},devicestatechange:function(_0x11f2x1b){return function(_0x11f2x20){return User[_0xe4bc[142]]({where:{name:_0x11f2x1b[_0xe4bc[141]][_0xe4bc[140]](_0xe4bc[138],_0xe4bc[139])},raw:true})[_0xe4bc[92]](function(_0x11f2x29){if(_0x11f2x29){var _0x11f2x28=_[_0xe4bc[133]]({newValues:{id:_0x11f2x29[_0xe4bc[131]],status:_0x11f2x1b[_0xe4bc[132]],statusAt:moment()[_0xe4bc[59]](_0xe4bc[58])}},_0x11f2x29,{status:_0x11f2x1b[_0xe4bc[132]],statusAt:moment()[_0xe4bc[59]](_0xe4bc[58])});_0x11f2x28[_0xe4bc[26]]= _0xe4bc[134];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x29[_0xe4bc[136]],_0x11f2x29[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x28)}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[130]](_0xe4bc[129],_0x11f2x1f)})}},peerstatus:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20&& _0x11f2x20[0]){_[_0xe4bc[93]](_0x11f2x20[1],function(_0x11f2x2a){if(!params[_0xe4bc[143]][_0x11f2x2a[_0xe4bc[31]]]){params[_0xe4bc[143]][_0x11f2x2a[_0xe4bc[31]]]= {name:_0x11f2x2a[_0xe4bc[31]]}};params[_0xe4bc[143]][_0x11f2x2a[_0xe4bc[31]]][_0xe4bc[144]]= _0x11f2x1b[_0xe4bc[144]];_0x11f2x16(_0xe4bc[145],_0xe4bc[146],params[_0xe4bc[143]][_0x11f2x2a[_0xe4bc[31]]])})};return BPromise[_0xe4bc[113]]()}},registry:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20&& _0x11f2x20[0]){_[_0xe4bc[93]](_0x11f2x20[1],function(_0x11f2x2a){if(!params[_0xe4bc[143]][_0x11f2x2a[_0xe4bc[31]]]){params[_0xe4bc[143]][_0x11f2x2a[_0xe4bc[31]]]= {name:_0x11f2x2a[_0xe4bc[31]]}};params[_0xe4bc[143]][_0x11f2x2a[_0xe4bc[31]]][_0xe4bc[53]]= _0x11f2x1b[_0xe4bc[53]];_0x11f2x16(_0xe4bc[145],_0xe4bc[146],params[_0xe4bc[143]][_0x11f2x2a[_0xe4bc[31]]])})};return BPromise[_0xe4bc[113]]()}},agentcalled:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20){_0x11f2x1b[_0xe4bc[147]]&& (_0x11f2x20[_0xe4bc[148]][_0xe4bc[147]]= _0x11f2x1b[_0xe4bc[147]]);_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x20[_0xe4bc[30]]),_0xe4bc[149],_0x11f2x20);triggers[_0xe4bc[150]](_0x11f2x20)};return User[_0xe4bc[142]]({where:{name:_0x11f2x1b[_0xe4bc[30]],voicePause:false},raw:true})[_0xe4bc[92]](function(_0x11f2x29){if(_0x11f2x29){var _0x11f2x2b=moment()[_0xe4bc[59]](_0xe4bc[58]);var _0x11f2x28=_[_0xe4bc[133]]({newValues:{id:_0x11f2x29[_0xe4bc[131]],queueStatus:_0xe4bc[152],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]}},_0x11f2x29,{queueStatus:_0xe4bc[152],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]});_0x11f2x28[_0xe4bc[26]]= _0xe4bc[153];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x29[_0xe4bc[136]],_0x11f2x29[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x28)}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[151],_0x11f2x1f)})}},agentcomplete:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20){triggers[_0xe4bc[154]](_0x11f2x20)};if(params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[74]]){params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[74]]--};if(params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[74]]){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[74]]--;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[74],amount:-1,queue:_0x11f2x1b[_0xe4bc[69]]})};params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]++;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[121],amount:1,queue:_0x11f2x1b[_0xe4bc[69]]});params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[90]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]/ (params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[91]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]]/ (params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[90]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]/ (params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[91]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[87]]/ (params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[78]]+= Number(_0x11f2x1b[_0xe4bc[78]]);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[78]]+= Number(_0x11f2x1b[_0xe4bc[78]]);_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[78],amount:Number(_0x11f2x1b[_0xe4bc[78]]),queue:_0x11f2x1b[_0xe4bc[69]]});params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[85]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[78]]/ params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[85]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[78]]/ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[77]]+= Number(_0x11f2x1b[_0xe4bc[77]]);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[77]]+= Number(_0x11f2x1b[_0xe4bc[77]]);_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[77],amount:Number(_0x11f2x1b[_0xe4bc[77]]),queue:_0x11f2x1b[_0xe4bc[69]]});params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[83]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[77]]/ params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[83]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[77]]/ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]);var _0x11f2x28;var _0x11f2x2b=moment()[_0xe4bc[59]](_0xe4bc[58]);return ReportAgent[_0xe4bc[142]]({where:{uniqueid:_0x11f2x1b[_0xe4bc[118]],destuniqueid:_0x11f2x1b[_0xe4bc[162]]},raw:true})[_0xe4bc[92]](function(_0x11f2x2c){if(_0x11f2x2c){_0x11f2x28= _[_0xe4bc[133]]({},_0x11f2x2c,{lastevent:_0xe4bc[121],agentcomplete:true,agentcompleteAt:_0x11f2x2b,talktime:Number(_0x11f2x1b[_0xe4bc[78]]),reason:_0x11f2x1b[_0xe4bc[159]]});_0x11f2x1b[_0xe4bc[147]]&& (_0x11f2x28[_0xe4bc[147]]= _0x11f2x1b[_0xe4bc[147]]);_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x2c[_0xe4bc[30]]),_0xe4bc[160],_0x11f2x28)};return ReportQueue[_0xe4bc[142]]({where:{uniqueid:_0x11f2x1b[_0xe4bc[118]]},order:_0xe4bc[161],raw:true})})[_0xe4bc[92]](function(_0x11f2x2c){if(_0x11f2x2c){_0x11f2x28= _[_0xe4bc[133]]({},_0x11f2x2c,{queuecallercomplete:true,queuecallercompleteAt:_0x11f2x2b});_0x11f2x16(_0x11f2x2c[_0xe4bc[69]],_0xe4bc[158],_0x11f2x28)};return User[_0xe4bc[142]]({where:{name:_0x11f2x1b[_0xe4bc[30]]},raw:true})})[_0xe4bc[92]](function(_0x11f2x29){if(_0x11f2x29){var _0x11f2x28=_[_0xe4bc[133]]({newValues:{id:_0x11f2x29[_0xe4bc[131]],queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]}},_0x11f2x29,{queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]});_0x11f2x28[_0xe4bc[26]]= _0xe4bc[157];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x29[_0xe4bc[136]],_0x11f2x29[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x28)}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[156],_0x11f2x1f)})}},agentconnect:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20){triggers[_0xe4bc[154]](_0x11f2x20)};if(params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[72]]){params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[72]]--;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[72],amount:-1,queue:_0x11f2x1b[_0xe4bc[69]]})};if(params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[72]]){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[72]]--};if(params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]){params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[163]]= _0x11f2x1b[_0xe4bc[164]];params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[165]]= _0x11f2x1b[_0xe4bc[165]];params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[77]]= Number(_0x11f2x1b[_0xe4bc[77]]);params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[166]]= Number(_0x11f2x1b[_0xe4bc[166]]);params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[32]]= _0x11f2x1b[_0xe4bc[32]];params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[30]]= _0x11f2x1b[_0xe4bc[30]]};params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[74]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[74]]++;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[74],amount:1,queue:_0x11f2x1b[_0xe4bc[69]]});var _0x11f2x28;var _0x11f2x2b=moment()[_0xe4bc[59]](_0xe4bc[58]);return ReportQueue[_0xe4bc[142]]({where:{uniqueid:_0x11f2x1b[_0xe4bc[118]]},order:_0xe4bc[161],raw:true})[_0xe4bc[92]](function(_0x11f2x2c){if(_0x11f2x2c){_0x11f2x28= _[_0xe4bc[133]]({},_0x11f2x2c,{queuecallerleaveAt:moment()[_0xe4bc[59]](_0xe4bc[58]),holdtime:_0x11f2x1b[_0xe4bc[77]],assigned:true,lastAssignedTo:_0x11f2x1b[_0xe4bc[30]]});_0x11f2x16(_0x11f2x2c[_0xe4bc[69]],_0xe4bc[158],_0x11f2x28)};return ReportAgent[_0xe4bc[142]]({where:{uniqueid:_0x11f2x1b[_0xe4bc[118]],destuniqueid:_0x11f2x1b[_0xe4bc[162]]},raw:true})})[_0xe4bc[92]](function(_0x11f2x2c){if(_0x11f2x2c){_0x11f2x28= _[_0xe4bc[133]]({},_0x11f2x2c,{lastevent:_0xe4bc[168],agentconnectAt:moment()[_0xe4bc[59]](_0xe4bc[58]),holdtime:_0x11f2x1b[_0xe4bc[77]]});_0x11f2x1b[_0xe4bc[147]]&& (_0x11f2x28[_0xe4bc[147]]= _0x11f2x1b[_0xe4bc[147]]);_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x2c[_0xe4bc[30]]),_0xe4bc[160],_0x11f2x28)};return ReportAgent[_0xe4bc[97]]({where:{uniqueid:_0x11f2x1b[_0xe4bc[118]],destuniqueid:{$ne:_0x11f2x1b[_0xe4bc[162]]},reason:null},raw:true})})[_0xe4bc[92]](function(_0x11f2x2e){if(_0x11f2x2e&& _0x11f2x2e[_0xe4bc[68]]){_[_0xe4bc[93]](_0x11f2x2e,function(_0x11f2x2c){_0x11f2x28= _[_0xe4bc[133]]({},_0x11f2x2c,{lastevent:_0xe4bc[170],agentringnoanswer:true,agentringnoanswerAt:_0x11f2x2b,reason:_0xe4bc[170],answeredelsewheredestinationuniqueid:_0x11f2x1b[_0xe4bc[162]],answeredelsewheremembername:_0x11f2x1b[_0xe4bc[30]]});_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x2c[_0xe4bc[30]]),_0xe4bc[160],_0x11f2x28)})};return User[_0xe4bc[142]]({where:{name:_0x11f2x1b[_0xe4bc[30]]},raw:true})})[_0xe4bc[92]](function(_0x11f2x29){if(_0x11f2x29){var _0x11f2x28=_[_0xe4bc[133]]({newValues:{id:_0x11f2x29[_0xe4bc[131]],queueStatus:_0xe4bc[168],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]}},_0x11f2x29,{queueStatus:_0xe4bc[168],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]});_0x11f2x28[_0xe4bc[26]]= _0xe4bc[169];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x29[_0xe4bc[136]],_0x11f2x29[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x28)};return User[_0xe4bc[97]]({where:{lastQueue:_0x11f2x1b[_0xe4bc[69]],name:{$ne:_0x11f2x1b[_0xe4bc[30]]}},raw:true})})[_0xe4bc[92]](function(_0x11f2x2d){if(_0x11f2x2d&& _0x11f2x2d[_0xe4bc[68]]){_[_0xe4bc[93]](_0x11f2x2d,function(_0x11f2x29){var _0x11f2x28=_[_0xe4bc[133]]({newValues:{id:_0x11f2x29[_0xe4bc[131]],queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b}},_0x11f2x29,{queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b});_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x29[_0xe4bc[136]],_0x11f2x29[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x28)})}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[167],_0x11f2x1f)})}},agentringnoanswer:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20){triggers[_0xe4bc[154]](_0x11f2x20)};var _0x11f2x28;var _0x11f2x2b=moment()[_0xe4bc[59]](_0xe4bc[58]);return User[_0xe4bc[142]]({where:{name:_0x11f2x1b[_0xe4bc[30]]},raw:true})[_0xe4bc[92]](function(_0x11f2x29){if(_0x11f2x29){var _0x11f2x28=_[_0xe4bc[133]]({newValues:{id:_0x11f2x29[_0xe4bc[131]],queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]}},_0x11f2x29,{queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]});_0x11f2x28[_0xe4bc[26]]= _0xe4bc[173];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x29[_0xe4bc[136]],_0x11f2x29[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x28)};return ReportAgent[_0xe4bc[142]]({where:{uniqueid:_0x11f2x1b[_0xe4bc[118]],destuniqueid:_0x11f2x1b[_0xe4bc[162]]},raw:true})})[_0xe4bc[92]](function(_0x11f2x2c){if(_0x11f2x2c){_0x11f2x28= _[_0xe4bc[133]]({},_0x11f2x2c,{lastevent:_0xe4bc[172],agentringnoanswer:true,agentringnoanswerAt:moment()[_0xe4bc[59]](_0xe4bc[58]),reason:_0xe4bc[172]});_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x2c[_0xe4bc[30]]),_0xe4bc[160],_0x11f2x28)}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[171],_0x11f2x1f)})}},queuememberadded:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20){_0x11f2x16(_0x11f2x20[_0xe4bc[69]],_0xe4bc[174],_0x11f2x20);_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x20.UserId),_0xe4bc[174],_0x11f2x20)};return BPromise[_0xe4bc[113]]()}},queuememberremoved:function(_0x11f2x1b){return function(_0x11f2x20){if(params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]]){delete params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[114]][_0x11f2x1b[_0xe4bc[30]]]};return User[_0xe4bc[142]]({where:{name:_0x11f2x1b[_0xe4bc[32]][_0xe4bc[140]](_0xe4bc[138],_0xe4bc[139])},raw:true})[_0xe4bc[92]](function(_0x11f2x29){if(_0x11f2x29){_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[176],{queue:_0x11f2x1b[_0xe4bc[69]],UserId:_0x11f2x29[_0xe4bc[131]]});_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x29[_0xe4bc[131]]),_0xe4bc[176],{queue:_0x11f2x1b[_0xe4bc[69]],UserId:_0x11f2x29[_0xe4bc[131]]})}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[175],_0x11f2x1f)})}},queuememberpause:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20){_0x11f2x16(_0x11f2x20[_0xe4bc[69]],_0xe4bc[174],_0x11f2x20);_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x20.UserId),_0xe4bc[174],_0x11f2x20)}}},queuememberpenalty:function(_0x11f2x1b){return function(_0x11f2x20){return BPromise[_0xe4bc[113]]()}},queuememberringinuse:function(_0x11f2x1b){return function(_0x11f2x20){return BPromise[_0xe4bc[113]]()}},queuemember:function(_0x11f2x1b){return function(_0x11f2x20){_0x11f2x1a(_0x11f2x1b);_0x11f2x1c(_0x11f2x1b[_0xe4bc[69]]);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[114]][_0x11f2x1b[_0xe4bc[31]]]= _0x11f2x1b;return BPromise[_0xe4bc[113]]()}},queuecallerjoin:function(_0x11f2x1b){return function(_0x11f2x20){if(!params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]]){params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]]= {};params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[72]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[74]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[87]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[89]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[77]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[78]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[83]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[85]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[90]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[91]]= 0;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[70]]= 0};params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]= {channel:_0x11f2x1b[_0xe4bc[124]],channelstate:Number(_0x11f2x1b[_0xe4bc[177]]),channelstatedesc:_0x11f2x1b[_0xe4bc[178]],calleridnum:_0x11f2x1b[_0xe4bc[179]],calleridname:_0x11f2x1b[_0xe4bc[180]],exten:_0x11f2x1b[_0xe4bc[181]],priority:Number(_0x11f2x1b[_0xe4bc[182]]),uniqueid:_0x11f2x1b[_0xe4bc[118]],queue:_0x11f2x1b[_0xe4bc[69]],position:Number(_0x11f2x1b[_0xe4bc[183]]),count:Number(_0x11f2x1b[_0xe4bc[184]])};params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[72]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[72]]++;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[70],amount:1,queue:_0x11f2x1b[_0xe4bc[69]]});params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[70]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[70]]++;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[72],amount:1,queue:_0x11f2x1b[_0xe4bc[69]]});if(_0x11f2x20){_0x11f2x16(_0x11f2x20[_0xe4bc[69]],_0xe4bc[185],_0x11f2x20)};return BPromise[_0xe4bc[113]]()}},queuecallerabandon:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20&& _0x11f2x20[_0xe4bc[186]]&& _0x11f2x20[_0xe4bc[186]][0]){_[_0xe4bc[93]](_0x11f2x20[_0xe4bc[186]][1],function(_0x11f2x2c){_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x2c[_0xe4bc[30]]),_0xe4bc[160],_0x11f2x2c)})};if(_0x11f2x20&& _0x11f2x20[_0xe4bc[187]]){_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[158],_0x11f2x20[_0xe4bc[187]]);_0x11f2x20[_0xe4bc[187]][_0xe4bc[148]][_0xe4bc[188]]= _0xe4bc[87];_0x11f2x20[_0xe4bc[187]][_0xe4bc[189]][_0xe4bc[188]]= true;triggers[_0xe4bc[154]](_0x11f2x20[_0xe4bc[187]])};var _0x11f2x28;var _0x11f2x2b=moment()[_0xe4bc[59]](_0xe4bc[58]);if(params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[72]]){params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[72]]--;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[72],amount:-1,queue:_0x11f2x1b[_0xe4bc[69]]})};if(params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[72]]){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[72]]--};if(params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]){params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[77]]= Number(_0x11f2x1b[_0xe4bc[77]]);params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[183]]= Number(_0x11f2x1b[_0xe4bc[183]]);params[_0xe4bc[62]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[190]]= Number(_0x11f2x1b[_0xe4bc[190]])};params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]]++;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[87]]++;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[191],amount:1,queue:_0x11f2x1b[_0xe4bc[69]]});params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[90]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]/ (params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[91]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]]/ (params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[90]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]/ (params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[87]])* 100,2);params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[91]]= _[_0xe4bc[84]](params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[87]]/ (params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[76]]+ params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[87]])* 100,2);return User[_0xe4bc[97]]({where:{lastQueue:_0x11f2x1b[_0xe4bc[69]]},raw:true})[_0xe4bc[92]](function(_0x11f2x2f){if(_0x11f2x2f&& _0x11f2x2f[_0xe4bc[68]]){var _0x11f2x28;_[_0xe4bc[93]](_0x11f2x2f,function(_0x11f2x30){_0x11f2x28= _[_0xe4bc[133]]({newValues:{id:_0x11f2x30[_0xe4bc[131]],queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]}},_0x11f2x30,{id:_0x11f2x30[_0xe4bc[131]],queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]});_0x11f2x28[_0xe4bc[26]]= _0xe4bc[95];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x30[_0xe4bc[136]],_0x11f2x30[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x28)})}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[192],_0x11f2x1f)})}},blindtransfer:function(_0x11f2x1b){return function(_0x11f2x20){_0x11f2x16(null,_0x11f2x1b[_0xe4bc[26]][_0xe4bc[193]](),_0x11f2x1b);return BPromise[_0xe4bc[113]]()}},attendedtransfer:function(_0x11f2x1b){return function(_0x11f2x20){_0x11f2x16(null,_0x11f2x1b[_0xe4bc[26]][_0xe4bc[193]](),_0x11f2x1b);return BPromise[_0xe4bc[113]]()}},dialbegin:function(_0x11f2x1b){return function(_0x11f2x20){params[_0xe4bc[98]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]= {channel:_0x11f2x1b[_0xe4bc[124]],channelstate:Number(_0x11f2x1b[_0xe4bc[177]]),channelstatedesc:_0x11f2x1b[_0xe4bc[178]],calleridnum:_0x11f2x1b[_0xe4bc[179]],calleridname:_0x11f2x1b[_0xe4bc[180]],context:_0x11f2x1b[_0xe4bc[194]],exten:_0x11f2x1b[_0xe4bc[181]],priority:Number(_0x11f2x1b[_0xe4bc[182]]),dialstring:_0x11f2x1b[_0xe4bc[195]]};if(_0x11f2x1b[_0xe4bc[124]]){var _0x11f2x28=_[_0xe4bc[196]](_0x11f2x1b,{starttime:moment()[_0xe4bc[59]](_0xe4bc[58]),lastevent:_0xe4bc[152],updatedAt:moment()[_0xe4bc[59]](_0xe4bc[58])});_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x1b[_0xe4bc[124]][_0xe4bc[123]](/\/|-/)[1]),_0xe4bc[197],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[125],_[_0xe4bc[196]](_0x11f2x28,{role:_0xe4bc[127]}));_0x11f2x16(_0xe4bc[126],_0xe4bc[125],_0x11f2x28,_[_0xe4bc[196]](_0x11f2x28,{role:_0xe4bc[126]}));if(_0x11f2x20){triggers[_0xe4bc[128]](_0x11f2x20)}};return BPromise[_0xe4bc[113]]()}},dialend:function(_0x11f2x1b){return function(_0x11f2x20){if(params[_0xe4bc[98]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]]){params[_0xe4bc[98]][_0xe4bc[119]][_0x11f2x1b[_0xe4bc[118]]][_0xe4bc[198]]= _0x11f2x1b[_0xe4bc[198]]};if(_0x11f2x1b[_0xe4bc[124]]){var _0x11f2x2b=moment()[_0xe4bc[59]](_0xe4bc[58]);var _0x11f2x28={dialstatus:_0x11f2x1b[_0xe4bc[198]],lastevent:(_0x11f2x1b[_0xe4bc[198]]=== _0xe4bc[103])?_0xe4bc[168]:_0xe4bc[121],answertime:(_0x11f2x1b[_0xe4bc[198]]=== _0xe4bc[103])?_0x11f2x2b:null,uniqueid:_0x11f2x1b[_0xe4bc[118]],linkedid:_0x11f2x1b[_0xe4bc[120]],destuniqueid:_0x11f2x1b[_0xe4bc[162]],destlinkedid:_0x11f2x1b[_0xe4bc[199]],updatedAt:_0x11f2x2b};_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x1b[_0xe4bc[124]][_0xe4bc[123]](/\/|-/)[1]),_0xe4bc[125],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[125],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[125],_0x11f2x28);if(_0x11f2x20){triggers[_0xe4bc[128]](_0x11f2x20)}};return BPromise[_0xe4bc[113]]()}},varset:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x1b[_0xe4bc[201]][_0xe4bc[55]](_0xe4bc[200])){_0x11f2x16(_0xe4bc[127],_0xe4bc[197],{uniqueid:_0x11f2x1b[_0xe4bc[118]],routeId:_0x11f2x1b[_0xe4bc[202]],updatedAt:moment()[_0xe4bc[59]](_0xe4bc[58])});_0x11f2x16(_0xe4bc[126],_0xe4bc[197],{uniqueid:_0x11f2x1b[_0xe4bc[118]],routeId:_0x11f2x1b[_0xe4bc[202]],updatedAt:moment()[_0xe4bc[59]](_0xe4bc[58])})};if(_0x11f2x1b){triggers[_0xe4bc[203]](_0x11f2x1b)};return BPromise[_0xe4bc[113]]()}},queuecallerunmanaged:function(_0x11f2x1b){return function(_0x11f2x20){if(_0x11f2x20){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[89]]+= 1;params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[89]]+= 1;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[89],amount:1,queue:_0x11f2x1b[_0xe4bc[69]]});if(params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[72]]){params[_0xe4bc[62]][_0xe4bc[61]][_0x11f2x1b[_0xe4bc[69]]][_0xe4bc[72]]-= 1};if(params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[72]]){params[_0xe4bc[62]][_0xe4bc[63]][_0xe4bc[72]]-= 1;_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[155],{type:_0xe4bc[72],amount:-1,queue:_0x11f2x1b[_0xe4bc[69]]})};_0x11f2x16(_0x11f2x1b[_0xe4bc[69]],_0xe4bc[158],_0x11f2x20);var _0x11f2x2b=moment()[_0xe4bc[59]](_0xe4bc[58]);return User[_0xe4bc[97]]({where:{lastQueue:_0x11f2x1b[_0xe4bc[69]]},raw:true})[_0xe4bc[92]](function(_0x11f2x2f){if(_0x11f2x2f&& _0x11f2x2f[_0xe4bc[68]]){var _0x11f2x28;_[_0xe4bc[93]](_0x11f2x2f,function(_0x11f2x30){_0x11f2x28= _[_0xe4bc[133]]({newValues:{id:_0x11f2x30[_0xe4bc[131]],queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]}},_0x11f2x30,{id:_0x11f2x30[_0xe4bc[131]],queueStatus:_0xe4bc[121],queueStatusAt:_0x11f2x2b,lastQueue:_0x11f2x1b[_0xe4bc[69]]});_0x11f2x28[_0xe4bc[26]]= _0xe4bc[204];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x30[_0xe4bc[136]],_0x11f2x30[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x28);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x28)})}})[_0xe4bc[67]](function(_0x11f2x1f){logger[_0xe4bc[66]](_0xe4bc[192],_0x11f2x1f)})}}},agentUpdate:function(_0x11f2x30){return function(){_0x11f2x30[_0xe4bc[26]]= _0xe4bc[205];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x30[_0xe4bc[131]]),_0xe4bc[137],_0x11f2x30);_0x11f2x16(_0xe4bc[127],_0xe4bc[137],_0x11f2x30);_0x11f2x16(_0xe4bc[126],_0xe4bc[137],_0x11f2x30)}},console:function(_0x11f2x31){_0x11f2x16(_0x11f2x31[_0xe4bc[206]],util[_0xe4bc[59]](_0xe4bc[207],_0x11f2x31[_0xe4bc[112]]),_0x11f2x31[_0xe4bc[208]])},realtimeQueueMembers:function(_0x11f2x32){return function(){_[_0xe4bc[210]](params[_0xe4bc[62]][_0xe4bc[61]],function(_0x11f2x1d,_0x11f2x22){if(_[_0xe4bc[209]](_0x11f2x32,_0x11f2x22)){_[_0xe4bc[210]](_0x11f2x1d[_0xe4bc[114]],function(_0x11f2x30){_0x11f2x16(_0x11f2x22,_0xe4bc[174],_0x11f2x30)})}})}},updateTriggers:function(_0x11f2x31){return function(){return triggers[_0xe4bc[211]](_0x11f2x31)}},queueAdd:function(_0x11f2x33,_0x11f2x34){return function(){if(_0x11f2x33&& _0x11f2x34){_[_0xe4bc[93]](_0x11f2x33,function(_0x11f2x20){_0x11f2x16(null,util[_0xe4bc[59]](_0xe4bc[212],_0x11f2x34),_0x11f2x20[0])})}}},queueRemove:function(_0x11f2x20,_0x11f2x34){return function(){if(_0x11f2x20&& _0x11f2x34){_0x11f2x16(null,util[_0xe4bc[59]](_0xe4bc[213],_0x11f2x34),_0x11f2x20)}}},checkTriggers:function(_0x11f2x31){return function(){return triggers[_0xe4bc[214]](_0x11f2x31)}},videoOn:function(_0x11f2x1b){return function(){return triggers[_0xe4bc[215]](_0x11f2x1b)}},inboundInit:function(){return function(){return BPromise[_0xe4bc[113]]()[_0xe4bc[92]](_0x11f2x1e())}},outboundInit:function(){return function(){return BPromise[_0xe4bc[113]]()[_0xe4bc[92]](_0x11f2x25())}},reportFaxUpdate:function(_0x11f2x35){return function(){_0x11f2x35[_0xe4bc[26]]= _0xe4bc[216];_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[122],_0x11f2x35[_0xe4bc[217]]),_0xe4bc[137],_0x11f2x35);_0x11f2x16(_0xe4bc[126],_0xe4bc[218],_0x11f2x35)}},widgetValues:function(_0x11f2x36,_0x11f2x29){return function(){_[_0xe4bc[210]](_0x11f2x36,function(_0x11f2x37,_0x11f2x38){_0x11f2x16(util[_0xe4bc[59]](_0xe4bc[135],_0x11f2x29[_0xe4bc[136]],_0x11f2x29[_0xe4bc[131]]),_0xe4bc[219]+ _0x11f2x38,_0x11f2x37)})}},receivefax:function(_0x11f2x1b){return function(_0x11f2x31){if(_0x11f2x31){return triggers[_0xe4bc[220]](_0x11f2x31)};return null}},reportQueueUpdate:function(_0x11f2x35){return function(){_0x11f2x35[_0xe4bc[26]]= _0xe4bc[221];_0x11f2x16(util[_0xe4bc[59]](_0x11f2x35[_0xe4bc[69]]),_0xe4bc[158],_0x11f2x35)}}}}