8f08c0836a54c7fc5c6ef90705eff67763c740dd
[motion.git] / server / config / ami / socket.js
1 var _0x5f7c=["\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\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","\x71\x75\x65\x75\x65\x73","\x69\x6E\x62\x6F\x75\x6E\x64","\x77\x61\x69\x74\x69\x6E\x67","\x61\x63\x74\x69\x76\x65","\x63\x6F\x6D\x70\x6C\x65\x74\x65\x64","\x61\x62\x61\x6E\x64\x6F\x6E\x65\x64","\x75\x6E\x6D\x61\x6E\x61\x67\x65\x64","\x68\x6F\x6C\x64\x74\x69\x6D\x65","\x74\x61\x6C\x6B\x74\x69\x6D\x65","\x61\x76\x67\x48\x6F\x6C\x64\x74\x69\x6D\x65","\x61\x76\x67\x54\x61\x6C\x6B\x74\x69\x6D\x65","\x61\x62\x61\x6E\x64\x6F\x6E\x52\x61\x74\x65","\x69\x73\x57\x61\x69\x74\x69\x6E\x67","\x69\x73\x41\x63\x74\x69\x76\x65","\x69\x73\x43\x6F\x6D\x70\x6C\x65\x74\x65\x64","\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","\x69\x73\x41\x62\x61\x6E\x64\x6F\x6E\x65\x64","\x69\x73\x55\x6E\x6D\x61\x6E\x61\x67\x65\x64","\x74\x79\x70\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x6E\x61\x6D\x65","\x6B\x65\x79\x42\x79","\x61\x67\x65\x6E\x74\x73","\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","\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","\x76\x6F\x69\x63\x65\x2F\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2F\x63\x68\x61\x6E\x6E\x65\x6C\x73","\x76\x6F\x69\x63\x65\x3A\x6F\x75\x74\x62\x6F\x75\x6E\x64\x3A\x63\x68\x61\x6E\x6E\x65\x6C\x73","\x76\x6F\x69\x63\x65\x2F\x69\x6E\x62\x6F\x75\x6E\x64\x2F\x63\x68\x61\x6E\x6E\x65\x6C\x73","\x76\x6F\x69\x63\x65\x3A\x69\x6E\x62\x6F\x75\x6E\x64\x3A\x63\x68\x61\x6E\x6E\x65\x6C\x73","\x6C\x69\x6E\x6B\x65\x64\x69\x64","\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","\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\x73\x61\x76\x65","\x61\x64\x6D\x69\x6E\x73","\x72\x65\x70\x6F\x72\x74\x5F\x64\x69\x61\x6C\x3A\x75\x70\x64\x61\x74\x65","\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","\x2F","\x70\x65\x65\x72","\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","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x64\x6F\x6D\x61\x69\x6E","\x73\x61\x74\x75\x73","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\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","\x74\x72\x75\x6E\x6B","\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","\x76\x6F\x69\x63\x65\x2F\x69\x6E\x62\x6F\x75\x6E\x64\x2F\x71\x75\x65\x75\x65\x73\x2F\x25\x73","\x76\x6F\x69\x63\x65\x3A\x69\x6E\x62\x6F\x75\x6E\x64\x3A\x71\x75\x65\x75\x65\x73\x3A\x25\x73","\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","\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","\x69\x6E\x74\x65\x72\x66\x61\x63\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","\x73\x74\x61\x74\x65\x69\x6E\x74\x65\x72\x66\x61\x63\x65","\x70\x65\x6E\x61\x6C\x74\x79","\x63\x61\x6C\x6C\x73\x74\x61\x6B\x65\x6E","\x73\x74\x61\x74\x75\x73","\x70\x61\x75\x73\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","\x49\x4E\x55\x53\x45","\x52\x49\x4E\x47\x49\x4E\x47","\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","\x65\x76\x65\x6E\x74","\x63\x6F\x6E\x74\x65\x78\x74","\x64\x69\x61\x6C\x73\x74\x72\x69\x6E\x67","\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","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\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"];_0x5f7c[0];var _=require(_0x5f7c[1]);var util=require(_0x5f7c[2]);var moment=require(_0x5f7c[3]);var BPromise=require(_0x5f7c[4]);var redis=require(_0x5f7c[5]);var VoiceQueue=require(_0x5f7c[7])[_0x5f7c[6]];var ReportQueue=require(_0x5f7c[7])[_0x5f7c[8]];var ReportCall=require(_0x5f7c[7])[_0x5f7c[9]];var ReportAgent=require(_0x5f7c[7])[_0x5f7c[10]];var ReportDial=require(_0x5f7c[7])[_0x5f7c[11]];var ReportMember=require(_0x5f7c[7])[_0x5f7c[12]];var User=require(_0x5f7c[7])[_0x5f7c[13]];var Triggers=require(_0x5f7c[14]);var config=require(_0x5f7c[15]);var utils=require(_0x5f7c[16]);var redisConf;if(config[_0x5f7c[17]]){redisConf= {password:config[_0x5f7c[17]]}};var redisClient=redis[_0x5f7c[19]](6379,config[_0x5f7c[18]],redisConf);var io=require(_0x5f7c[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[_0x5f7c[21]]= function(){var _0xe45fx15=function(_0xe45fx16,_0xe45fx17,_0xe45fx18){if(_0xe45fx16){io[_0x5f7c[23]](_0xe45fx16)[_0x5f7c[22]](_0xe45fx17,_0xe45fx18)}else {io[_0x5f7c[22]](_0xe45fx17,_0xe45fx18)}};VoiceQueue[_0x5f7c[65]]({attributes:[_0x5f7c[66]],raw:true})[_0x5f7c[41]](function(_0xe45fx1a){if(_0xe45fx1a){params[_0x5f7c[44]][_0x5f7c[43]]= _[_0x5f7c[69]](_[_0x5f7c[67]](_0xe45fx1a,_0x5f7c[66]),function(_0xe45fx1f,_0xe45fx20){_0xe45fx1f[_0x5f7c[68]]= {};_0xe45fx1f[_0x5f7c[45]]= 0;_0xe45fx1f[_0x5f7c[46]]= 0;_0xe45fx1f[_0x5f7c[47]]= 0;_0xe45fx1f[_0x5f7c[48]]= 0;_0xe45fx1f[_0x5f7c[49]]= 0;_0xe45fx1f[_0x5f7c[50]]= 0;_0xe45fx1f[_0x5f7c[51]]= 0;_0xe45fx1f[_0x5f7c[52]]= 0;_0xe45fx1f[_0x5f7c[53]]= 0;_0xe45fx1f[_0x5f7c[40]]= 0;_0xe45fx1f[_0x5f7c[54]]= 0;_0xe45fx1f[_0x5f7c[27]]= 0});return ReportQueue[_0x5f7c[65]]({attributes:[_0x5f7c[42],_0x5f7c[58],_0x5f7c[61],_0x5f7c[70],_0x5f7c[71],_0x5f7c[72],_0x5f7c[50]],raw:true})}})[_0x5f7c[41]](function(_0xe45fx1a){if(_0xe45fx1a){var _0xe45fx1b;var _0xe45fx1c;var _0xe45fx1d=_0xe45fx1a[_0x5f7c[26]];for(var _0xe45fx1e=0;_0xe45fx1e< _0xe45fx1d;_0xe45fx1e++){_0xe45fx1b= _0xe45fx1a[_0xe45fx1e];_0xe45fx1c= _0xe45fx1b[_0x5f7c[42]];if(!params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c]){params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c]= {};params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[45]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[46]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[48]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[49]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[50]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[51]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[52]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[53]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[40]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[54]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[27]]= 0};params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[27]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[27]]++;if(utils[_0x5f7c[55]](_0xe45fx1b)){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[45]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[45]]++};if(utils[_0x5f7c[56]](_0xe45fx1b)){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[46]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[46]]++};if(utils[_0x5f7c[57]](_0xe45fx1b)){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]]++;params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[50]]+= _0xe45fx1b[_0x5f7c[50]]|| 0;params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[51]]+= moment(_0xe45fx1b[_0x5f7c[61]])[_0x5f7c[60]](moment(_0xe45fx1b[_0x5f7c[58]]),_0x5f7c[59]);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[52]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[50]]/ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]]);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[53]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[51]]/ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]]);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[50]]+= _0xe45fx1b[_0x5f7c[50]]|| 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[51]]+= moment(_0xe45fx1b[_0x5f7c[61]])[_0x5f7c[60]](moment(_0xe45fx1b[_0x5f7c[58]]),_0x5f7c[59]);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[52]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[50]]/ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]]);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[53]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[51]]/ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]])};if(utils[_0x5f7c[62]](_0xe45fx1b)){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[48]]++};if(utils[_0x5f7c[63]](_0xe45fx1b)){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[49]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[49]]++}};params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[40]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]]/ (params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[54]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[48]]/ (params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1c][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[40]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]/ (params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[54]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]]/ (params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]])* 100,2)};return ReportCall[_0x5f7c[65]]({where:{type:_0x5f7c[29]},attributes:[_0x5f7c[64],_0x5f7c[32],_0x5f7c[35]],raw:true})})[_0x5f7c[41]](function(_0xe45fx1a){if(_0xe45fx1a){if(_0xe45fx1a[_0x5f7c[26]]){params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[27]]= _0xe45fx1a[_0x5f7c[26]];params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]= _[_0x5f7c[33]](_0xe45fx1a,_0x5f7c[32])[_0x5f7c[31]]|| 0;params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[34]]= _[_0x5f7c[36]](_0xe45fx1a,_0x5f7c[35]);if(params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]){params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[37]]= _[_0x5f7c[39]]((_[_0x5f7c[36]](_0xe45fx1a[_0x5f7c[38]],_0x5f7c[35])/ params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]));params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[40]]= _[_0x5f7c[39]](params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]/ params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[27]]* 100,1)}}}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[24]](_0xe45fx19)});return {cdr:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx21[_0x5f7c[64]]=== _0x5f7c[29]){params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[27]]++;params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]= (_0xe45fx21[_0x5f7c[32]]=== _0x5f7c[31])?++params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]:params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]];params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[34]]+= Number(_0xe45fx21[_0x5f7c[35]]);if(params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]){params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[37]]= _[_0x5f7c[39]](params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[34]]/ params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]);params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[40]]= _[_0x5f7c[39]](params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[30]]/ params[_0x5f7c[29]][_0x5f7c[28]][_0x5f7c[27]]* 100,1)};_0xe45fx15(_0x5f7c[73],_0x5f7c[74],params[_0x5f7c[29]][_0x5f7c[28]])};_0xe45fx15(_0x5f7c[68],_0x5f7c[75],_0xe45fx21);return BPromise[_0x5f7c[76]]()}},send:function(_0xe45fx21){return function(_0xe45fx1a){return BPromise[_0x5f7c[76]]()}},hangup:function(_0xe45fx21){return function(_0xe45fx1a){if(params[_0x5f7c[29]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]]){delete params[_0x5f7c[29]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]];_0xe45fx15(_0x5f7c[79],_0x5f7c[80],params[_0x5f7c[29]][_0x5f7c[78]])};if(params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]]){delete params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]];_0xe45fx15(_0x5f7c[81],_0x5f7c[82],params[_0x5f7c[44]][_0x5f7c[78]])};var _0xe45fx22={uniqueid:_0xe45fx21[_0x5f7c[77]],linkedid:_0xe45fx21[_0x5f7c[83]],endtime:moment()[_0x5f7c[85]](_0x5f7c[84]),lastevent:_0x5f7c[86],updatedAt:moment()[_0x5f7c[85]](_0x5f7c[84])};_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx21[_0x5f7c[89]][_0x5f7c[88]](/\/|-/)[1]),_0x5f7c[90],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[92],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[92],_0xe45fx22);if(_0xe45fx1a){triggers[_0x5f7c[94]](_0xe45fx1a)};return BPromise[_0x5f7c[76]]()}},devicestatechange:function(_0xe45fx21){return function(_0xe45fx1a){return User[_0x5f7c[107]]({where:{name:_0xe45fx21[_0x5f7c[106]][_0x5f7c[105]](_0x5f7c[103],_0x5f7c[104])},raw:true})[_0x5f7c[41]](function(_0xe45fx23){if(_0xe45fx23){var _0xe45fx22=_[_0x5f7c[99]]({newValues:{id:_0xe45fx23[_0x5f7c[97]],status:_0xe45fx21[_0x5f7c[98]],statusAt:moment()[_0x5f7c[85]](_0x5f7c[84])}},_0xe45fx23,{status:_0xe45fx21[_0x5f7c[98]],statusAt:moment()[_0x5f7c[85]](_0x5f7c[84])});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[100],_0xe45fx23[_0x5f7c[101]],_0xe45fx23[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx22)}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[96]](_0x5f7c[95],_0xe45fx19)})}},peerstatus:function(_0xe45fx21){return function(_0xe45fx1a){var _0xe45fx24=_0xe45fx21[_0x5f7c[109]][_0x5f7c[88]](_0x5f7c[108])[1];if(params[_0x5f7c[110]][_0xe45fx24]){params[_0x5f7c[110]][_0xe45fx24][_0x5f7c[111]]= _0xe45fx21[_0x5f7c[111]];_0xe45fx15(_0x5f7c[112],_0x5f7c[113],params[_0x5f7c[110]][_0xe45fx24])};return BPromise[_0x5f7c[76]]()}},registry:function(_0xe45fx21){return function(_0xe45fx1a){params[_0x5f7c[110]][_0xe45fx21[_0x5f7c[114]]]= {username:_0xe45fx21[_0x5f7c[114]],domain:_0xe45fx21[_0x5f7c[115]],status:_0xe45fx21[_0x5f7c[116]]};_0xe45fx15(_0x5f7c[112],_0x5f7c[113],params[_0x5f7c[110]][_0xe45fx21[_0x5f7c[114]]]);return BPromise[_0x5f7c[76]]()}},agentcalled:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a){_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx1a[_0x5f7c[117]]),_0x5f7c[118],_0xe45fx1a);triggers[_0x5f7c[119]](_0xe45fx1a)};return User[_0x5f7c[107]]({where:{name:_0xe45fx21[_0x5f7c[117]],voicePause:false},raw:true})[_0x5f7c[41]](function(_0xe45fx23){if(_0xe45fx23){var _0xe45fx25=moment()[_0x5f7c[85]](_0x5f7c[84]);var _0xe45fx22=_[_0x5f7c[99]]({newValues:{id:_0xe45fx23[_0x5f7c[97]],queueStatus:_0x5f7c[121],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]}},_0xe45fx23,{queueStatus:_0x5f7c[121],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[100],_0xe45fx23[_0x5f7c[101]],_0xe45fx23[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx22)}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[96]](_0x5f7c[120],_0xe45fx19)})}},registryentry:function(_0xe45fx21){return function(_0xe45fx1a){params[_0x5f7c[122]][_0xe45fx21[_0x5f7c[114]]]= {username:_0xe45fx21[_0x5f7c[114]],domain:_0xe45fx21[_0x5f7c[115]],status:_0xe45fx21[_0x5f7c[98]]};_0xe45fx15(_0x5f7c[112],_0x5f7c[113],params[_0x5f7c[110]][_0xe45fx21[_0x5f7c[114]]]);return BPromise[_0x5f7c[76]]()}},agentcomplete:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a){triggers[_0x5f7c[123]](_0xe45fx1a)};if(params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[46]]){params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[46]]--};if(params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[46]]){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[46]]--;_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[46],amount:-1,queue:_0xe45fx21[_0x5f7c[42]]})};params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]++;_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[86],amount:1,queue:_0xe45fx21[_0x5f7c[42]]});params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[40]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]/ (params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[54]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]]/ (params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[40]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]/ (params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[54]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[48]]/ (params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[51]]+= Number(_0xe45fx21[_0x5f7c[51]]);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[51]]+= Number(_0xe45fx21[_0x5f7c[51]]);_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[51],amount:Number(_0xe45fx21[_0x5f7c[51]]),queue:_0xe45fx21[_0x5f7c[42]]});params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[53]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[51]]/ params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[53]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[51]]/ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[50]]+= Number(_0xe45fx21[_0x5f7c[50]]);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[50]]+= Number(_0xe45fx21[_0x5f7c[50]]);_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[50],amount:Number(_0xe45fx21[_0x5f7c[50]]),queue:_0xe45fx21[_0x5f7c[42]]});params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[52]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[50]]/ params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[52]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[50]]/ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[125],_0xe45fx21[_0x5f7c[42]]),util[_0x5f7c[85]](_0x5f7c[126],_0xe45fx21[_0x5f7c[42]]),params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]]);var _0xe45fx22;var _0xe45fx25=moment()[_0x5f7c[85]](_0x5f7c[84]);return ReportAgent[_0x5f7c[107]]({where:{uniqueid:_0xe45fx21[_0x5f7c[77]],destuniqueid:_0xe45fx21[_0x5f7c[130]]},raw:true})[_0x5f7c[41]](function(_0xe45fx26){if(_0xe45fx26){_0xe45fx22= _[_0x5f7c[99]]({},_0xe45fx26,{lastevent:_0x5f7c[86],agentcomplete:true,agentcompleteAt:_0xe45fx25,talktime:Number(_0xe45fx21[_0x5f7c[51]]),reason:_0xe45fx21[_0x5f7c[129]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx26[_0x5f7c[117]]),_0x5f7c[118],_0xe45fx22)};return ReportQueue[_0x5f7c[107]]({where:{uniqueid:_0xe45fx21[_0x5f7c[77]]},raw:true})})[_0x5f7c[41]](function(_0xe45fx26){if(_0xe45fx26){_0xe45fx22= _[_0x5f7c[99]]({},_0xe45fx26,{queuecallercomplete:true,queuecallercompleteAt:_0xe45fx25});_0xe45fx15(_0xe45fx26[_0x5f7c[42]],_0x5f7c[128],_0xe45fx22)};return User[_0x5f7c[107]]({where:{name:_0xe45fx21[_0x5f7c[117]],voicePause:false},raw:true})})[_0x5f7c[41]](function(_0xe45fx23){if(_0xe45fx23){var _0xe45fx22=_[_0x5f7c[99]]({newValues:{id:_0xe45fx23[_0x5f7c[97]],queueStatus:_0x5f7c[86],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]}},_0xe45fx23,{queueStatus:_0x5f7c[86],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[100],_0xe45fx23[_0x5f7c[101]],_0xe45fx23[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx22)}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[96]](_0x5f7c[127],_0xe45fx19)})}},agentconnect:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a){triggers[_0x5f7c[123]](_0xe45fx1a)};if(params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[45]]){params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[45]]--;_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[45],amount:-1,queue:_0xe45fx21[_0x5f7c[42]]})};if(params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[45]]){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[45]]--};if(params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]]){params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[131]]= _0xe45fx21[_0x5f7c[132]];params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[133]]= _0xe45fx21[_0x5f7c[133]];params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[50]]= Number(_0xe45fx21[_0x5f7c[50]]);params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[134]]= Number(_0xe45fx21[_0x5f7c[134]]);params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[135]]= _0xe45fx21[_0x5f7c[135]];params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[117]]= _0xe45fx21[_0x5f7c[117]];_0xe45fx15(_0x5f7c[81],_0x5f7c[82],params[_0x5f7c[44]][_0x5f7c[78]])};params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[46]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[46]]++;_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[46],amount:1,queue:_0xe45fx21[_0x5f7c[42]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[125],_0xe45fx21[_0x5f7c[42]]),util[_0x5f7c[85]](_0x5f7c[126],_0xe45fx21[_0x5f7c[42]]),params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]]);var _0xe45fx22;var _0xe45fx25=moment()[_0x5f7c[85]](_0x5f7c[84]);return ReportQueue[_0x5f7c[107]]({where:{uniqueid:_0xe45fx21[_0x5f7c[77]]},raw:true})[_0x5f7c[41]](function(_0xe45fx26){if(_0xe45fx26){_0xe45fx22= _[_0x5f7c[99]]({},_0xe45fx26,{queuecallerleaveAt:moment()[_0x5f7c[85]](_0x5f7c[84]),holdtime:_0xe45fx21[_0x5f7c[50]],assigned:true,lastAssignedTo:_0xe45fx21[_0x5f7c[117]]});_0xe45fx15(_0xe45fx26[_0x5f7c[42]],_0x5f7c[128],_0xe45fx22)};return ReportAgent[_0x5f7c[107]]({where:{uniqueid:_0xe45fx21[_0x5f7c[77]],destuniqueid:_0xe45fx21[_0x5f7c[130]]},raw:true})})[_0x5f7c[41]](function(_0xe45fx26){if(_0xe45fx26){_0xe45fx22= _[_0x5f7c[99]]({},_0xe45fx26,{lastevent:_0x5f7c[137],agentconnectAt:moment()[_0x5f7c[85]](_0x5f7c[84]),holdtime:_0xe45fx21[_0x5f7c[50]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx26[_0x5f7c[117]]),_0x5f7c[118],_0xe45fx22)};return ReportAgent[_0x5f7c[65]]({where:{uniqueid:_0xe45fx21[_0x5f7c[77]],destuniqueid:{$ne:_0xe45fx21[_0x5f7c[130]]},reason:null},raw:true})})[_0x5f7c[41]](function(_0xe45fx28){if(_0xe45fx28&& _0xe45fx28[_0x5f7c[26]]){_[_0x5f7c[69]](_0xe45fx28,function(_0xe45fx26){_0xe45fx22= _[_0x5f7c[99]]({},_0xe45fx26,{lastevent:_0x5f7c[138],agentringnoanswer:true,agentringnoanswerAt:_0xe45fx25,reason:_0x5f7c[138],answeredelsewheredestinationuniqueid:_0xe45fx21[_0x5f7c[130]],answeredelsewheremembername:_0xe45fx21[_0x5f7c[117]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx26[_0x5f7c[117]]),_0x5f7c[118],_0xe45fx22)})};return User[_0x5f7c[107]]({where:{name:_0xe45fx21[_0x5f7c[117]],voicePause:false},raw:true})})[_0x5f7c[41]](function(_0xe45fx23){if(_0xe45fx23){var _0xe45fx22=_[_0x5f7c[99]]({newValues:{id:_0xe45fx23[_0x5f7c[97]],queueStatus:_0x5f7c[137],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]}},_0xe45fx23,{queueStatus:_0x5f7c[137],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[100],_0xe45fx23[_0x5f7c[101]],_0xe45fx23[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx22)};return User[_0x5f7c[65]]({where:{lastQueue:_0xe45fx21[_0x5f7c[42]],name:{$ne:_0xe45fx21[_0x5f7c[117]]}},raw:true})})[_0x5f7c[41]](function(_0xe45fx27){if(_0xe45fx27&& _0xe45fx27[_0x5f7c[26]]){_[_0x5f7c[69]](_0xe45fx27,function(_0xe45fx23){var _0xe45fx22=_[_0x5f7c[99]]({newValues:{id:_0xe45fx23[_0x5f7c[97]],queueStatus:_0x5f7c[86],queueStatusAt:_0xe45fx25}},_0xe45fx23,{queueStatus:_0x5f7c[86],queueStatusAt:_0xe45fx25});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[100],_0xe45fx23[_0x5f7c[101]],_0xe45fx23[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx22)})}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[96]](_0x5f7c[136],_0xe45fx19)})}},agentringnoanswer:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a){triggers[_0x5f7c[123]](_0xe45fx1a)};var _0xe45fx22;var _0xe45fx25=moment()[_0x5f7c[85]](_0x5f7c[84]);return User[_0x5f7c[107]]({where:{name:_0xe45fx21[_0x5f7c[117]],voicePause:false},raw:true})[_0x5f7c[41]](function(_0xe45fx23){if(_0xe45fx23){var _0xe45fx22=_[_0x5f7c[99]]({newValues:{id:_0xe45fx23[_0x5f7c[97]],queueStatus:_0x5f7c[86],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]}},_0xe45fx23,{queueStatus:_0x5f7c[86],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[100],_0xe45fx23[_0x5f7c[101]],_0xe45fx23[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx22)};return ReportAgent[_0x5f7c[107]]({where:{uniqueid:_0xe45fx21[_0x5f7c[77]],destuniqueid:_0xe45fx21[_0x5f7c[130]]},raw:true})})[_0x5f7c[41]](function(_0xe45fx26){if(_0xe45fx26){_0xe45fx22= _[_0x5f7c[99]]({},_0xe45fx26,{lastevent:_0x5f7c[140],agentringnoanswer:true,agentringnoanswerAt:moment()[_0x5f7c[85]](_0x5f7c[84]),reason:_0x5f7c[140]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx26[_0x5f7c[117]]),_0x5f7c[118],_0xe45fx22)}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[96]](_0x5f7c[139],_0xe45fx19)})}},queuememberadded:function(_0xe45fx21){return function(_0xe45fx1a){params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[68]][_0xe45fx21[_0x5f7c[117]]]= {membername:_0xe45fx21[_0x5f7c[117]],interface:_0xe45fx21[_0x5f7c[141]],penalty:Number(_0xe45fx21[_0x5f7c[142]]),callstaken:Number(_0xe45fx21[_0x5f7c[143]]),lastcall:_0xe45fx21[_0x5f7c[143]],status:Number(_0xe45fx21[_0x5f7c[144]]),paused:Number(_0xe45fx21[_0x5f7c[145]])};_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[125],_0xe45fx21[_0x5f7c[42]]),util[_0x5f7c[85]](_0x5f7c[126],_0xe45fx21[_0x5f7c[42]]),params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]]);if(_0xe45fx1a){_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[146],_0xe45fx1a);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx1a.UserId),_0x5f7c[146],_0xe45fx1a)};return BPromise[_0x5f7c[76]]()}},queuememberremoved:function(_0xe45fx21){return function(_0xe45fx1a){delete params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[68]][_0xe45fx21[_0x5f7c[117]]];_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[125],_0xe45fx21[_0x5f7c[42]]),util[_0x5f7c[85]](_0x5f7c[126],_0xe45fx21[_0x5f7c[42]]),params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]]);return User[_0x5f7c[107]]({where:{name:_0xe45fx21[_0x5f7c[135]][_0x5f7c[105]](_0x5f7c[103],_0x5f7c[104])},raw:true})[_0x5f7c[41]](function(_0xe45fx23){if(_0xe45fx23){_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[148],{queue:_0xe45fx21[_0x5f7c[42]],UserId:_0xe45fx23[_0x5f7c[97]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx23[_0x5f7c[97]]),_0x5f7c[148],{queue:_0xe45fx21[_0x5f7c[42]],UserId:_0xe45fx23[_0x5f7c[97]]})}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[24]](_0x5f7c[147],_0xe45fx19)})}},queuememberpause:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a){_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[146],_0xe45fx1a);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx1a.UserId),_0x5f7c[146],_0xe45fx1a)};var _0xe45fx22;var _0xe45fx25=moment()[_0x5f7c[85]](_0x5f7c[84]);return User[_0x5f7c[107]]({where:{name:_0xe45fx21[_0x5f7c[117]]},raw:true})[_0x5f7c[41]](function(_0xe45fx23){if(_0xe45fx23){var _0xe45fx29={id:_0xe45fx23[_0x5f7c[97]],voicePause:false,queueStatusAt:_0xe45fx25};if(parseInt(_0xe45fx21[_0x5f7c[145]],10)){_[_0x5f7c[150]](_0xe45fx29,{voicePause:true,chatPause:true,mailPause:true,faxPause:true,smsPause:true,openchannelPause:true,pauseType:_0xe45fx21[_0x5f7c[129]],lastPauseAt:_0xe45fx25,queueStatus:_0x5f7c[145]})}else {switch(_0xe45fx23[_0x5f7c[144]]){case _0x5f7c[152]:_0xe45fx29[_0x5f7c[151]]= _0x5f7c[137];break;case _0x5f7c[153]:_0xe45fx29[_0x5f7c[151]]= _0x5f7c[121];break;default:_0xe45fx29[_0x5f7c[151]]= _0x5f7c[86]}};var _0xe45fx22=_[_0x5f7c[99]]({newValues:_0xe45fx29},_0xe45fx23,_0xe45fx29);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[100],_0xe45fx23[_0x5f7c[101]],_0xe45fx23[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx22)}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[96]](_0x5f7c[149],_0xe45fx19)})}},queuememberpenalty:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a){_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[146],_0xe45fx1a);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx1a.UserId),_0x5f7c[146],_0xe45fx1a)};return BPromise[_0x5f7c[76]]()}},queuememberringinuse:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a){_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[146],_0xe45fx1a);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx1a.UserId),_0x5f7c[146],_0xe45fx1a)};return BPromise[_0x5f7c[76]]()}},queuememberstatus:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a){_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[146],_0xe45fx1a);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx1a.UserId),_0x5f7c[146],_0xe45fx1a)};return BPromise[_0x5f7c[76]]()}},queuemember:function(_0xe45fx21){return function(_0xe45fx1a){params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[68]][_0xe45fx21[_0x5f7c[66]]]= {membername:_0xe45fx21[_0x5f7c[66]],interface:_0xe45fx21[_0x5f7c[141]],penalty:Number(_0xe45fx21[_0x5f7c[142]]),callstaken:Number(_0xe45fx21[_0x5f7c[143]]),lastcall:_0xe45fx21[_0x5f7c[143]],status:Number(_0xe45fx21[_0x5f7c[144]]),paused:Number(_0xe45fx21[_0x5f7c[145]])};return BPromise[_0x5f7c[76]]()}},queuecallerjoin:function(_0xe45fx21){if(!params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]]){params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]]= {};params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[45]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[46]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[48]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[49]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[50]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[51]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[52]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[53]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[40]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[54]]= 0;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[27]]= 0};params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]]= {channel:_0xe45fx21[_0x5f7c[89]],channelstate:Number(_0xe45fx21[_0x5f7c[154]]),channelstatedesc:_0xe45fx21[_0x5f7c[155]],calleridnum:_0xe45fx21[_0x5f7c[156]],calleridname:_0xe45fx21[_0x5f7c[157]],exten:_0xe45fx21[_0x5f7c[158]],priority:Number(_0xe45fx21[_0x5f7c[159]]),uniqueid:_0xe45fx21[_0x5f7c[77]],queue:_0xe45fx21[_0x5f7c[42]],position:Number(_0xe45fx21[_0x5f7c[160]]),count:Number(_0xe45fx21[_0x5f7c[161]])};_0xe45fx15(_0x5f7c[81],_0x5f7c[82],params[_0x5f7c[44]][_0x5f7c[78]]);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[45]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[45]]++;_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[27],amount:1,queue:_0xe45fx21[_0x5f7c[42]]});params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[27]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[27]]++;_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[45],amount:1,queue:_0xe45fx21[_0x5f7c[42]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[125],_0xe45fx21[_0x5f7c[42]]),util[_0x5f7c[85]](_0x5f7c[126],_0xe45fx21[_0x5f7c[42]]),params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]]);return function(_0xe45fx1a){if(_0xe45fx1a){_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[162],_0xe45fx1a)};return BPromise[_0x5f7c[76]]()}},queuecallerabandon:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx1a[0]){_[_0x5f7c[69]](_0xe45fx1a[1],function(_0xe45fx26){triggers[_0x5f7c[123]](_0xe45fx26);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx26[_0x5f7c[117]]),_0x5f7c[118],_0xe45fx26)})};var _0xe45fx22;var _0xe45fx25=moment()[_0x5f7c[85]](_0x5f7c[84]);return ReportQueue[_0x5f7c[107]]({where:{uniqueid:_0xe45fx21[_0x5f7c[77]],queuecallerexit:false},raw:true})[_0x5f7c[41]](function(_0xe45fx26){if(_0xe45fx26){if(params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[45]]){params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[45]]--;_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[45],amount:-1,queue:_0xe45fx21[_0x5f7c[42]]})};if(params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[45]]){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[45]]--};if(params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]]){params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[50]]= Number(_0xe45fx21[_0x5f7c[50]]);params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[160]]= Number(_0xe45fx21[_0x5f7c[160]]);params[_0x5f7c[44]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[164]]= Number(_0xe45fx21[_0x5f7c[164]]);_0xe45fx15(_0x5f7c[81],_0x5f7c[82],params[_0x5f7c[44]][_0x5f7c[78]])};params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]]++;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[48]]++;_0xe45fx15(_0xe45fx21[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[165],amount:1,queue:_0xe45fx21[_0x5f7c[42]]});params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[40]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]/ (params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[54]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]]/ (params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[40]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]/ (params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[48]])* 100,2);params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[54]]= _[_0x5f7c[39]](params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[48]]/ (params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[47]]+ params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]][_0x5f7c[48]])* 100,2);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[125],_0xe45fx21[_0x5f7c[42]]),util[_0x5f7c[85]](_0x5f7c[126],_0xe45fx21[_0x5f7c[42]]),params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx21[_0x5f7c[42]]]);_0xe45fx15(_0xe45fx26[_0x5f7c[42]],_0x5f7c[128],_[_0x5f7c[150]](_0xe45fx26,{queuecallerabandon:true,queuecallerabandonAt:_0xe45fx25,queuecallerleaveAt:_0xe45fx25,originalposition:_0xe45fx21[_0x5f7c[164]],position:_0xe45fx21[_0x5f7c[160]],holdtime:_0xe45fx21[_0x5f7c[50]]}))};return User[_0x5f7c[65]]({where:{lastQueue:_0xe45fx21[_0x5f7c[42]],voicePause:false},raw:true})})[_0x5f7c[41]](function(_0xe45fx2a){if(_0xe45fx2a&& _0xe45fx2a[_0x5f7c[26]]){var _0xe45fx22;_[_0x5f7c[69]](_0xe45fx2a,function(_0xe45fx2b){_0xe45fx22= _[_0x5f7c[99]]({newValues:{id:_0xe45fx2b[_0x5f7c[97]],queueStatus:_0x5f7c[86],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]}},_0xe45fx2b,{id:_0xe45fx2b[_0x5f7c[97]],queueStatus:_0x5f7c[86],queueStatusAt:_0xe45fx25,lastQueue:_0xe45fx21[_0x5f7c[42]]});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[100],_0xe45fx2b[_0x5f7c[101]],_0xe45fx2b[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx22)})}})[_0x5f7c[25]](function(_0xe45fx19){console[_0x5f7c[96]](_0x5f7c[163],_0xe45fx19)})}},blindtransfer:function(_0xe45fx21){return function(_0xe45fx1a){_0xe45fx15(null,_0xe45fx21[_0x5f7c[167]][_0x5f7c[166]](),_0xe45fx21);return BPromise[_0x5f7c[76]]()}},attendedtransfer:function(_0xe45fx21){return function(_0xe45fx1a){_0xe45fx15(null,_0xe45fx21[_0x5f7c[167]][_0x5f7c[166]](),_0xe45fx21);return BPromise[_0x5f7c[76]]()}},dialbegin:function(_0xe45fx21){return function(_0xe45fx1a){params[_0x5f7c[29]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]]= {channel:_0xe45fx21[_0x5f7c[89]],channelstate:Number(_0xe45fx21[_0x5f7c[154]]),channelstatedesc:_0xe45fx21[_0x5f7c[155]],calleridnum:_0xe45fx21[_0x5f7c[156]],calleridname:_0xe45fx21[_0x5f7c[157]],context:_0xe45fx21[_0x5f7c[168]],exten:_0xe45fx21[_0x5f7c[158]],priority:Number(_0xe45fx21[_0x5f7c[159]]),dialstring:_0xe45fx21[_0x5f7c[169]]};_0xe45fx15(_0x5f7c[79],_0x5f7c[80],params[_0x5f7c[29]][_0x5f7c[78]]);if(_0xe45fx21[_0x5f7c[89]]){var _0xe45fx22=_[_0x5f7c[150]](_0xe45fx21,{starttime:moment()[_0x5f7c[85]](_0x5f7c[84]),lastevent:_0x5f7c[121],updatedAt:moment()[_0x5f7c[85]](_0x5f7c[84])});_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx21[_0x5f7c[89]][_0x5f7c[88]](/\/|-/)[1]),_0x5f7c[90],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[92],_[_0x5f7c[150]](_0xe45fx22,{role:_0x5f7c[93]}));_0xe45fx15(_0x5f7c[91],_0x5f7c[92],_0xe45fx22,_[_0x5f7c[150]](_0xe45fx22,{role:_0x5f7c[91]}));if(_0xe45fx1a){triggers[_0x5f7c[94]](_0xe45fx1a)}};return BPromise[_0x5f7c[76]]()}},dialend:function(_0xe45fx21){return function(_0xe45fx1a){params[_0x5f7c[29]][_0x5f7c[78]][_0xe45fx21[_0x5f7c[77]]][_0x5f7c[170]]= _0xe45fx21[_0x5f7c[170]];_0xe45fx15(_0x5f7c[79],_0x5f7c[80],params[_0x5f7c[29]][_0x5f7c[78]]);if(_0xe45fx21[_0x5f7c[89]]){var _0xe45fx25=moment()[_0x5f7c[85]](_0x5f7c[84]);var _0xe45fx22={dialstatus:_0xe45fx21[_0x5f7c[170]],lastevent:(_0xe45fx21[_0x5f7c[170]]=== _0x5f7c[171])?_0x5f7c[137]:_0x5f7c[86],answertime:(_0xe45fx21[_0x5f7c[170]]=== _0x5f7c[171])?_0xe45fx25:null,uniqueid:_0xe45fx21[_0x5f7c[77]],linkedid:_0xe45fx21[_0x5f7c[83]],destuniqueid:_0xe45fx21[_0x5f7c[130]],destlinkedid:_0xe45fx21[_0x5f7c[172]],updatedAt:_0xe45fx25};_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx21[_0x5f7c[89]][_0x5f7c[88]](/\/|-/)[1]),_0x5f7c[92],_0xe45fx22);_0xe45fx15(_0x5f7c[93],_0x5f7c[92],_0xe45fx22);_0xe45fx15(_0x5f7c[91],_0x5f7c[92],_0xe45fx22);if(_0xe45fx1a){triggers[_0x5f7c[94]](_0xe45fx1a)}};return BPromise[_0x5f7c[76]]()}},varset:function(_0xe45fx21){return function(_0xe45fx1a){if(_0xe45fx21[_0x5f7c[175]][_0x5f7c[174]](_0x5f7c[173])){if(_0xe45fx1a){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[49]]+= 1;params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1a[_0x5f7c[42]]][_0x5f7c[49]]+= 1;_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[49],amount:1,queue:_0xe45fx1a[_0x5f7c[42]]});if(params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1a[_0x5f7c[42]]][_0x5f7c[45]]){params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1a[_0x5f7c[42]]][_0x5f7c[45]]-= 1};if(params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[45]]){params[_0x5f7c[44]][_0x5f7c[28]][_0x5f7c[45]]-= 1};_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[124],{type:_0x5f7c[45],amount:-1,queue:_0xe45fx1a[_0x5f7c[42]]});_0xe45fx15(_0xe45fx1a[_0x5f7c[42]],_0x5f7c[128],_0xe45fx1a);_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[125],_0xe45fx1a[_0x5f7c[42]]),util[_0x5f7c[85]](_0x5f7c[126],_0xe45fx1a[_0x5f7c[42]]),params[_0x5f7c[44]][_0x5f7c[43]][_0xe45fx1a[_0x5f7c[42]]])}};if(_0xe45fx21[_0x5f7c[175]][_0x5f7c[174]](_0x5f7c[176])){_0xe45fx15(_0x5f7c[93],_0x5f7c[90],{uniqueid:_0xe45fx21[_0x5f7c[77]],routeId:_0xe45fx21[_0x5f7c[177]],updatedAt:moment()[_0x5f7c[85]](_0x5f7c[84])});_0xe45fx15(_0x5f7c[91],_0x5f7c[90],{uniqueid:_0xe45fx21[_0x5f7c[77]],routeId:_0xe45fx21[_0x5f7c[177]],updatedAt:moment()[_0x5f7c[85]](_0x5f7c[84])})};return BPromise[_0x5f7c[76]]()}},agentUpdate:function(_0xe45fx2b){return function(){_0xe45fx15(util[_0x5f7c[85]](_0x5f7c[87],_0xe45fx2b[_0x5f7c[97]]),_0x5f7c[102],_0xe45fx2b);_0xe45fx15(_0x5f7c[93],_0x5f7c[102],_0xe45fx2b);_0xe45fx15(_0x5f7c[91],_0x5f7c[102],_0xe45fx2b)}}}}