8afbdecd5d521ec7bc7faf8309cbfd3a2c290ba3
[motion.git] / server / api / voice_musiconhold / voice_musiconhold.controller.js
1 var _0x74e9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x75\x74\x69\x6C","\x66\x73\x2D\x65\x78\x74\x72\x61","\x72\x65\x6D\x6F\x76\x65","\x66\x69\x6C\x65\x2D\x62\x61\x73\x65\x36\x34","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x53\x6F\x75\x6E\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x53\x65\x74\x74\x69\x6E\x67","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x56\x6F\x69\x63\x65\x4D\x75\x73\x69\x63\x4F\x6E\x48\x6F\x6C\x64","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x64\x64\x46\x69\x6C\x65\x73","\x64\x69\x72\x65\x63\x74\x6F\x72\x79","\x64\x69\x73\x70\x6C\x61\x79\x5F\x6E\x61\x6D\x65","\x2E\x77\x61\x76","\x6A\x6F\x69\x6E","\x73\x6F\x75\x6E\x64\x50\x61\x74\x68","\x2F\x76\x61\x72\x2F\x6F\x70\x74\x2F\x6D\x6F\x74\x69\x6F\x6E\x2F\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x73\x6F\x75\x6E\x64\x73\x2F\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x73\x61\x76\x65\x5F\x6E\x61\x6D\x65","\x63\x6F\x70\x79\x53\x79\x6E\x63","\x66\x6F\x72\x45\x61\x63\x68","\x30\x37\x37\x37","\x63\x68\x6D\x6F\x64\x53\x79\x6E\x63","\x73\x6F\x75\x6E\x64\x73","\x62\x6F\x64\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77\x41\x75\x64\x69\x6F\x46\x69\x6C\x65\x73","\x66\x69\x6C\x65\x73","\x72\x65\x61\x64\x64\x69\x72","\x64\x65\x6C\x65\x74\x65\x41\x75\x64\x69\x6F\x46\x69\x6C\x65\x73","\x2F","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x75\x6E\x6C\x69\x6E\x6B","\x6D\x6F\x68\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x6D\x6F\x64\x65","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x6D\x6F\x68","\x73\x6F\x72\x74","","\x72\x6F\x6C\x6C\x62\x61\x63\x6B","\x4D\x6F\x68\x20\x64\x69\x72\x65\x63\x74\x6F\x72\x79\x20\x63\x72\x65\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72","\x4D\x45\x53\x53\x41\x47\x45\x5F\x46\x49\x4C\x45\x5F\x43\x52\x45\x41\x54\x49\x4F\x4E\x5F\x45\x52\x52\x4F\x52","\x63\x6F\x6D\x6D\x69\x74","\x4D\x6F\x68\x20\x64\x69\x72\x65\x63\x74\x6F\x72\x79\x20\x63\x72\x65\x61\x74\x65\x64","\x64\x65\x62\x75\x67","\x6D\x6B\x64\x69\x72","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x45\x72\x72\x6F\x72\x20\x72\x65\x6D\x6F\x76\x69\x6E\x67\x20\x6D\x6F\x68\x20\x64\x69\x72\x65\x63\x74\x6F\x72\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x61\x6C\x6C","\x70\x75\x73\x68","\x69\x64\x73","\x73\x74\x72\x65\x61\x6D","\x65\x6E\x63\x6F\x64\x65","\x73\x74\x61\x63\x6B"];_0x74e9[0];var fs=require(_0x74e9[1]);var _=require(_0x74e9[2]);var path=require(_0x74e9[3]);var util=require(_0x74e9[4]);var fse=require(_0x74e9[5]);var remove=require(_0x74e9[6]);var base64=require(_0x74e9[7]);var logger=require(_0x74e9[9])(_0x74e9[8]);var config=require(_0x74e9[10]);var Util=require(_0x74e9[11]);var Sound=require(_0x74e9[13])[_0x74e9[12]];var Setting=require(_0x74e9[13])[_0x74e9[14]];var sequelize=require(_0x74e9[13])[_0x74e9[15]];var VoiceMusicOnHold=require(_0x74e9[13])[_0x74e9[16]];exports[_0x74e9[17]]= function(_0x5272xf,_0x5272x10){return VoiceMusicOnHold[_0x74e9[24]](Util[_0x74e9[23]](_0x5272xf[_0x74e9[22]]))[_0x74e9[21]](function(_0x5272x12){_0x5272x10[_0x74e9[20]](200)[_0x74e9[19]](_0x5272x12)})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[25]]= function(_0x5272xf,_0x5272x10){return VoiceMusicOnHold[_0x74e9[29]](_0x5272xf[_0x74e9[28]][_0x74e9[27]])[_0x74e9[21]](function(_0x5272x13){if(!_0x5272x13){return _0x5272x10[_0x74e9[26]](404)};return _0x5272x10[_0x74e9[19]](_0x5272x13)})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[30]]= function(_0x5272xf,_0x5272x10){var _0x5272x14,_0x5272x15;return VoiceMusicOnHold[_0x74e9[29]](_0x5272xf[_0x74e9[28]][_0x74e9[27]])[_0x74e9[21]](function(_0x5272x13){if(!_0x5272x13){return _0x5272x10[_0x74e9[26]](404)};_0x5272x14= _0x5272x13;return Sound[_0x74e9[44]]({where:{id:_0x5272xf[_0x74e9[43]][_0x74e9[42]]}})})[_0x74e9[21]](function(_0x5272x19){_0x5272x15= _0x5272x19;return Setting[_0x74e9[29]](1)})[_0x74e9[21]](function(_0x5272x16){var _0x5272x17;_0x5272x15[_0x74e9[39]](function(_0x5272x18){_0x5272x17= path[_0x74e9[34]](_0x5272x14[_0x74e9[31]],_0x5272x18[_0x74e9[32]]+ _0x74e9[33]);fse[_0x74e9[38]](path[_0x74e9[34]](_0x5272x16[_0x74e9[35]]|| _0x74e9[36],_0x5272x18[_0x74e9[37]]+ _0x74e9[33]),_0x5272x17)});fs[_0x74e9[41]](_0x5272x17,parseInt(_0x74e9[40],8));_0x5272x10[_0x74e9[26]](200)})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[45]]= function(_0x5272xf,_0x5272x10){var _0x5272x1a={};VoiceMusicOnHold[_0x74e9[29]](_0x5272xf[_0x74e9[28]][_0x74e9[27]])[_0x74e9[21]](function(_0x5272x13){if(!_0x5272x13){return _0x5272x10[_0x74e9[26]](404)};_0x5272x1a[_0x74e9[3]]= _0x5272x13[_0x74e9[31]];fs[_0x74e9[47]](_0x5272x13[_0x74e9[31]],function(_0x5272x11,_0x5272x1b){if(!_0x5272x11){_0x5272x1a[_0x74e9[46]]= _0x5272x1b;return _0x5272x10[_0x74e9[19]](_0x5272x1a)}else {throw _0x5272x11}})})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[48]]= function(_0x5272xf,_0x5272x10){return VoiceMusicOnHold[_0x74e9[29]](_0x5272xf[_0x74e9[28]][_0x74e9[27]])[_0x74e9[21]](function(_0x5272x13){if(!_0x5272x13){return _0x5272x10[_0x74e9[26]](404)};var _0x5272x1c=_0x5272x13[_0x74e9[31]]+ _0x74e9[49]+ _0x5272xf[_0x74e9[22]][_0x74e9[50]];fs[_0x74e9[51]](_0x5272x1c,function(_0x5272x11){if(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)}else {return _0x5272x10[_0x74e9[26]](204)}})})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[52]]= function(_0x5272xf,_0x5272x10){return VoiceMusicOnHold[_0x74e9[44]]({where:{name:_0x5272xf[_0x74e9[43]][_0x74e9[53]]}})[_0x74e9[21]](function(_0x5272x1d){if(!_0x5272x1d){return _0x5272x10[_0x74e9[26]](404)};return _0x5272x10[_0x74e9[19]](_0x5272x1d)})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[54]]= function(_0x5272xf,_0x5272x10){return sequelize[_0x74e9[68]]()[_0x74e9[21]](function(_0x5272x1e){if(_0x5272xf[_0x74e9[43]][_0x74e9[55]]=== _0x74e9[46]){_0x5272xf[_0x74e9[43]][_0x74e9[31]]= path[_0x74e9[34]](config[_0x74e9[56]],_0x74e9[57],_0x5272xf[_0x74e9[43]][_0x74e9[53]])}else {_0x5272xf[_0x74e9[43]][_0x74e9[58]]= _0x74e9[59]};return VoiceMusicOnHold[_0x74e9[54]](_0x5272xf[_0x74e9[43]],{transaction:_0x5272x1e})[_0x74e9[21]](function(_0x5272x13){if(_0x5272xf[_0x74e9[43]][_0x74e9[55]]=== _0x74e9[46]){fs[_0x74e9[67]](_0x5272x13[_0x74e9[31]],parseInt(_0x74e9[40],8),function(_0x5272x11){if(_0x5272x11){logger[_0x74e9[62]](_0x74e9[61],_0x5272x11);_0x5272x1e[_0x74e9[60]]();return _0x5272x10[_0x74e9[20]](500)[_0x74e9[19]]({message:_0x74e9[63]})};_0x5272x1e[_0x74e9[64]]();logger[_0x74e9[66]](_0x74e9[65]);return _0x5272x10[_0x74e9[20]](201)[_0x74e9[19]](_0x5272x13)})}else {_0x5272x1e[_0x74e9[64]]();return _0x5272x10[_0x74e9[20]](201)[_0x74e9[19]](_0x5272x13)}})[_0x74e9[18]](function(_0x5272x11){_0x5272x1e[_0x74e9[60]]();return handleError(_0x5272x10,_0x5272x11)})})};exports[_0x74e9[69]]= function(_0x5272xf,_0x5272x10){if(_0x5272xf[_0x74e9[43]][_0x74e9[27]]){delete _0x5272xf[_0x74e9[43]][_0x74e9[27]]};return VoiceMusicOnHold[_0x74e9[29]](_0x5272xf[_0x74e9[28]][_0x74e9[27]])[_0x74e9[21]](function(_0x5272x13){if(!_0x5272x13){return _0x5272x10[_0x74e9[26]](404)};var _0x5272x1f=_[_0x74e9[70]](_0x5272x13,_0x5272xf[_0x74e9[43]]);return _0x5272x1f[_0x74e9[71]]()})[_0x74e9[21]](function(_0x5272x13){return _0x5272x10[_0x74e9[20]](200)[_0x74e9[19]](_0x5272x13)})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[72]]= function(_0x5272xf,_0x5272x10){var _0x5272x20;return sequelize[_0x74e9[68]](function(_0x5272x1e){return VoiceMusicOnHold[_0x74e9[29]](_0x5272xf[_0x74e9[28]][_0x74e9[27]])[_0x74e9[21]](function(_0x5272x13){if(!_0x5272x13){return _0x5272x10[_0x74e9[26]](404)};_0x5272x20= _0x5272x13;return _0x5272x13[_0x74e9[72]]({transaction:_0x5272x1e})})[_0x74e9[21]](function(){if(_0x5272x20[_0x74e9[55]]=== _0x74e9[46]){remove(_0x5272x20[_0x74e9[31]],function(_0x5272x11){if(_0x5272x11){logger[_0x74e9[62]](_0x74e9[73],_0x5272x11)};return _0x5272x10[_0x74e9[26]](204)})}else {return _0x5272x10[_0x74e9[26]](204)}})})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[74]]= function(_0x5272xf,_0x5272x10){var _0x5272x21;return sequelize[_0x74e9[68]](function(_0x5272x1e){return VoiceMusicOnHold[_0x74e9[44]]({where:{id:_0x5272xf[_0x74e9[22]][_0x74e9[77]]}})[_0x74e9[21]](function(_0x5272x23){if(!_0x5272x23){return _0x5272x10[_0x74e9[26]](404)};_0x5272x21= _0x5272x23;var _0x5272x24=[];_0x5272x23[_0x74e9[39]](function(_0x5272x22){_0x5272x24[_0x74e9[76]](_0x5272x22[_0x74e9[72]]({transaction:_0x5272x1e}))});return _0x5272x24})[_0x74e9[75]]()[_0x74e9[21]](function(){_0x5272x21[_0x74e9[39]](function(_0x5272x22){if(_0x5272x22[_0x74e9[55]]=== _0x74e9[46]){remove(_0x5272x22[_0x74e9[31]],function(_0x5272x11){if(_0x5272x11){logger[_0x74e9[62]](_0x74e9[73],_0x5272x11);throw _0x5272x11}})}})})})[_0x74e9[21]](function(){return _0x5272x10[_0x74e9[26]](204)})[_0x74e9[18]](function(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)})};exports[_0x74e9[78]]= function(_0x5272xf,_0x5272x10){var _0x5272x25=decodeURI(_0x5272xf[_0x74e9[22]][_0x74e9[3]]);base64[_0x74e9[79]](_0x5272x25,function(_0x5272x11,_0x5272x26){if(_0x5272x11){return handleError(_0x5272x10,_0x5272x11)}else {return _0x5272x10[_0x74e9[20]](200)[_0x74e9[19]](_0x5272x26)}})};function handleError(_0x5272x10,_0x5272x11){logger[_0x74e9[62]](_0x5272x11[_0x74e9[80]]);return _0x5272x10[_0x74e9[20]](500)[_0x74e9[19]](_0x5272x11)}