Built motion from commit a11024eac.|1.0.35
[motion.git] / server / config / tools / user.js
index 22917f5..059d418 100644 (file)
@@ -1 +1 @@
-var _0xfbd9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x43\x68\x61\x6E\x53\x70\x79","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x6F\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x63\x68\x61\x6E\x73\x70\x79\x2E\x2E\x2E","\x64\x65\x62\x75\x67","\x61\x6C\x6C","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x25\x73\x25\x73","\x70\x72\x65\x66\x69\x78","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x25\x73","\x63\x68\x61\x6E\x73\x70\x79","\x69\x64","\x73\x79\x73\x74\x65\x6D","\x70\x75\x73\x68","\x61\x75\x74\x68","\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x72\x65\x63\x6F\x72\x64","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x46\x6F\x72\x6D\x61\x74","\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D\x2E\x25\x73","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73","\x6F\x70\x74\x69\x6F\x6E\x73","\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x44\x65\x6C\x65\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x63\x68\x61\x6E\x73\x70\x79\x2E\x2E\x2E","\x64\x65\x73\x74\x72\x6F\x79","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x5F\x63\x68\x61\x6E\x67\x65\x64","\x55\x70\x64\x61\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x63\x61\x6C\x6C\x65\x72\x49\x44\x2E\x2E\x2E","\x63\x61\x6C\x6C\x65\x72\x69\x64","\x22\x25\x73\x22\x20\x3C\x25\x73\x3E","\x73\x61\x76\x65","\x72\x65\x73\x6F\x6C\x76\x65","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73\x2E\x2E\x2E","\x5F","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x44\x69\x61\x6C","\x53\x49\x50\x2F","\x2C\x2C\x74\x54\x78\x58","\x48\x61\x6E\x67\x75\x70","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x71\x75\x65\x75\x65\x53\x74\x61\x74\x75\x73","\x6C\x61\x73\x74\x4C\x6F\x67\x69\x6E\x41\x74","\x6F\x6E\x6C\x69\x6E\x65","\x43\x68\x61\x6E\x73\x70\x79\x20\x75\x70\x64\x61\x74\x65\x20\x65\x72\x72\x6F\x72","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65"];_0xfbd9[0];var fs=require(_0xfbd9[1]);var util=require(_0xfbd9[2]);var path=require(_0xfbd9[3]);var config=require(_0xfbd9[4]);var UserModel=require(_0xfbd9[6])[_0xfbd9[5]];var VoiceExtension=require(_0xfbd9[6])[_0xfbd9[7]];var ChanSpy=require(_0xfbd9[6])[_0xfbd9[8]];var sequelize=require(_0xfbd9[6])[_0xfbd9[9]];var BPromise=require(_0xfbd9[10]);var logger=require(_0xfbd9[12])(_0xfbd9[11]);function createChanspy(_0xbb9fxc,_0xbb9fxd){logger[_0xfbd9[14]](_0xfbd9[13]);return ChanSpy[_0xfbd9[43]]()[_0xfbd9[42]](function(_0xbb9fxe){var _0xbb9fxf=[];_0xbb9fxe[_0xfbd9[41]](function(_0xbb9fx10){var _0xbb9fx11=[];var _0xbb9fx12=1;_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[19]]),priority:_0xbb9fx12,app:_0xfbd9[21],appdata:util[_0xfbd9[20]](_0xfbd9[22],_0xfbd9[23]),UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]});_0xbb9fx12++;if(_0xbb9fx10[_0xfbd9[27]]){_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[19]]),priority:_0xbb9fx12,app:_0xfbd9[28],appdata:_0xbb9fx10[_0xfbd9[29]],UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]});_0xbb9fx12++};if(_0xbb9fx10[_0xfbd9[30]]&& _0xbb9fx10[_0xfbd9[31]]){_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[19]]),priority:_0xbb9fx12,app:_0xfbd9[32],appdata:util[_0xfbd9[20]](_0xfbd9[33],_0xbb9fx10[_0xfbd9[31]]),UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]});_0xbb9fx12++};_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[19]]),priority:_0xbb9fx12,app:_0xfbd9[8],appdata:util[_0xfbd9[20]](_0xfbd9[34],_0xbb9fxc[_0xfbd9[19]],_0xbb9fx10[_0xfbd9[35]]),UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]});_0xbb9fx12++;if(_0xbb9fx10[_0xfbd9[30]]&& _0xbb9fx10[_0xfbd9[31]]){_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[19]]),priority:_0xbb9fx12,app:_0xfbd9[36],appdata:_0xfbd9[37],UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]})};_0xbb9fx12= 1;_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[38]]),priority:_0xbb9fx12,app:_0xfbd9[21],appdata:util[_0xfbd9[20]](_0xfbd9[22],_0xfbd9[23]),UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]});_0xbb9fx12++;if(_0xbb9fx10[_0xfbd9[27]]){_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[38]]),priority:_0xbb9fx12,app:_0xfbd9[28],appdata:_0xbb9fx10[_0xfbd9[29]],UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]});_0xbb9fx12++};if(_0xbb9fx10[_0xfbd9[30]]&& _0xbb9fx10[_0xfbd9[31]]){_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[38]]),priority:_0xbb9fx12,app:_0xfbd9[32],appdata:util[_0xfbd9[20]](_0xfbd9[33],_0xbb9fx10[_0xfbd9[31]]),UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]});_0xbb9fx12++};_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[38]]),priority:_0xbb9fx12,app:_0xfbd9[8],appdata:util[_0xfbd9[20]](_0xfbd9[34],_0xbb9fxc[_0xfbd9[19]],_0xbb9fx10[_0xfbd9[35]]),UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]});_0xbb9fx12++;if(_0xbb9fx10[_0xfbd9[30]]&& _0xbb9fx10[_0xfbd9[31]]){_0xbb9fx11[_0xfbd9[26]]({context:_0xfbd9[16],exten:util[_0xfbd9[20]](_0xfbd9[17],_0xbb9fx10[_0xfbd9[18]],_0xbb9fxc[_0xfbd9[38]]),priority:_0xbb9fx12,app:_0xfbd9[36],appdata:_0xfbd9[37],UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:_0xbb9fx10[_0xfbd9[24]],type:_0xfbd9[25]})};_0xbb9fxf[_0xfbd9[26]](VoiceExtension[_0xfbd9[40]](_0xbb9fx11,{transaction:_0xbb9fxd[_0xfbd9[39]]|| null}))});return _0xbb9fxf})[_0xfbd9[15]]()}function deleteChanSpy(_0xbb9fxc,_0xbb9fxd){logger[_0xfbd9[14]](_0xfbd9[44]);return VoiceExtension[_0xfbd9[45]]({where:{UserId:_0xbb9fxc[_0xfbd9[24]],ChanSpyId:{$ne:null}},transaction:_0xbb9fxd[_0xfbd9[39]]|| null})}function createCallerID(_0xbb9fxc,_0xbb9fxd){return function(){if(_0xbb9fxc[_0xfbd9[46]]&& _0xbb9fxc[_0xfbd9[38]]&& _0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[46])){logger[_0xfbd9[14]](_0xfbd9[49]);_0xbb9fxc[_0xfbd9[50]]= util[_0xfbd9[20]](_0xfbd9[51],_0xbb9fxc[_0xfbd9[46]],_0xbb9fxc[_0xfbd9[38]]);return _0xbb9fxc[_0xfbd9[52]]({transaction:_0xbb9fxd[_0xfbd9[39]]|| null})}else {return BPromise[_0xfbd9[53]]()}}}function createExtension(_0xbb9fxc,_0xbb9fxd){logger[_0xfbd9[14]](_0xfbd9[54]);return function(){var _0xbb9fx16=[{context:_0xfbd9[16],exten:_0xfbd9[55]+ _0xbb9fxc[_0xfbd9[38]],priority:1,app:_0xfbd9[21],appdata:_0xfbd9[56],UserId:_0xbb9fxc[_0xfbd9[24]],type:_0xfbd9[25]},{context:_0xfbd9[16],exten:_0xfbd9[55]+ _0xbb9fxc[_0xfbd9[38]],priority:2,app:_0xfbd9[57],appdata:_0xfbd9[58]+ _0xbb9fxc[_0xfbd9[19]]+ _0xfbd9[59],UserId:_0xbb9fxc[_0xfbd9[24]],type:_0xfbd9[25]},{context:_0xfbd9[16],exten:_0xfbd9[55]+ _0xbb9fxc[_0xfbd9[38]],priority:3,app:_0xfbd9[60],appdata:_0xfbd9[37],UserId:_0xbb9fxc[_0xfbd9[24]],type:_0xfbd9[25]},{context:_0xfbd9[16],exten:_0xbb9fxc[_0xfbd9[19]],priority:1,app:_0xfbd9[21],appdata:_0xfbd9[56],UserId:_0xbb9fxc[_0xfbd9[24]],type:_0xfbd9[25]},{context:_0xfbd9[16],exten:_0xbb9fxc[_0xfbd9[19]],priority:2,app:_0xfbd9[57],appdata:_0xfbd9[58]+ _0xbb9fxc[_0xfbd9[19]]+ _0xfbd9[59],UserId:_0xbb9fxc[_0xfbd9[24]],type:_0xfbd9[25]},{context:_0xfbd9[16],exten:_0xbb9fxc[_0xfbd9[19]],priority:3,app:_0xfbd9[60],appdata:_0xfbd9[37],UserId:_0xbb9fxc[_0xfbd9[24]],type:_0xfbd9[25]}];return VoiceExtension[_0xfbd9[40]](_0xbb9fx16,{transaction:_0xbb9fxd[_0xfbd9[39]]|| null})}}exports[_0xfbd9[61]]= function(_0xbb9fxd){return function(_0xbb9fxc){if(!_0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[62])&&  !_0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[63]) &&  !_0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[50]) &&  !_0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[64]) &&  !_0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[65])){return BPromise[_0xfbd9[53]]()[_0xfbd9[42]](createCallerID(_0xbb9fxc,_0xbb9fxd))[_0xfbd9[42]](function(){if((_0xbb9fxc[_0xfbd9[23]]&& _0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[23]))){return createChanspy(_0xbb9fxc,_0xbb9fxd)}})[_0xfbd9[42]](function(){if(_0xbb9fxc[_0xfbd9[23]]&&  !_0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[23])&& _0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[19])){return deleteChanSpy(_0xbb9fxc,_0xbb9fxd)}})[_0xfbd9[42]](function(){if(_0xbb9fxc[_0xfbd9[23]]&&  !_0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[23])&& _0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[19])){return createChanspy(_0xbb9fxc,_0xbb9fxd)}})[_0xfbd9[42]](function(){if(!_0xbb9fxc[_0xfbd9[23]]&& _0xbb9fxc[_0xfbd9[48]][_0xfbd9[47]](_0xfbd9[23])){return deleteChanSpy(_0xbb9fxc,_0xbb9fxd)}})[_0xfbd9[69]](function(_0xbb9fx17){logger[_0xfbd9[68]](_0xfbd9[66],_0xbb9fx17[_0xfbd9[67]])})[_0xfbd9[42]](function(){return _0xbb9fxc})}else {return BPromise[_0xfbd9[53]]()[_0xfbd9[42]](function(){return _0xbb9fxc})}}};exports[_0xfbd9[70]]= function(_0xbb9fxd){return function(_0xbb9fxc){delete _0xbb9fxc[_0xfbd9[48]][_0xfbd9[38]];return Promise[_0xfbd9[15]]([])[_0xfbd9[42]](createCallerID(_0xbb9fxc,_0xbb9fxd))[_0xfbd9[42]](createExtension(_0xbb9fxc,_0xbb9fxd))[_0xfbd9[42]](function(){if(_0xbb9fxc[_0xfbd9[23]]){return createChanspy(_0xbb9fxc,_0xbb9fxd)}})[_0xfbd9[42]](function(){return _0xbb9fxc})}}
\ No newline at end of file
+var _0xf9a2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x43\x68\x61\x6E\x53\x70\x79","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x6F\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x63\x68\x61\x6E\x73\x70\x79\x2E\x2E\x2E","\x64\x65\x62\x75\x67","\x61\x6C\x6C","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x25\x73\x25\x73","\x70\x72\x65\x66\x69\x78","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x25\x73","\x63\x68\x61\x6E\x73\x70\x79","\x69\x64","\x73\x79\x73\x74\x65\x6D","\x70\x75\x73\x68","\x61\x75\x74\x68","\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x72\x65\x63\x6F\x72\x64","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x46\x6F\x72\x6D\x61\x74","\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D\x2E\x25\x73","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73","\x6F\x70\x74\x69\x6F\x6E\x73","\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x44\x65\x6C\x65\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x63\x68\x61\x6E\x73\x70\x79\x2E\x2E\x2E","\x64\x65\x73\x74\x72\x6F\x79","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x5F\x63\x68\x61\x6E\x67\x65\x64","\x55\x70\x64\x61\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x63\x61\x6C\x6C\x65\x72\x49\x44\x2E\x2E\x2E","\x63\x61\x6C\x6C\x65\x72\x69\x64","\x22\x25\x73\x22\x20\x3C\x25\x73\x3E","\x73\x61\x76\x65","\x72\x65\x73\x6F\x6C\x76\x65","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x75\x73\x65\x72\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73\x2E\x2E\x2E","\x5F","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x44\x69\x61\x6C","\x53\x49\x50\x2F","\x2C\x2C\x74\x54\x78\x58","\x48\x61\x6E\x67\x75\x70","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x71\x75\x65\x75\x65\x53\x74\x61\x74\x75\x73","\x6C\x61\x73\x74\x4C\x6F\x67\x69\x6E\x41\x74","\x6F\x6E\x6C\x69\x6E\x65","\x43\x68\x61\x6E\x73\x70\x79\x20\x75\x70\x64\x61\x74\x65\x20\x65\x72\x72\x6F\x72","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65"];_0xf9a2[0];var fs=require(_0xf9a2[1]);var util=require(_0xf9a2[2]);var path=require(_0xf9a2[3]);var config=require(_0xf9a2[4]);var UserModel=require(_0xf9a2[6])[_0xf9a2[5]];var VoiceExtension=require(_0xf9a2[6])[_0xf9a2[7]];var ChanSpy=require(_0xf9a2[6])[_0xf9a2[8]];var sequelize=require(_0xf9a2[6])[_0xf9a2[9]];var BPromise=require(_0xf9a2[10]);var logger=require(_0xf9a2[12])(_0xf9a2[11]);function createChanspy(_0xc47fxc,_0xc47fxd){logger[_0xf9a2[14]](_0xf9a2[13]);return ChanSpy[_0xf9a2[43]]()[_0xf9a2[42]](function(_0xc47fxe){var _0xc47fxf=[];_0xc47fxe[_0xf9a2[41]](function(_0xc47fx10){var _0xc47fx11=[];var _0xc47fx12=1;_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[19]]),priority:_0xc47fx12,app:_0xf9a2[21],appdata:util[_0xf9a2[20]](_0xf9a2[22],_0xf9a2[23]),UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]});_0xc47fx12++;if(_0xc47fx10[_0xf9a2[27]]){_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[19]]),priority:_0xc47fx12,app:_0xf9a2[28],appdata:_0xc47fx10[_0xf9a2[29]],UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]});_0xc47fx12++};if(_0xc47fx10[_0xf9a2[30]]&& _0xc47fx10[_0xf9a2[31]]){_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[19]]),priority:_0xc47fx12,app:_0xf9a2[32],appdata:util[_0xf9a2[20]](_0xf9a2[33],_0xc47fx10[_0xf9a2[31]]),UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]});_0xc47fx12++};_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[19]]),priority:_0xc47fx12,app:_0xf9a2[8],appdata:util[_0xf9a2[20]](_0xf9a2[34],_0xc47fxc[_0xf9a2[19]],_0xc47fx10[_0xf9a2[35]]),UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]});_0xc47fx12++;if(_0xc47fx10[_0xf9a2[30]]&& _0xc47fx10[_0xf9a2[31]]){_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[19]]),priority:_0xc47fx12,app:_0xf9a2[36],appdata:_0xf9a2[37],UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]})};_0xc47fx12= 1;_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[38]]),priority:_0xc47fx12,app:_0xf9a2[21],appdata:util[_0xf9a2[20]](_0xf9a2[22],_0xf9a2[23]),UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]});_0xc47fx12++;if(_0xc47fx10[_0xf9a2[27]]){_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[38]]),priority:_0xc47fx12,app:_0xf9a2[28],appdata:_0xc47fx10[_0xf9a2[29]],UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]});_0xc47fx12++};if(_0xc47fx10[_0xf9a2[30]]&& _0xc47fx10[_0xf9a2[31]]){_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[38]]),priority:_0xc47fx12,app:_0xf9a2[32],appdata:util[_0xf9a2[20]](_0xf9a2[33],_0xc47fx10[_0xf9a2[31]]),UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]});_0xc47fx12++};_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[38]]),priority:_0xc47fx12,app:_0xf9a2[8],appdata:util[_0xf9a2[20]](_0xf9a2[34],_0xc47fxc[_0xf9a2[19]],_0xc47fx10[_0xf9a2[35]]),UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]});_0xc47fx12++;if(_0xc47fx10[_0xf9a2[30]]&& _0xc47fx10[_0xf9a2[31]]){_0xc47fx11[_0xf9a2[26]]({context:_0xf9a2[16],exten:util[_0xf9a2[20]](_0xf9a2[17],_0xc47fx10[_0xf9a2[18]],_0xc47fxc[_0xf9a2[38]]),priority:_0xc47fx12,app:_0xf9a2[36],appdata:_0xf9a2[37],UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:_0xc47fx10[_0xf9a2[24]],type:_0xf9a2[25]})};_0xc47fxf[_0xf9a2[26]](VoiceExtension[_0xf9a2[40]](_0xc47fx11,{transaction:_0xc47fxd[_0xf9a2[39]]|| null}))});return _0xc47fxf})[_0xf9a2[15]]()}function deleteChanSpy(_0xc47fxc,_0xc47fxd){logger[_0xf9a2[14]](_0xf9a2[44]);return VoiceExtension[_0xf9a2[45]]({where:{UserId:_0xc47fxc[_0xf9a2[24]],ChanSpyId:{$ne:null}},transaction:_0xc47fxd[_0xf9a2[39]]|| null})}function createCallerID(_0xc47fxc,_0xc47fxd){return function(){if(_0xc47fxc[_0xf9a2[46]]&& _0xc47fxc[_0xf9a2[38]]&& _0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[46])){logger[_0xf9a2[14]](_0xf9a2[49]);_0xc47fxc[_0xf9a2[50]]= util[_0xf9a2[20]](_0xf9a2[51],_0xc47fxc[_0xf9a2[46]],_0xc47fxc[_0xf9a2[38]]);return _0xc47fxc[_0xf9a2[52]]({transaction:_0xc47fxd[_0xf9a2[39]]|| null})}else {return BPromise[_0xf9a2[53]]()}}}function createExtension(_0xc47fxc,_0xc47fxd){logger[_0xf9a2[14]](_0xf9a2[54]);return function(){var _0xc47fx16=[{context:_0xf9a2[16],exten:_0xf9a2[55]+ _0xc47fxc[_0xf9a2[38]],priority:1,app:_0xf9a2[21],appdata:_0xf9a2[56],UserId:_0xc47fxc[_0xf9a2[24]],type:_0xf9a2[25]},{context:_0xf9a2[16],exten:_0xf9a2[55]+ _0xc47fxc[_0xf9a2[38]],priority:2,app:_0xf9a2[57],appdata:_0xf9a2[58]+ _0xc47fxc[_0xf9a2[19]]+ _0xf9a2[59],UserId:_0xc47fxc[_0xf9a2[24]],type:_0xf9a2[25]},{context:_0xf9a2[16],exten:_0xf9a2[55]+ _0xc47fxc[_0xf9a2[38]],priority:3,app:_0xf9a2[60],appdata:_0xf9a2[37],UserId:_0xc47fxc[_0xf9a2[24]],type:_0xf9a2[25]},{context:_0xf9a2[16],exten:_0xc47fxc[_0xf9a2[19]],priority:1,app:_0xf9a2[21],appdata:_0xf9a2[56],UserId:_0xc47fxc[_0xf9a2[24]],type:_0xf9a2[25]},{context:_0xf9a2[16],exten:_0xc47fxc[_0xf9a2[19]],priority:2,app:_0xf9a2[57],appdata:_0xf9a2[58]+ _0xc47fxc[_0xf9a2[19]]+ _0xf9a2[59],UserId:_0xc47fxc[_0xf9a2[24]],type:_0xf9a2[25]},{context:_0xf9a2[16],exten:_0xc47fxc[_0xf9a2[19]],priority:3,app:_0xf9a2[60],appdata:_0xf9a2[37],UserId:_0xc47fxc[_0xf9a2[24]],type:_0xf9a2[25]}];return VoiceExtension[_0xf9a2[40]](_0xc47fx16,{transaction:_0xc47fxd[_0xf9a2[39]]|| null})}}exports[_0xf9a2[61]]= function(_0xc47fxd){return function(_0xc47fxc){if(!_0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[62])&&  !_0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[63]) &&  !_0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[50]) &&  !_0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[64]) &&  !_0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[65])){return BPromise[_0xf9a2[53]]()[_0xf9a2[42]](createCallerID(_0xc47fxc,_0xc47fxd))[_0xf9a2[42]](function(){if((_0xc47fxc[_0xf9a2[23]]&& _0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[23]))){return createChanspy(_0xc47fxc,_0xc47fxd)}})[_0xf9a2[42]](function(){if(_0xc47fxc[_0xf9a2[23]]&&  !_0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[23])&& _0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[19])){return deleteChanSpy(_0xc47fxc,_0xc47fxd)}})[_0xf9a2[42]](function(){if(_0xc47fxc[_0xf9a2[23]]&&  !_0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[23])&& _0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[19])){return createChanspy(_0xc47fxc,_0xc47fxd)}})[_0xf9a2[42]](function(){if(!_0xc47fxc[_0xf9a2[23]]&& _0xc47fxc[_0xf9a2[48]][_0xf9a2[47]](_0xf9a2[23])){return deleteChanSpy(_0xc47fxc,_0xc47fxd)}})[_0xf9a2[69]](function(_0xc47fx17){logger[_0xf9a2[68]](_0xf9a2[66],_0xc47fx17[_0xf9a2[67]])})[_0xf9a2[42]](function(){return _0xc47fxc})}else {return BPromise[_0xf9a2[53]]()[_0xf9a2[42]](function(){return _0xc47fxc})}}};exports[_0xf9a2[70]]= function(_0xc47fxd){return function(_0xc47fxc){delete _0xc47fxc[_0xf9a2[48]][_0xf9a2[38]];return Promise[_0xf9a2[15]]([])[_0xf9a2[42]](createCallerID(_0xc47fxc,_0xc47fxd))[_0xf9a2[42]](createExtension(_0xc47fxc,_0xc47fxd))[_0xf9a2[42]](function(){if(_0xc47fxc[_0xf9a2[23]]){return createChanspy(_0xc47fxc,_0xc47fxd)}})[_0xf9a2[42]](function(){return _0xc47fxc})}}
\ No newline at end of file