Built motion from commit 6e01242c4.|1.0.20
[motion.git] / server / config / forked_routing / openchannel / queue.js
1 var _0xf125=["\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","\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x6F\x6F\x6D","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x51\x75\x65\x75\x65","\x52\x65\x70\x6F\x72\x74\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C","\x52\x65\x70\x6F\x72\x74\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73","\x6D\x65\x73\x73\x61\x67\x65","\x74\x6F\x55\x70\x70\x65\x72\x43\x61\x73\x65","\x63\x68\x61\x6E\x6E\x65\x6C","\x41\x50\x50\x20\x51\x55\x45\x55\x45\x2C\x20\x51\x55\x45\x55\x45\x3A","\x6E\x61\x6D\x65","\x53\x54\x52\x41\x54\x45\x47\x59\x3A","\x73\x74\x72\x61\x74\x65\x67\x79","\x49\x4E\x54\x45\x52\x41\x43\x54\x49\x4F\x4E\x3A","\x75\x6E\x69\x71\x75\x65\x69\x64","\x41\x47\x45\x4E\x54","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x52\x45\x4A\x45\x43\x54\x45\x44","\x69\x6E\x66\x6F","\x69\x64","\x70\x75\x73\x68","\x72\x65\x6A\x65\x63\x74","\x74\x79\x70\x65","\x6F\x6E","\x66\x69\x6E\x64","\x74\x69\x6D\x65\x6F\x75\x74","\x6C\x65\x6E\x67\x74\x68","\x6D\x61\x70","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x6F\x6E\x6C\x69\x6E\x65","\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x50\x61\x75\x73\x65","\x46\x49\x45\x4C\x44\x28\x55\x73\x65\x72\x2E\x69\x64\x2C\x25\x73\x29","\x6A\x6F\x69\x6E","\x66\x6F\x72\x6D\x61\x74","\x45\x52\x52\x4F\x52","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x72\x65\x70\x6F\x72\x74\x5F\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x61\x67\x65\x6E\x74\x3A\x25\x64","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x74\x6F","\x67\x65\x74","\x41\x47\x45\x4E\x54\x20\x53\x45\x4C\x45\x43\x54\x45\x44\x3A","\x66\x69\x6E\x64\x49\x6E\x64\x65\x78","\x73\x70\x6C\x69\x63\x65","\x68\x65\x61\x64","\x71\x75\x65\x75\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x6D\x65\x72\x67\x65","\x63\x72\x65\x61\x74\x65","\x4E\x4F\x20\x41\x56\x41\x49\x4C\x41\x42\x4C\x45\x20\x41\x47\x45\x4E\x54\x53","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x74\x61\x63\x6B","\x72\x65\x70\x6F\x72\x74\x5F\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x61\x64\x6D\x69\x6E\x73","\x75\x73\x65\x72\x73","\x45\x4E\x44\x20\x28\x4E\x4F\x20\x41\x4E\x53\x57\x45\x52\x20\x42\x59\x20\x41\x47\x45\x4E\x54\x53\x29","\x75\x70\x64\x61\x74\x65","\x55\x73\x65\x72\x48\x61\x73\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x51\x75\x65\x75\x65\x2E\x70\x65\x6E\x61\x6C\x74\x79","\x67\x72\x6F\x75\x70\x42\x79","\x76\x61\x6C\x75\x65\x73","\x72\x65\x6D\x6F\x76\x65","\x63\x6C\x6F\x6E\x65","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x6C\x61\x73\x74\x41\x67\x65\x6E\x74","\x66\x69\x6E\x64\x42\x79\x49\x64","\x62\x65\x65\x70\x61\x6C\x6C","\x70\x65\x6E\x61\x6C\x74\x79","\x55\x73\x65\x72\x48\x61\x73\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x51\x75\x65\x75\x65","\x73\x6F\x72\x74\x42\x79","\x72\x6F\x75\x6E\x64\x72\x6F\x62\x69\x6E","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x5F\x72\x6F\x6F\x6D\x3A\x73\x61\x76\x65","\x72\x6F\x6F\x6D\x69\x64","\x54\x49\x4D\x45\x4F\x55\x54","\x53\x45\x43"];_0xf125[0];var _=require(_0xf125[1]);var util=require(_0xf125[2]);var moment=require(_0xf125[3]);var logger=require(_0xf125[5])(_0xf125[4]);var Agent=require(_0xf125[7])[_0xf125[6]];var Room=require(_0xf125[7])[_0xf125[8]];var Queue=require(_0xf125[7])[_0xf125[9]];var Report=require(_0xf125[7])[_0xf125[10]];var Session=require(_0xf125[7])[_0xf125[11]];module[_0xf125[12]]= function(_0xac3fxa,_0xac3fxb,_0xac3fxc,_0xac3fxd,_0xac3fxe){var _0xac3fxf=[];var _0xac3fx10;var _0xac3fx11;var _0xac3fx12;var _0xac3fx13=0;process[_0xf125[30]](_0xf125[13],function(_0xac3fxc){switch(_0xac3fxc[_0xf125[29]]){case _0xf125[28]:logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[22],_0xac3fxc[_0xf125[23]],_0xf125[24]);_0xac3fxf[_0xf125[27]]({id:_0xac3fxc[_0xf125[26]]});break;default:}});function _0xac3fx14(_0xac3fx15){var _0xac3fx16=_[_0xf125[31]](_0xac3fxf,{id:_0xac3fx15[_0xf125[26]]});return _0xac3fx16?true:false}function _0xac3fx17(){var _0xac3fx18=((_0xac3fxa[_0xf125[32]]- _0xac3fx13)> _0xac3fx12[_0xf125[32]])?_0xac3fx12[_0xf125[32]]:(_0xac3fxa[_0xf125[32]]- _0xac3fx13);if(_0xac3fx18> 0){if(_0xac3fx11[_0xf125[33]]){var _0xac3fx19={where:{id:{$in:_[_0xf125[34]](_0xac3fx11,_0xf125[26])},online:true,openchannelPause:false},include:[{model:Room,attributes:[_0xf125[26]],raw:true}],attributes:[_0xf125[26],_0xf125[17],_0xf125[35],_0xf125[36],_0xf125[37]],order:[[{raw:util[_0xf125[40]](_0xf125[38],_[_0xf125[34]](_0xac3fx11,_0xf125[26])[_0xf125[39]]())}]]};Agent[_0xf125[60]](_0xac3fx19)[_0xf125[44]](function(_0xac3fx1c){if(_0xac3fx1c[_0xf125[33]]){var _0xac3fx1d;for(var _0xac3fx1e=0;_0xac3fx1e< _0xac3fx1c[_0xf125[33]];_0xac3fx1e++){var _0xac3fx15=_0xac3fx1c[_0xac3fx1e][_0xf125[50]]({plain:true});if(!_0xac3fx14(_0xac3fx15)){_0xac3fx1d= _0xac3fx15;break}};if(_0xac3fx1d){logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[51],_0xac3fx1d[_0xf125[26]],_0xac3fx1d[_0xf125[17]]);var _0xac3fx1f=_[_0xf125[52]](_0xac3fx11,{"\x69\x64":_0xac3fx1d[_0xf125[26]]});if(_0xac3fx1f>= 0){var _0xac3fx20=_0xac3fx11[_0xf125[53]](_0xac3fx1f,1);if(_0xac3fx20&& _0xac3fx20[_0xf125[33]]){_0xac3fx11[_0xf125[27]](_[_0xf125[54]](_0xac3fx20))}};return Report[_0xf125[58]](_[_0xf125[57]](_0xac3fxb,{timeslot:_0xac3fx18,application:_0xf125[55],membername:_0xac3fx1d[_0xf125[17]],memberid:_0xac3fx1d[_0xf125[26]],queue:_0xac3fx12[_0xf125[26]],queuename:_0xac3fx12[_0xf125[17]],calledAt:moment()[_0xf125[40]](_0xf125[56])}))};logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[59]);return}else {logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[59]);return}})[_0xf125[44]](function(_0xac3fx1b){if(_0xac3fx1b){_0xac3fxd[_0xf125[49]](util[_0xf125[40]](_0xf125[47],_0xac3fx1b[_0xf125[48]]))[_0xf125[46]](_0xf125[45],_0xac3fx1b)}})[_0xf125[44]](function(){_0xac3fx10= setTimeout(function(){_0xac3fx13+= _0xac3fx12[_0xf125[32]];_0xac3fx17()},_0xac3fx18* 1000)})[_0xf125[43]](function(_0xac3fx1a){logger[_0xf125[42]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[41]);_0xac3fxe(_0xac3fx1a)})}else {logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[59]);_0xac3fx10= setTimeout(function(){_0xac3fx13+= _0xac3fx12[_0xf125[32]];_0xac3fx17()},_0xac3fx18* 1000)}}else {return Session[_0xf125[66]]({leaveAt:moment()[_0xf125[40]](_0xf125[56]),timeout:true},{where:{uniqueid:_0xac3fxb[_0xf125[21]],leaveAt:null},individualHooks:true})[_0xf125[44]](function(_0xac3fx21){if(_0xac3fx21&& _0xac3fx21[_0xf125[33]]&& _0xac3fx21[1][_0xf125[33]]){for(var _0xac3fx1e=0;_0xac3fx1e< _0xac3fx21[1][_0xf125[33]];_0xac3fx1e++){var _0xac3fx22=_0xac3fx21[1][_0xac3fx1e][_0xf125[50]]({plain:true});_0xac3fxd[_0xf125[49]](_0xf125[63])[_0xf125[46]](_0xf125[62],_0xac3fx22);_0xac3fxd[_0xf125[49]](_0xf125[64])[_0xf125[46]](_0xf125[62],_0xac3fx22)}};logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[65]);clearTimeout(_0xac3fx10);_0xac3fxe()})[_0xf125[43]](function(_0xac3fx1a){logger[_0xf125[42]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[41]);logger[_0xf125[42]](_0xac3fx1a[_0xf125[61]]);_0xac3fxe(_0xac3fx1a)})}}function _0xac3fx23(){var _0xac3fx18=((_0xac3fxa[_0xf125[32]]- _0xac3fx13)> _0xac3fx12[_0xf125[32]])?_0xac3fx12[_0xf125[32]]:(_0xac3fxa[_0xf125[32]]- _0xac3fx13);if(_0xac3fx18> 0){Queue[_0xf125[74]](_0xac3fxa.OpenchannelQueueId,{attributes:[_0xf125[26],_0xf125[17],_0xf125[32],_0xf125[19],_0xf125[73]],include:[{model:Agent,where:{online:true,openchannelPause:false},attributes:[_0xf125[26],_0xf125[17],_0xf125[35],_0xf125[36],_0xf125[37]],raw:true}]})[_0xf125[44]](function(_0xac3fx25){if(_0xac3fx25){var _0xac3fx1c=_[_0xf125[69]](_[_0xf125[68]](_0xac3fx25.Users,_0xf125[67]));if(_0xac3fx1c&& _0xac3fx1c[_0xf125[33]]){var _0xac3fx26;for(var _0xac3fx1e=0;_0xac3fx1e< _0xac3fx1c[_0xf125[33]];_0xac3fx1e++){_[_0xf125[70]](_0xac3fx1c[_0xac3fx1e],function(_0xac3fx15){return _0xac3fx14(_0xac3fx15)});if(_0xac3fx1c[_0xac3fx1e][_0xf125[33]]){_0xac3fx26= _0xac3fx1c[_0xac3fx1e];break}};if(_0xac3fx26&& _0xac3fx26[_0xf125[33]]){var _0xac3fx27=_[_0xf125[34]](_0xac3fx26,function(_0xac3fx15){return _[_0xf125[71]](_[_0xf125[57]](_0xac3fxb,{timeslot:_0xac3fx18,application:_0xf125[55],membername:_0xac3fx15[_0xf125[17]],memberid:_0xac3fx15[_0xf125[26]],queue:_0xac3fx12[_0xf125[26]],queuename:_0xac3fx12[_0xf125[17]],calledAt:moment()[_0xf125[40]](_0xf125[56])}))});return Report[_0xf125[72]](_0xac3fx27,{individualHooks:true})}else {logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[59])}}else {logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[59])}}else {logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[59])}})[_0xf125[44]](function(_0xac3fx24){if(_0xac3fx24&& _0xac3fx24[_0xf125[33]]){for(var _0xac3fx1e=0;_0xac3fx1e< _0xac3fx24[_0xf125[33]];_0xac3fx1e++){var _0xac3fx1b=_0xac3fx24[_0xac3fx1e][_0xf125[50]]({plain:true});_0xac3fxd[_0xf125[49]](util[_0xf125[40]](_0xf125[47],_0xac3fx1b[_0xf125[48]]))[_0xf125[46]](_0xf125[45],_0xac3fx1b)}};_0xac3fx10= setTimeout(function(){_0xac3fx13+= _0xac3fx12[_0xf125[32]];_0xac3fx23()},_0xac3fx18* 1000)})[_0xf125[43]](function(_0xac3fx1a){logger[_0xf125[42]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[41]);logger[_0xf125[42]](_0xac3fx1a[_0xf125[61]]);_0xac3fxe(_0xac3fx1a)})}else {return Session[_0xf125[66]]({leaveAt:moment()[_0xf125[40]](_0xf125[56]),timeout:true},{where:{uniqueid:_0xac3fxb[_0xf125[21]],leaveAt:null},individualHooks:true})[_0xf125[44]](function(_0xac3fx21){if(_0xac3fx21&& _0xac3fx21[_0xf125[33]]&& _0xac3fx21[1][_0xf125[33]]){for(var _0xac3fx1e=0;_0xac3fx1e< _0xac3fx21[1][_0xf125[33]];_0xac3fx1e++){var _0xac3fx22=_0xac3fx21[1][_0xac3fx1e][_0xf125[50]]({plain:true});_0xac3fxd[_0xf125[49]](_0xf125[63])[_0xf125[46]](_0xf125[62],_0xac3fx22);_0xac3fxd[_0xf125[49]](_0xf125[64])[_0xf125[46]](_0xf125[62],_0xac3fx22)}};logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[65]);clearTimeout(_0xac3fx10);_0xac3fxe()})[_0xf125[43]](function(_0xac3fx1a){logger[_0xf125[42]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[41]);logger[_0xf125[42]](_0xac3fx1a[_0xf125[61]]);_0xac3fxe(_0xac3fx1a)})}}return Queue[_0xf125[74]](_0xac3fxa.OpenchannelQueueId,{attributes:[_0xf125[26],_0xf125[17],_0xf125[32],_0xf125[19],_0xf125[73]],include:[{model:Agent,attributes:[_0xf125[26]],raw:true}]})[_0xf125[44]](function(_0xac3fx25){_0xac3fx12= _0xac3fx25[_0xf125[50]]({plain:true});logger[_0xf125[25]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[83],_0xac3fxa[_0xf125[32]],_0xf125[84]);return Session[_0xf125[58]](_[_0xf125[57]](_0xac3fxb,{timeslot:_0xac3fxa[_0xf125[32]],application:_0xf125[55],queue:_0xac3fx25[_0xf125[26]],queuename:_0xac3fx25[_0xf125[17]],calledAt:moment()[_0xf125[40]](_0xf125[56]),joinAt:moment()[_0xf125[40]](_0xf125[56]),membername:null,memberid:null}))})[_0xf125[44]](function(_0xac3fx22){_0xac3fxd[_0xf125[49]](_0xf125[63])[_0xf125[46]](_0xf125[62],_0xac3fx22);_0xac3fxd[_0xf125[49]](_0xf125[64])[_0xf125[46]](_0xf125[62],_0xac3fx22);return Room[_0xf125[74]](_0xac3fxb[_0xf125[82]])})[_0xf125[44]](function(_0xac3fx28){if(_0xac3fx28){return _0xac3fx28[_0xf125[66]]({waiting:true})}})[_0xf125[44]](function(_0xac3fx28){if(_0xac3fx28){_0xac3fxd[_0xf125[46]](_0xf125[81],_0xac3fx28[_0xf125[50]]({plain:true}))}})[_0xf125[44]](function(_0xac3fx28){switch(_0xac3fx12[_0xf125[19]]){case _0xf125[75]:_0xac3fx23();break;case _0xf125[79]:_0xac3fx11= _[_0xf125[78]](_0xac3fx12.Users,[function(_0xac3fx29){return _0xac3fx29[_0xf125[77]][_0xf125[76]]|| 0}]);_0xac3fx17();break;case _0xf125[80]:_0xac3fx11= _[_0xf125[78]](_0xac3fx12.Users,[function(_0xac3fx29){return _0xac3fx29[_0xf125[77]][_0xf125[76]]|| 0}]);_0xac3fx17();break;default:}})[_0xf125[43]](function(_0xac3fx1a){logger[_0xf125[42]](_0xac3fxb[_0xf125[15]][_0xf125[14]](),_0xf125[16],_0xac3fx12[_0xf125[17]][_0xf125[14]](),_0xf125[18],_0xac3fx12[_0xf125[19]],_0xf125[20],_0xac3fxb[_0xf125[21]],_0xf125[41]);logger[_0xf125[42]](_0xac3fx1a[_0xf125[61]]);_0xac3fxe(_0xac3fx1a)})}