Built motion from commit ec3ecc5.|1.0.2
[motion.git] / server / config / ami / socket.js
1 var _0xfb38=["\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","\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","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x74\x6F\x74\x61\x6C","\x67\x6C\x6F\x62\x61\x6C","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\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","\x72\x6F\x75\x6E\x64","\x61\x6E\x73\x77\x65\x72\x52\x61\x74\x65","\x74\x68\x65\x6E","\x71\x75\x65\x75\x65","\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","\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\x62\x61\x6E\x64\x6F\x6E\x52\x61\x74\x65","\x74\x79\x70\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\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","\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","\x61\x67\x65\x6E\x74\x73","\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C\x3A\x73\x61\x76\x65","\x72\x65\x73\x6F\x6C\x76\x65","\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","\x6C\x6F\x67","\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","\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","\x71\x75\x65\x75\x65\x53\x74\x61\x74\x75\x73","\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","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6A\x6F\x69\x6E\x20\x2D\x20\x73\x6F\x63\x6B\x65\x74","\x6F\x72\x69\x67\x69\x6E\x61\x6C\x70\x6F\x73\x69\x74\x69\x6F\x6E","\x61\x62\x61\x6E\x64\x6F\x6E","\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","\x41\x4E\x53\x57\x45\x52","\x64\x65\x73\x74\x6C\x69\x6E\x6B\x65\x64\x69\x64","\x71\x75\x65\x75\x65\x73\x74\x61\x74\x75\x73","\x76\x61\x72\x69\x61\x62\x6C\x65","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x72\x6F\x75\x74\x65\x69\x64","\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"];_0xfb38[0];var _=require(_0xfb38[1]);var util=require(_0xfb38[2]);var moment=require(_0xfb38[3]);var BPromise=require(_0xfb38[4]);var redis=require(_0xfb38[5]);var VoiceQueue=require(_0xfb38[7])[_0xfb38[6]];var ReportQueue=require(_0xfb38[7])[_0xfb38[8]];var ReportCall=require(_0xfb38[7])[_0xfb38[9]];var ReportAgent=require(_0xfb38[7])[_0xfb38[10]];var ReportDial=require(_0xfb38[7])[_0xfb38[11]];var ReportMember=require(_0xfb38[7])[_0xfb38[12]];var User=require(_0xfb38[7])[_0xfb38[13]];var Triggers=require(_0xfb38[14]);var config=require(_0xfb38[15]);var utils=require(_0xfb38[16]);var redisConf;if(config[_0xfb38[17]]){redisConf= {password:config[_0xfb38[17]]}};var redisClient=redis[_0xfb38[19]](6379,config[_0xfb38[18]],redisConf);var io=require(_0xfb38[20])(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},channels:[]}};module[_0xfb38[21]]= function(){var _0x7920x15=function(_0x7920x16,_0x7920x17,_0x7920x18){if(_0x7920x16){io[_0xfb38[23]](_0x7920x16)[_0xfb38[22]](_0x7920x17,_0x7920x18)}else {io[_0xfb38[22]](_0x7920x17,_0x7920x18)}};var _0x7920x19=function(_0x7920x1a){delete _0x7920x1a[_0xfb38[24]];delete _0x7920x1a[_0xfb38[25]];delete _0x7920x1a[_0xfb38[26]];delete _0x7920x1a[_0xfb38[27]];_0x7920x1a[_0xfb38[28]]= _0x7920x1a[_0xfb38[29]]|| _0x7920x1a[_0xfb38[28]];_0x7920x1a[_0xfb38[30]]= _0x7920x1a[_0xfb38[31]];_0x7920x1a[_0xfb38[32]]= _0xfb38[33];switch(_0x7920x1a[_0xfb38[51]]){case _0xfb38[34]:_0x7920x1a[_0xfb38[32]]= _0xfb38[33];break;case _0xfb38[36]:_0x7920x1a[_0xfb38[32]]= _0xfb38[35];break;case _0xfb38[38]:_0x7920x1a[_0xfb38[32]]= _0xfb38[37];break;case _0xfb38[40]:_0x7920x1a[_0xfb38[32]]= _0xfb38[39];break;case _0xfb38[42]:_0x7920x1a[_0xfb38[32]]= _0xfb38[41];break;case _0xfb38[44]:_0x7920x1a[_0xfb38[32]]= _0xfb38[43];break;case _0xfb38[46]:_0x7920x1a[_0xfb38[32]]= _0xfb38[45];break;case _0xfb38[48]:_0x7920x1a[_0xfb38[32]]= _0xfb38[47];break;case _0xfb38[50]:_0x7920x1a[_0xfb38[32]]= _0xfb38[49];break;default:};_0x7920x1a[_0xfb38[51]]= Number(_0x7920x1a[_0xfb38[51]]);if(_0x7920x1a[_0xfb38[53]](_0xfb38[52])){_0x7920x1a[_0xfb38[52]]= Number(_0x7920x1a[_0xfb38[52]])};if(_0x7920x1a[_0xfb38[53]](_0xfb38[54])){_0x7920x1a[_0xfb38[54]]= Number(_0x7920x1a[_0xfb38[54]])};if(_0x7920x1a[_0xfb38[53]](_0xfb38[55])){if(_0x7920x1a[_0xfb38[55]]=== _0xfb38[34]){_0x7920x1a[_0xfb38[55]]= null}else {_0x7920x1a[_0xfb38[55]]= moment()[_0xfb38[57]](_0xfb38[56])}};_0x7920x1a[_0xfb38[58]]= parseInt(_0x7920x1a[_0xfb38[58]],10)?true:false};function _0x7920x1b(_0x7920x1c){if(!params[_0xfb38[60]][_0xfb38[59]][_0x7920x1c]){params[_0xfb38[60]][_0xfb38[59]][_0x7920x1c]= {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}}}VoiceQueue[_0xfb38[100]]({attributes:[_0xfb38[29]],raw:true})[_0xfb38[78]](function(_0x7920x1e){if(_0x7920x1e){_[_0xfb38[101]](_0x7920x1e,function(_0x7920x1c){_0x7920x1b(_0x7920x1c[_0xfb38[29]])});return ReportQueue[_0xfb38[100]]({attributes:[_0xfb38[79],_0xfb38[88],_0xfb38[91],_0xfb38[102],_0xfb38[103],_0xfb38[104],_0xfb38[86]],raw:true})}})[_0xfb38[78]](function(_0x7920x1e){if(_0x7920x1e){var _0x7920x1f;var _0x7920x20;var _0x7920x21=_0x7920x1e[_0xfb38[63]];for(var _0x7920x22=0;_0x7920x22< _0x7920x21;_0x7920x22++){_0x7920x1f= _0x7920x1e[_0x7920x22];_0x7920x20= _0x7920x1f[_0xfb38[79]];_0x7920x1b(_0x7920x20);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[64]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[64]]++;if(utils[_0xfb38[80]](_0x7920x1f)){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[81]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[81]]++};if(utils[_0xfb38[82]](_0x7920x1f)){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[83]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[83]]++};if(utils[_0xfb38[84]](_0x7920x1f)){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[85]]++;params[_0xfb38[60]][_0xfb38[65]][_0xfb38[86]]+= _0x7920x1f[_0xfb38[86]]|| 0;params[_0xfb38[60]][_0xfb38[65]][_0xfb38[87]]+= moment(_0x7920x1f[_0xfb38[91]])[_0xfb38[90]](moment(_0x7920x1f[_0xfb38[88]]),_0xfb38[89]);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[92]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[86]]/ params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[85]]);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[93]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[87]]/ params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[85]]);params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[86]]+= _0x7920x1f[_0xfb38[86]]|| 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[87]]+= moment(_0x7920x1f[_0xfb38[91]])[_0xfb38[90]](moment(_0x7920x1f[_0xfb38[88]]),_0xfb38[89]);params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[92]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[86]]/ params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[85]]);params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[93]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[87]]/ params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[85]])};if(utils[_0xfb38[94]](_0x7920x1f)){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[95]]++};if(utils[_0xfb38[96]](_0x7920x1f)){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[97]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[97]]++}};params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[77]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[85]]/ (params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[98]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[95]]/ (params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[59]][_0x7920x20][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[77]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]/ (params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[98]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]]/ (params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]])* 100,2)};return ReportCall[_0xfb38[100]]({where:{type:_0xfb38[66]},attributes:[_0xfb38[99],_0xfb38[69],_0xfb38[72]],raw:true})})[_0xfb38[78]](function(_0x7920x1e){if(_0x7920x1e){if(_0x7920x1e[_0xfb38[63]]){params[_0xfb38[66]][_0xfb38[65]][_0xfb38[64]]= _0x7920x1e[_0xfb38[63]];params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]= _[_0xfb38[70]](_0x7920x1e,_0xfb38[69])[_0xfb38[68]]|| 0;params[_0xfb38[66]][_0xfb38[65]][_0xfb38[71]]= _[_0xfb38[73]](_0x7920x1e,_0xfb38[72]);if(params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]){params[_0xfb38[66]][_0xfb38[65]][_0xfb38[74]]= _[_0xfb38[76]]((_[_0xfb38[73]](_0x7920x1e[_0xfb38[75]],_0xfb38[72])/ params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]));params[_0xfb38[66]][_0xfb38[65]][_0xfb38[77]]= _[_0xfb38[76]](params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]/ params[_0xfb38[66]][_0xfb38[65]][_0xfb38[64]]* 100,1)}}}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[61]](_0x7920x1d)});return {cdr:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1a[_0xfb38[99]]=== _0xfb38[66]){params[_0xfb38[66]][_0xfb38[65]][_0xfb38[64]]++;params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]= (_0x7920x1a[_0xfb38[69]]=== _0xfb38[68])?++params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]:params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]];params[_0xfb38[66]][_0xfb38[65]][_0xfb38[71]]+= Number(_0x7920x1a[_0xfb38[72]]);if(params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]){params[_0xfb38[66]][_0xfb38[65]][_0xfb38[74]]= _[_0xfb38[76]](params[_0xfb38[66]][_0xfb38[65]][_0xfb38[71]]/ params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]);params[_0xfb38[66]][_0xfb38[65]][_0xfb38[77]]= _[_0xfb38[76]](params[_0xfb38[66]][_0xfb38[65]][_0xfb38[67]]/ params[_0xfb38[66]][_0xfb38[65]][_0xfb38[64]]* 100,1)};_0x7920x15(_0xfb38[105],_0xfb38[106],params[_0xfb38[66]][_0xfb38[65]])};_0x7920x15(_0xfb38[107],_0xfb38[108],_0x7920x1a);return BPromise[_0xfb38[109]]()}},send:function(_0x7920x1a){return function(_0x7920x1e){return BPromise[_0xfb38[109]]()}},hangup:function(_0x7920x1a){return function(_0x7920x1e){if(params[_0xfb38[66]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]){delete params[_0xfb38[66]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]};if(params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]){delete params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]};var _0x7920x23={uniqueid:_0x7920x1a[_0xfb38[110]],linkedid:_0x7920x1a[_0xfb38[112]],endtime:moment()[_0xfb38[57]](_0xfb38[56]),lastevent:_0xfb38[113],updatedAt:moment()[_0xfb38[57]](_0xfb38[56])};_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x1a[_0xfb38[116]][_0xfb38[115]](/\/|-/)[1]),_0xfb38[117],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[117],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[117],_0x7920x23);if(_0x7920x1e){triggers[_0xfb38[120]](_0x7920x1e)};return BPromise[_0xfb38[109]]()}},devicestatechange:function(_0x7920x1a){return function(_0x7920x1e){return User[_0xfb38[133]]({where:{name:_0x7920x1a[_0xfb38[132]][_0xfb38[131]](_0xfb38[129],_0xfb38[130])},raw:true})[_0xfb38[78]](function(_0x7920x24){if(_0x7920x24){var _0x7920x23=_[_0xfb38[125]]({newValues:{id:_0x7920x24[_0xfb38[123]],status:_0x7920x1a[_0xfb38[124]],statusAt:moment()[_0xfb38[57]](_0xfb38[56])}},_0x7920x24,{status:_0x7920x1a[_0xfb38[124]],statusAt:moment()[_0xfb38[57]](_0xfb38[56])});_0x7920x15(util[_0xfb38[57]](_0xfb38[126],_0x7920x24[_0xfb38[127]],_0x7920x24[_0xfb38[123]]),_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x23)}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[122]](_0xfb38[121],_0x7920x1d)})}},peerstatus:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e&& _0x7920x1e[0]){_[_0xfb38[101]](_0x7920x1e[1],function(_0x7920x25){if(!params[_0xfb38[134]][_0x7920x25[_0xfb38[29]]]){params[_0xfb38[134]][_0x7920x25[_0xfb38[29]]]= {name:_0x7920x25[_0xfb38[29]]}};params[_0xfb38[134]][_0x7920x25[_0xfb38[29]]][_0xfb38[135]]= _0x7920x1a[_0xfb38[135]];_0x7920x15(_0xfb38[136],_0xfb38[137],params[_0xfb38[134]][_0x7920x25[_0xfb38[29]]])})};return BPromise[_0xfb38[109]]()}},registry:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e&& _0x7920x1e[0]){_[_0xfb38[101]](_0x7920x1e[1],function(_0x7920x25){if(!params[_0xfb38[134]][_0x7920x25[_0xfb38[29]]]){params[_0xfb38[134]][_0x7920x25[_0xfb38[29]]]= {name:_0x7920x25[_0xfb38[29]]}};params[_0xfb38[134]][_0x7920x25[_0xfb38[29]]][_0xfb38[51]]= _0x7920x1a[_0xfb38[51]];_0x7920x15(_0xfb38[136],_0xfb38[137],params[_0xfb38[134]][_0x7920x25[_0xfb38[29]]])})};return BPromise[_0xfb38[109]]()}},agentcalled:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e){_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x1e[_0xfb38[28]]),_0xfb38[138],_0x7920x1e);triggers[_0xfb38[139]](_0x7920x1e)};return User[_0xfb38[133]]({where:{name:_0x7920x1a[_0xfb38[28]],voicePause:false},raw:true})[_0xfb38[78]](function(_0x7920x24){if(_0x7920x24){var _0x7920x26=moment()[_0xfb38[57]](_0xfb38[56]);var _0x7920x23=_[_0xfb38[125]]({newValues:{id:_0x7920x24[_0xfb38[123]],queueStatus:_0xfb38[141],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]}},_0x7920x24,{queueStatus:_0xfb38[141],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[126],_0x7920x24[_0xfb38[127]],_0x7920x24[_0xfb38[123]]),_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x23)}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[122]](_0xfb38[140],_0x7920x1d)})}},agentcomplete:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e){triggers[_0xfb38[142]](_0x7920x1e)};if(params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[83]]){params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[83]]--};if(params[_0xfb38[60]][_0xfb38[65]][_0xfb38[83]]){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[83]]--;_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[83],amount:-1,queue:_0x7920x1a[_0xfb38[79]]})};params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]++;_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[113],amount:1,queue:_0x7920x1a[_0xfb38[79]]});params[_0xfb38[60]][_0xfb38[65]][_0xfb38[77]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]/ (params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[98]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]]/ (params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[77]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]/ (params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[98]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[95]]/ (params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[87]]+= Number(_0x7920x1a[_0xfb38[87]]);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[87]]+= Number(_0x7920x1a[_0xfb38[87]]);_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[87],amount:Number(_0x7920x1a[_0xfb38[87]]),queue:_0x7920x1a[_0xfb38[79]]});params[_0xfb38[60]][_0xfb38[65]][_0xfb38[93]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[65]][_0xfb38[87]]/ params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[93]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[87]]/ params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[86]]+= Number(_0x7920x1a[_0xfb38[86]]);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[86]]+= Number(_0x7920x1a[_0xfb38[86]]);_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[86],amount:Number(_0x7920x1a[_0xfb38[86]]),queue:_0x7920x1a[_0xfb38[79]]});params[_0xfb38[60]][_0xfb38[65]][_0xfb38[92]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[65]][_0xfb38[86]]/ params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[92]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[86]]/ params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]);var _0x7920x23;var _0x7920x26=moment()[_0xfb38[57]](_0xfb38[56]);return ReportAgent[_0xfb38[133]]({where:{uniqueid:_0x7920x1a[_0xfb38[110]],destuniqueid:_0x7920x1a[_0xfb38[148]]},raw:true})[_0xfb38[78]](function(_0x7920x27){if(_0x7920x27){_0x7920x23= _[_0xfb38[125]]({},_0x7920x27,{lastevent:_0xfb38[113],agentcomplete:true,agentcompleteAt:_0x7920x26,talktime:Number(_0x7920x1a[_0xfb38[87]]),reason:_0x7920x1a[_0xfb38[146]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x27[_0xfb38[28]]),_0xfb38[147],_0x7920x23)};return ReportQueue[_0xfb38[133]]({where:{uniqueid:_0x7920x1a[_0xfb38[110]]},raw:true})})[_0xfb38[78]](function(_0x7920x27){if(_0x7920x27){_0x7920x23= _[_0xfb38[125]]({},_0x7920x27,{queuecallercomplete:true,queuecallercompleteAt:_0x7920x26});_0x7920x15(_0x7920x27[_0xfb38[79]],_0xfb38[145],_0x7920x23)};return User[_0xfb38[133]]({where:{name:_0x7920x1a[_0xfb38[28]],voicePause:false},raw:true})})[_0xfb38[78]](function(_0x7920x24){if(_0x7920x24){var _0x7920x23=_[_0xfb38[125]]({newValues:{id:_0x7920x24[_0xfb38[123]],queueStatus:_0xfb38[113],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]}},_0x7920x24,{queueStatus:_0xfb38[113],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[126],_0x7920x24[_0xfb38[127]],_0x7920x24[_0xfb38[123]]),_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x23)}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[122]](_0xfb38[144],_0x7920x1d)})}},agentconnect:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e){triggers[_0xfb38[142]](_0x7920x1e)};if(params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[81]]){params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[81]]--;_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[81],amount:-1,queue:_0x7920x1a[_0xfb38[79]]})};if(params[_0xfb38[60]][_0xfb38[65]][_0xfb38[81]]){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[81]]--};if(params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]){params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[149]]= _0x7920x1a[_0xfb38[150]];params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[151]]= _0x7920x1a[_0xfb38[151]];params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[86]]= Number(_0x7920x1a[_0xfb38[86]]);params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[152]]= Number(_0x7920x1a[_0xfb38[152]]);params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[30]]= _0x7920x1a[_0xfb38[30]];params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[28]]= _0x7920x1a[_0xfb38[28]]};params[_0xfb38[60]][_0xfb38[65]][_0xfb38[83]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[83]]++;_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[83],amount:1,queue:_0x7920x1a[_0xfb38[79]]});var _0x7920x23;var _0x7920x26=moment()[_0xfb38[57]](_0xfb38[56]);return ReportQueue[_0xfb38[133]]({where:{uniqueid:_0x7920x1a[_0xfb38[110]]},raw:true})[_0xfb38[78]](function(_0x7920x27){if(_0x7920x27){_0x7920x23= _[_0xfb38[125]]({},_0x7920x27,{queuecallerleaveAt:moment()[_0xfb38[57]](_0xfb38[56]),holdtime:_0x7920x1a[_0xfb38[86]],assigned:true,lastAssignedTo:_0x7920x1a[_0xfb38[28]]});_0x7920x15(_0x7920x27[_0xfb38[79]],_0xfb38[145],_0x7920x23)};return ReportAgent[_0xfb38[133]]({where:{uniqueid:_0x7920x1a[_0xfb38[110]],destuniqueid:_0x7920x1a[_0xfb38[148]]},raw:true})})[_0xfb38[78]](function(_0x7920x27){if(_0x7920x27){_0x7920x23= _[_0xfb38[125]]({},_0x7920x27,{lastevent:_0xfb38[154],agentconnectAt:moment()[_0xfb38[57]](_0xfb38[56]),holdtime:_0x7920x1a[_0xfb38[86]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x27[_0xfb38[28]]),_0xfb38[147],_0x7920x23)};return ReportAgent[_0xfb38[100]]({where:{uniqueid:_0x7920x1a[_0xfb38[110]],destuniqueid:{$ne:_0x7920x1a[_0xfb38[148]]},reason:null},raw:true})})[_0xfb38[78]](function(_0x7920x29){if(_0x7920x29&& _0x7920x29[_0xfb38[63]]){_[_0xfb38[101]](_0x7920x29,function(_0x7920x27){_0x7920x23= _[_0xfb38[125]]({},_0x7920x27,{lastevent:_0xfb38[155],agentringnoanswer:true,agentringnoanswerAt:_0x7920x26,reason:_0xfb38[155],answeredelsewheredestinationuniqueid:_0x7920x1a[_0xfb38[148]],answeredelsewheremembername:_0x7920x1a[_0xfb38[28]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x27[_0xfb38[28]]),_0xfb38[147],_0x7920x23)})};return User[_0xfb38[133]]({where:{name:_0x7920x1a[_0xfb38[28]],voicePause:false},raw:true})})[_0xfb38[78]](function(_0x7920x24){if(_0x7920x24){var _0x7920x23=_[_0xfb38[125]]({newValues:{id:_0x7920x24[_0xfb38[123]],queueStatus:_0xfb38[154],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]}},_0x7920x24,{queueStatus:_0xfb38[154],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[126],_0x7920x24[_0xfb38[127]],_0x7920x24[_0xfb38[123]]),_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x23)};return User[_0xfb38[100]]({where:{lastQueue:_0x7920x1a[_0xfb38[79]],name:{$ne:_0x7920x1a[_0xfb38[28]]}},raw:true})})[_0xfb38[78]](function(_0x7920x28){if(_0x7920x28&& _0x7920x28[_0xfb38[63]]){_[_0xfb38[101]](_0x7920x28,function(_0x7920x24){var _0x7920x23=_[_0xfb38[125]]({newValues:{id:_0x7920x24[_0xfb38[123]],queueStatus:_0xfb38[113],queueStatusAt:_0x7920x26}},_0x7920x24,{queueStatus:_0xfb38[113],queueStatusAt:_0x7920x26});_0x7920x15(util[_0xfb38[57]](_0xfb38[126],_0x7920x24[_0xfb38[127]],_0x7920x24[_0xfb38[123]]),_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x23)})}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[122]](_0xfb38[153],_0x7920x1d)})}},agentringnoanswer:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e){triggers[_0xfb38[142]](_0x7920x1e)};var _0x7920x23;var _0x7920x26=moment()[_0xfb38[57]](_0xfb38[56]);return User[_0xfb38[133]]({where:{name:_0x7920x1a[_0xfb38[28]],voicePause:false},raw:true})[_0xfb38[78]](function(_0x7920x24){if(_0x7920x24){var _0x7920x23=_[_0xfb38[125]]({newValues:{id:_0x7920x24[_0xfb38[123]],queueStatus:_0xfb38[113],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]}},_0x7920x24,{queueStatus:_0xfb38[113],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[126],_0x7920x24[_0xfb38[127]],_0x7920x24[_0xfb38[123]]),_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x23)};return ReportAgent[_0xfb38[133]]({where:{uniqueid:_0x7920x1a[_0xfb38[110]],destuniqueid:_0x7920x1a[_0xfb38[148]]},raw:true})})[_0xfb38[78]](function(_0x7920x27){if(_0x7920x27){_0x7920x23= _[_0xfb38[125]]({},_0x7920x27,{lastevent:_0xfb38[157],agentringnoanswer:true,agentringnoanswerAt:moment()[_0xfb38[57]](_0xfb38[56]),reason:_0xfb38[157]});_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x27[_0xfb38[28]]),_0xfb38[147],_0x7920x23)}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[122]](_0xfb38[156],_0x7920x1d)})}},queuememberadded:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e){_0x7920x15(_0x7920x1e[_0xfb38[79]],_0xfb38[158],_0x7920x1e);_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x1e.UserId),_0xfb38[158],_0x7920x1e)};return BPromise[_0xfb38[109]]()}},queuememberremoved:function(_0x7920x1a){return function(_0x7920x1e){if(params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]]){delete params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[107]][_0x7920x1a[_0xfb38[28]]]};return User[_0xfb38[133]]({where:{name:_0x7920x1a[_0xfb38[30]][_0xfb38[131]](_0xfb38[129],_0xfb38[130])},raw:true})[_0xfb38[78]](function(_0x7920x24){if(_0x7920x24){_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[160],{queue:_0x7920x1a[_0xfb38[79]],UserId:_0x7920x24[_0xfb38[123]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x24[_0xfb38[123]]),_0xfb38[160],{queue:_0x7920x1a[_0xfb38[79]],UserId:_0x7920x24[_0xfb38[123]]})}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[61]](_0xfb38[159],_0x7920x1d)})}},queuememberpause:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e){_0x7920x15(_0x7920x1e[_0xfb38[79]],_0xfb38[158],_0x7920x1e);_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x1e.UserId),_0xfb38[158],_0x7920x1e)};var _0x7920x23;var _0x7920x26=moment()[_0xfb38[57]](_0xfb38[56]);return User[_0xfb38[133]]({where:{name:_0x7920x1a[_0xfb38[28]]},raw:true})[_0xfb38[78]](function(_0x7920x24){if(_0x7920x24){var _0x7920x2a={id:_0x7920x24[_0xfb38[123]],voicePause:false,queueStatusAt:_0x7920x26};if(parseInt(_0x7920x1a[_0xfb38[58]],10)){_[_0xfb38[162]](_0x7920x2a,{voicePause:true,chatPause:true,mailPause:true,faxPause:true,smsPause:true,openchannelPause:true,pauseType:_0x7920x1a[_0xfb38[146]],lastPauseAt:_0x7920x26,queueStatus:_0xfb38[58]})}else {switch(_0x7920x24[_0xfb38[51]]){case _0xfb38[37]:_0x7920x2a[_0xfb38[163]]= _0xfb38[154];break;case _0xfb38[45]:_0x7920x2a[_0xfb38[163]]= _0xfb38[141];break;default:_0x7920x2a[_0xfb38[163]]= _0xfb38[113]}};var _0x7920x23=_[_0xfb38[125]]({newValues:_0x7920x2a},_0x7920x24,_0x7920x2a);_0x7920x15(util[_0xfb38[57]](_0xfb38[126],_0x7920x24[_0xfb38[127]],_0x7920x24[_0xfb38[123]]),_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x23)}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[122]](_0xfb38[161],_0x7920x1d)})}},queuememberpenalty:function(_0x7920x1a){return function(_0x7920x1e){return BPromise[_0xfb38[109]]()}},queuememberringinuse:function(_0x7920x1a){return function(_0x7920x1e){return BPromise[_0xfb38[109]]()}},queuemember:function(_0x7920x1a){return function(_0x7920x1e){_0x7920x19(_0x7920x1a);_0x7920x1b(_0x7920x1a[_0xfb38[79]]);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[107]][_0x7920x1a[_0xfb38[29]]]= _0x7920x1a;return BPromise[_0xfb38[109]]()}},queuecallerjoin:function(_0x7920x1a){if(!params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]]){params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]]= {};params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[81]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[83]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[95]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[97]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[86]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[87]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[92]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[93]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[77]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[98]]= 0;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[64]]= 0};params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]= {channel:_0x7920x1a[_0xfb38[116]],channelstate:Number(_0x7920x1a[_0xfb38[164]]),channelstatedesc:_0x7920x1a[_0xfb38[165]],calleridnum:_0x7920x1a[_0xfb38[166]],calleridname:_0x7920x1a[_0xfb38[167]],exten:_0x7920x1a[_0xfb38[168]],priority:Number(_0x7920x1a[_0xfb38[169]]),uniqueid:_0x7920x1a[_0xfb38[110]],queue:_0x7920x1a[_0xfb38[79]],position:Number(_0x7920x1a[_0xfb38[170]]),count:Number(_0x7920x1a[_0xfb38[171]])};params[_0xfb38[60]][_0xfb38[65]][_0xfb38[81]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[81]]++;_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[64],amount:1,queue:_0x7920x1a[_0xfb38[79]]});params[_0xfb38[60]][_0xfb38[65]][_0xfb38[64]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[64]]++;_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[81],amount:1,queue:_0x7920x1a[_0xfb38[79]]});return function(_0x7920x1e){if(_0x7920x1e){_0x7920x15(_0x7920x1e[_0xfb38[79]],_0xfb38[172],_0x7920x1e)};return BPromise[_0xfb38[109]]()}},queuecallerabandon:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1e&& _0x7920x1e[0]){_[_0xfb38[101]](_0x7920x1e[1],function(_0x7920x27){triggers[_0xfb38[142]](_0x7920x27);_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x27[_0xfb38[28]]),_0xfb38[147],_0x7920x27)})};var _0x7920x23;var _0x7920x26=moment()[_0xfb38[57]](_0xfb38[56]);return ReportQueue[_0xfb38[133]]({where:{uniqueid:_0x7920x1a[_0xfb38[110]],queuecallerexit:false},raw:true})[_0xfb38[78]](function(_0x7920x27){if(_0x7920x27){if(params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[81]]){params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[81]]--;_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[81],amount:-1,queue:_0x7920x1a[_0xfb38[79]]})};if(params[_0xfb38[60]][_0xfb38[65]][_0xfb38[81]]){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[81]]--};if(params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]){params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[86]]= Number(_0x7920x1a[_0xfb38[86]]);params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[170]]= Number(_0x7920x1a[_0xfb38[170]]);params[_0xfb38[60]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[174]]= Number(_0x7920x1a[_0xfb38[174]])};params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]]++;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[95]]++;_0x7920x15(_0x7920x1a[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[175],amount:1,queue:_0x7920x1a[_0xfb38[79]]});params[_0xfb38[60]][_0xfb38[65]][_0xfb38[77]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]/ (params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[65]][_0xfb38[98]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]]/ (params[_0xfb38[60]][_0xfb38[65]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[65]][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[77]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]/ (params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[95]])* 100,2);params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[98]]= _[_0xfb38[76]](params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[95]]/ (params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[85]]+ params[_0xfb38[60]][_0xfb38[59]][_0x7920x1a[_0xfb38[79]]][_0xfb38[95]])* 100,2);_0x7920x15(_0x7920x27[_0xfb38[79]],_0xfb38[145],_[_0xfb38[162]](_0x7920x27,{queuecallerabandon:true,queuecallerabandonAt:_0x7920x26,queuecallerleaveAt:_0x7920x26,originalposition:_0x7920x1a[_0xfb38[174]],position:_0x7920x1a[_0xfb38[170]],holdtime:_0x7920x1a[_0xfb38[86]]}))};return User[_0xfb38[100]]({where:{lastQueue:_0x7920x1a[_0xfb38[79]],voicePause:false},raw:true})})[_0xfb38[78]](function(_0x7920x2b){if(_0x7920x2b&& _0x7920x2b[_0xfb38[63]]){var _0x7920x23;_[_0xfb38[101]](_0x7920x2b,function(_0x7920x2c){_0x7920x23= _[_0xfb38[125]]({newValues:{id:_0x7920x2c[_0xfb38[123]],queueStatus:_0xfb38[113],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]}},_0x7920x2c,{id:_0x7920x2c[_0xfb38[123]],queueStatus:_0xfb38[113],queueStatusAt:_0x7920x26,lastQueue:_0x7920x1a[_0xfb38[79]]});_0x7920x15(util[_0xfb38[57]](_0xfb38[126],_0x7920x2c[_0xfb38[127]],_0x7920x2c[_0xfb38[123]]),_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x23)})}})[_0xfb38[62]](function(_0x7920x1d){console[_0xfb38[122]](_0xfb38[173],_0x7920x1d)})}},blindtransfer:function(_0x7920x1a){return function(_0x7920x1e){_0x7920x15(null,_0x7920x1a[_0xfb38[24]][_0xfb38[176]](),_0x7920x1a);return BPromise[_0xfb38[109]]()}},attendedtransfer:function(_0x7920x1a){return function(_0x7920x1e){_0x7920x15(null,_0x7920x1a[_0xfb38[24]][_0xfb38[176]](),_0x7920x1a);return BPromise[_0xfb38[109]]()}},dialbegin:function(_0x7920x1a){return function(_0x7920x1e){params[_0xfb38[66]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]= {channel:_0x7920x1a[_0xfb38[116]],channelstate:Number(_0x7920x1a[_0xfb38[164]]),channelstatedesc:_0x7920x1a[_0xfb38[165]],calleridnum:_0x7920x1a[_0xfb38[166]],calleridname:_0x7920x1a[_0xfb38[167]],context:_0x7920x1a[_0xfb38[177]],exten:_0x7920x1a[_0xfb38[168]],priority:Number(_0x7920x1a[_0xfb38[169]]),dialstring:_0x7920x1a[_0xfb38[178]]};if(_0x7920x1a[_0xfb38[116]]){var _0x7920x23=_[_0xfb38[162]](_0x7920x1a,{starttime:moment()[_0xfb38[57]](_0xfb38[56]),lastevent:_0xfb38[141],updatedAt:moment()[_0xfb38[57]](_0xfb38[56])});_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x1a[_0xfb38[116]][_0xfb38[115]](/\/|-/)[1]),_0xfb38[179],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[117],_[_0xfb38[162]](_0x7920x23,{role:_0xfb38[119]}));_0x7920x15(_0xfb38[118],_0xfb38[117],_0x7920x23,_[_0xfb38[162]](_0x7920x23,{role:_0xfb38[118]}));if(_0x7920x1e){triggers[_0xfb38[120]](_0x7920x1e)}};return BPromise[_0xfb38[109]]()}},dialend:function(_0x7920x1a){return function(_0x7920x1e){if(params[_0xfb38[66]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]]){params[_0xfb38[66]][_0xfb38[111]][_0x7920x1a[_0xfb38[110]]][_0xfb38[180]]= _0x7920x1a[_0xfb38[180]]};if(_0x7920x1a[_0xfb38[116]]){var _0x7920x26=moment()[_0xfb38[57]](_0xfb38[56]);var _0x7920x23={dialstatus:_0x7920x1a[_0xfb38[180]],lastevent:(_0x7920x1a[_0xfb38[180]]=== _0xfb38[181])?_0xfb38[154]:_0xfb38[113],answertime:(_0x7920x1a[_0xfb38[180]]=== _0xfb38[181])?_0x7920x26:null,uniqueid:_0x7920x1a[_0xfb38[110]],linkedid:_0x7920x1a[_0xfb38[112]],destuniqueid:_0x7920x1a[_0xfb38[148]],destlinkedid:_0x7920x1a[_0xfb38[182]],updatedAt:_0x7920x26};_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x1a[_0xfb38[116]][_0xfb38[115]](/\/|-/)[1]),_0xfb38[117],_0x7920x23);_0x7920x15(_0xfb38[119],_0xfb38[117],_0x7920x23);_0x7920x15(_0xfb38[118],_0xfb38[117],_0x7920x23);if(_0x7920x1e){triggers[_0xfb38[120]](_0x7920x1e)}};return BPromise[_0xfb38[109]]()}},varset:function(_0x7920x1a){return function(_0x7920x1e){if(_0x7920x1a[_0xfb38[184]][_0xfb38[53]](_0xfb38[183])){if(_0x7920x1e){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[97]]+= 1;params[_0xfb38[60]][_0xfb38[59]][_0x7920x1e[_0xfb38[79]]][_0xfb38[97]]+= 1;_0x7920x15(_0x7920x1e[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[97],amount:1,queue:_0x7920x1e[_0xfb38[79]]});if(params[_0xfb38[60]][_0xfb38[59]][_0x7920x1e[_0xfb38[79]]][_0xfb38[81]]){params[_0xfb38[60]][_0xfb38[59]][_0x7920x1e[_0xfb38[79]]][_0xfb38[81]]-= 1};if(params[_0xfb38[60]][_0xfb38[65]][_0xfb38[81]]){params[_0xfb38[60]][_0xfb38[65]][_0xfb38[81]]-= 1};_0x7920x15(_0x7920x1e[_0xfb38[79]],_0xfb38[143],{type:_0xfb38[81],amount:-1,queue:_0x7920x1e[_0xfb38[79]]});_0x7920x15(_0x7920x1e[_0xfb38[79]],_0xfb38[145],_0x7920x1e)}};if(_0x7920x1a[_0xfb38[184]][_0xfb38[53]](_0xfb38[185])){_0x7920x15(_0xfb38[119],_0xfb38[179],{uniqueid:_0x7920x1a[_0xfb38[110]],routeId:_0x7920x1a[_0xfb38[186]],updatedAt:moment()[_0xfb38[57]](_0xfb38[56])});_0x7920x15(_0xfb38[118],_0xfb38[179],{uniqueid:_0x7920x1a[_0xfb38[110]],routeId:_0x7920x1a[_0xfb38[186]],updatedAt:moment()[_0xfb38[57]](_0xfb38[56])})};if(_0x7920x1a){triggers[_0xfb38[187]](_0x7920x1a)};return BPromise[_0xfb38[109]]()}},agentUpdate:function(_0x7920x2c){return function(){_0x7920x15(util[_0xfb38[57]](_0xfb38[114],_0x7920x2c[_0xfb38[123]]),_0xfb38[128],_0x7920x2c);_0x7920x15(_0xfb38[119],_0xfb38[128],_0x7920x2c);_0x7920x15(_0xfb38[118],_0xfb38[128],_0x7920x2c)}},console:function(_0x7920x2d){_0x7920x15(_0x7920x2d[_0xfb38[188]],util[_0xfb38[57]](_0xfb38[189],_0x7920x2d[_0xfb38[99]]),_0x7920x2d[_0xfb38[190]])},realtimeQueueMembers:function(_0x7920x2e){return function(){_[_0xfb38[192]](params[_0xfb38[60]][_0xfb38[59]],function(_0x7920x1c,_0x7920x20){if(_[_0xfb38[191]](_0x7920x2e,_0x7920x20)){_[_0xfb38[192]](_0x7920x1c[_0xfb38[107]],function(_0x7920x2c){_0x7920x15(_0x7920x20,_0xfb38[158],_0x7920x2c)})}})}},updateTriggers:function(_0x7920x2d){return function(){return triggers[_0xfb38[193]](_0x7920x2d)}},queueAdd:function(_0x7920x2f,_0x7920x30){return function(){if(_0x7920x2f&& _0x7920x30){_[_0xfb38[101]](_0x7920x2f,function(_0x7920x1e){_0x7920x15(null,util[_0xfb38[57]](_0xfb38[194],_0x7920x30),_0x7920x1e[0])})}}},queueRemove:function(_0x7920x1e,_0x7920x30){return function(){if(_0x7920x1e&& _0x7920x30){_0x7920x15(null,util[_0xfb38[57]](_0xfb38[195],_0x7920x30),_0x7920x1e)}}},checkTriggers:function(_0x7920x2d){return function(){return triggers[_0xfb38[196]](_0x7920x2d)}}}}