de644caa1827381ce6c7de0322981ec951e5efa7
[motion.git] / server / config / forked_routing / sms / agent.js
1 var _0xa08d=["\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","\x73\x6D\x73","\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","\x53\x6D\x73\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x53\x6D\x73","\x52\x65\x70\x6F\x72\x74\x53\x6D\x73\x53\x65\x73\x73\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73","\x69\x64","\x66\x69\x6E\x64","\x74\x6F\x55\x70\x70\x65\x72\x43\x61\x73\x65","\x63\x68\x61\x6E\x6E\x65\x6C","\x41\x50\x50\x20\x41\x47\x45\x4E\x54\x2C\x20\x41\x47\x45\x4E\x54\x20\x49\x44\x3A","\x49\x4E\x54\x45\x52\x41\x43\x54\x49\x4F\x4E\x3A","\x75\x6E\x69\x71\x75\x65\x69\x64","\x45\x52\x52\x4F\x52","\x65\x72\x72\x6F\x72","\x73\x74\x61\x63\x6B","\x63\x61\x74\x63\x68","\x72\x65\x70\x6F\x72\x74\x5F\x73\x6D\x73\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","\x66\x6F\x72\x6D\x61\x74","\x74\x6F","\x6C\x65\x6E\x67\x74\x68","\x67\x65\x74","\x72\x65\x70\x6F\x72\x74\x5F\x73\x6D\x73\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\x29","\x69\x6E\x66\x6F","\x74\x68\x65\x6E","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x75\x70\x64\x61\x74\x65","\x74\x69\x6D\x65\x6F\x75\x74","\x54\x49\x4D\x45\x4F\x55\x54","\x53\x45\x43","\x61\x67\x65\x6E\x74","\x6E\x61\x6D\x65","\x6D\x65\x72\x67\x65","\x63\x72\x65\x61\x74\x65","\x53\x4B\x49\x50\x50\x45\x44\x20\x28\x41\x47\x45\x4E\x54\x20\x4E\x4F\x54\x20\x41\x56\x41\x49\x4C\x41\x42\x4C\x45\x29","\x55\x73\x65\x72\x49\x64"];_0xa08d[0];var _=require(_0xa08d[1]);var util=require(_0xa08d[2]);var moment=require(_0xa08d[3]);var logger=require(_0xa08d[5])(_0xa08d[4]);var Agent=require(_0xa08d[7])[_0xa08d[6]];var Room=require(_0xa08d[7])[_0xa08d[8]];var Report=require(_0xa08d[7])[_0xa08d[9]];var Session=require(_0xa08d[7])[_0xa08d[10]];module[_0xa08d[11]]= function(_0xa71ex9,_0xa71exa,_0xa71exb,_0xa71exc,_0xa71exd){var _0xa71exe=[];var _0xa71exf;var _0xa71ex10;function _0xa71ex11(_0xa71ex12){var _0xa71ex13=_[_0xa08d[13]](_0xa71exe,{id:_0xa71ex12[_0xa08d[12]]});return _0xa71ex13?true:false}return Agent[_0xa08d[13]]({where:{id:_0xa71ex9[_0xa08d[47]],online:true,smsPause:false},raw:true})[_0xa08d[36]](function(_0xa71ex12){_0xa71ex10= _0xa71ex12;logger[_0xa08d[35]](_0xa71exa[_0xa08d[15]][_0xa08d[14]](),_0xa08d[16],_0xa71ex9.UserId,_0xa08d[17],_0xa71exa[_0xa08d[18]],_0xa08d[40],_0xa71ex9[_0xa08d[39]],_0xa08d[41]);if(_0xa71ex12){if(!_0xa71ex11(_0xa71ex10)){var _0xa71ex15=_[_0xa08d[44]](_0xa71exa,{timeslot:_0xa71ex9[_0xa08d[39]],application:_0xa08d[42],membername:_0xa71ex12[_0xa08d[43]],memberid:_0xa71ex12[_0xa08d[12]],calledAt:moment()[_0xa08d[27]](_0xa08d[37]),joinAt:moment()[_0xa08d[27]](_0xa08d[37])});return Session[_0xa08d[45]](_0xa71ex15)[_0xa08d[36]](function(_0xa71ex18){_0xa71exc[_0xa08d[28]](_0xa08d[32])[_0xa08d[24]](_0xa08d[31],_0xa71ex18);_0xa71exc[_0xa08d[28]](_0xa08d[33])[_0xa08d[24]](_0xa08d[31],_0xa71ex18);_0xa71exc[_0xa08d[28]](util[_0xa08d[27]](_0xa08d[25],_0xa71ex18[_0xa08d[26]]))[_0xa08d[24]](_0xa08d[31],_0xa71ex18);return Report[_0xa08d[45]](_0xa71ex15,{raw:true})})}}else {logger[_0xa08d[35]](_0xa71exa[_0xa08d[15]][_0xa08d[14]](),_0xa08d[16],_0xa71ex9.UserId,_0xa08d[17],_0xa71exa[_0xa08d[18]],_0xa08d[46]);_0xa71exd()}})[_0xa08d[36]](function(_0xa71ex15){if(_0xa71ex15){_0xa71exc[_0xa08d[28]](util[_0xa08d[27]](_0xa08d[25],_0xa71ex15[_0xa08d[26]]))[_0xa08d[24]](_0xa08d[23],_0xa71ex15)};_0xa71exf= setTimeout(function(){return Session[_0xa08d[38]]({leaveAt:moment()[_0xa08d[27]](_0xa08d[37]),timeout:true},{where:{uniqueid:_0xa71exa[_0xa08d[18]],leaveAt:null},individualHooks:true})[_0xa08d[36]](function(_0xa71ex16){if(_0xa71ex16&& _0xa71ex16[_0xa08d[29]]&& _0xa71ex16[1][_0xa08d[29]]){for(var _0xa71ex17=0;_0xa71ex17< _0xa71ex16[1][_0xa08d[29]];_0xa71ex17++){var _0xa71ex18=_0xa71ex16[1][_0xa71ex17][_0xa08d[30]]({plain:true});_0xa71exc[_0xa08d[28]](_0xa08d[32])[_0xa08d[24]](_0xa08d[31],_0xa71ex18);_0xa71exc[_0xa08d[28]](_0xa08d[33])[_0xa08d[24]](_0xa08d[31],_0xa71ex18);_0xa71exc[_0xa08d[28]](util[_0xa08d[27]](_0xa08d[25],_0xa71ex18[_0xa08d[26]]))[_0xa08d[24]](_0xa08d[31],_0xa71ex18)}};logger[_0xa08d[35]](_0xa71exa[_0xa08d[15]][_0xa08d[14]](),_0xa08d[16],_0xa71ex9.UserId,_0xa08d[17],_0xa71exa[_0xa08d[18]],_0xa08d[34]);clearTimeout(_0xa71exf);_0xa71exd()})},_0xa71ex9[_0xa08d[39]]* 1000)})[_0xa08d[22]](function(_0xa71ex14){logger[_0xa08d[20]](_0xa71exa[_0xa08d[15]][_0xa08d[14]](),_0xa08d[16],_0xa71ex9.UserId,_0xa08d[17],_0xa71exa[_0xa08d[18]],_0xa08d[19]);logger[_0xa08d[20]](_0xa71ex14[_0xa08d[21]]);_0xa71exd(_0xa71ex14)})}