Built motion from commit 450cc5d.|0.0.139
[motion.git] / server / api / trunk / trunk.controller.js
index 807efe4..5fe7b06 100644 (file)
@@ -1 +1 @@
-var _0x1bb5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x54\x72\x75\x6E\x6B","\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","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x6E\x61\x6D\x65","\x68\x6F\x73\x74","\x63\x6F\x6E\x74\x65\x78\x74","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\x6F\x72\x64\x65\x72","\x25\x73\x20\x25\x73","\x73\x6F\x72\x74\x5F\x62\x79","\x73\x6F\x72\x74\x5F\x6F\x72\x64\x65\x72","\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x25","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x24","\x72\x6F\x6C\x65","\x73\x70\x6C\x69\x74","\x24\x6C\x69\x6B\x65","\x66\x6F\x72\x49\x6E","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x62\x6C\x65\x77\x20\x75\x70\x21","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x63\x65\x69\x6C","\x6F\x66\x66\x73\x65\x74","\x25\x73\x3A\x2F\x2F\x25\x73\x25\x73\x3F\x70\x61\x67\x65\x3D\x25\x64","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x68\x65\x61\x64\x65\x72\x73","\x62\x61\x73\x65\x55\x72\x6C","\x72\x6F\x77\x73","\x74\x68\x65\x6E","\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","\x74\x72\x75\x6E\x6B\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x62\x6F\x64\x79","\x6C\x6F\x67","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x74\x72\x75\x6E\x6B\x73\x20\x66\x69\x6E\x64\x61\x6C\x6C","\x6C\x65\x6E\x67\x74\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x54\x52\x55\x4E\x4B","\x74\x72\x75\x6E\x6B\x73\x20\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x46\x69\x6E\x64\x69\x6E\x67\x20\x61\x70\x70\x20\x72\x6F\x77\x2E\x2E\x2E\x2E\x2E","\x6D\x65\x72\x67\x65","\x63\x75\x74\x64\x69\x67\x69\x74\x73","\x6C\x69\x74\x65\x72\x61\x6C","\x73\x61\x76\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x4D\x45\x53\x53\x41\x47\x45\x5F\x54\x52\x55\x4E\x4B\x5F\x4F\x55\x54\x42\x4F\x55\x4E\x44\x5F\x41\x53\x53\x4F\x43\x49\x41\x54\x45\x44","\x67\x65\x74\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73"];_0x1bb5[0];var _=require(_0x1bb5[1]);var Trunk=require(_0x1bb5[3])[_0x1bb5[2]];var VoiceExtension=require(_0x1bb5[3])[_0x1bb5[4]];var sequelize=require(_0x1bb5[3])[_0x1bb5[5]];var util=require(_0x1bb5[6]);exports[_0x1bb5[7]]=function(_0xac41x6,_0xac41x7,_0xac41x8){var _0xac41x9=[_0x1bb5[8],_0x1bb5[9],_0x1bb5[10],_0x1bb5[11]];var _0xac41xa=_0xac41x6[_0x1bb5[13]][_0x1bb5[12]]?parseInt(_0xac41x6[_0x1bb5[13]][_0x1bb5[12]],10):100;var _0xac41xb=_0xac41x6[_0x1bb5[13]][_0x1bb5[14]]?parseInt(_0xac41x6[_0x1bb5[13]][_0x1bb5[14]],10):0;var _0xac41xc={where:{},limit:_0xac41xa,offset:_0xac41xb*_0xac41xa};_[_0x1bb5[30]](_0xac41x6[_0x1bb5[13]],function(_0xac41xd,_0xac41xe){switch(_0xac41xe){case _0x1bb5[12]:;case _0x1bb5[14]:break;case _0x1bb5[17]:_0xac41xc[_0x1bb5[15]]=util[_0x1bb5[20]](_0x1bb5[16],_0xac41x6[_0x1bb5[13]][_0x1bb5[17]],_0xac41x6[_0x1bb5[13]][_0x1bb5[18]]||_0x1bb5[19])||null;break;case _0x1bb5[18]:break;case _0x1bb5[26]:_0xac41xc[_0x1bb5[22]][_0x1bb5[21]]=[];_0xac41x9[_0x1bb5[25]](function(_0xac41xf){var _0xac41x10={};_0xac41x10[_0xac41xf]={$like:_0x1bb5[23]+_0xac41xd+_0x1bb5[23]};_0xac41xc[_0x1bb5[22]][_0x1bb5[21]][_0x1bb5[24]](_0xac41x10)});break;case _0x1bb5[27]:_0xac41xc[_0x1bb5[22]][_0x1bb5[27]]={$or:_0xac41xd[_0x1bb5[28]](/[\s,]+/)};break;default:_0xac41xc[_0x1bb5[22]][_0xac41xe]={$like:{}};_0xac41xc[_0x1bb5[22]][_0xac41xe][_0x1bb5[29]]=_0x1bb5[23]+_0xac41xd+_0x1bb5[23]}});Trunk[_0x1bb5[44]](_0xac41xc)[_0x1bb5[43]](function(_0xac41x12){var _0xac41x13=Math[_0x1bb5[36]](_0xac41x12[_0x1bb5[35]]/_0xac41xa);var _0xac41x14=_0xac41x13>(_0xac41xc[_0x1bb5[37]]+1)?util[_0x1bb5[20]](_0x1bb5[38],_0xac41x6[_0x1bb5[39]],_0xac41x6[_0x1bb5[40]][_0x1bb5[9]],_0xac41x6[_0x1bb5[41]],_0xac41xb+1):null;var _0xac41x15=_0xac41xb>0?util[_0x1bb5[20]](_0x1bb5[38],_0xac41x6[_0x1bb5[39]],_0xac41x6[_0x1bb5[40]][_0x1bb5[9]],_0xac41x6[_0x1bb5[41]],_0xac41xb-1):null;_0xac41x7[_0x1bb5[33]](200)[_0x1bb5[32]]({count:_0xac41x12[_0x1bb5[35]],rows:_0xac41x12[_0x1bb5[42]],next_page:_0xac41x14,previous_page:_0xac41x15,total_pages:_0xac41x13})})[_0x1bb5[34]](function(_0xac41x11){_0xac41x7[_0x1bb5[33]](500)[_0x1bb5[32]]({error:_0x1bb5[31]})})};exports[_0x1bb5[45]]=function(_0xac41x6,_0xac41x7){Trunk[_0x1bb5[49]](_0xac41x6[_0x1bb5[48]][_0x1bb5[47]])[_0x1bb5[43]](function(_0xac41x16){if(!_0xac41x16){return _0xac41x7[_0x1bb5[46]](404)};return _0xac41x7[_0x1bb5[32]](_0xac41x16)})[_0x1bb5[34]](function(_0xac41x11){return handleError(_0xac41x7,_0xac41x11)})};exports[_0x1bb5[50]]=function(_0xac41x6,_0xac41x7){console[_0x1bb5[52]](_0xac41x6[_0x1bb5[51]]);Trunk[_0x1bb5[53]]({where:{name:_0xac41x6[_0x1bb5[51]][_0x1bb5[8]]}})[_0x1bb5[43]](function(_0xac41x17){if(!_0xac41x17){return _0xac41x7[_0x1bb5[46]](404)};return _0xac41x7[_0x1bb5[32]](_0xac41x17)})[_0x1bb5[34]](function(_0xac41x11){return handleError(_0xac41x7,_0xac41x11)})};exports[_0x1bb5[54]]=function(_0xac41x6,_0xac41x7){Trunk[_0x1bb5[53]]({where:{name:_0xac41x6[_0x1bb5[51]][_0x1bb5[8]]}})[_0x1bb5[43]](function(_0xac41x18){if(!_0xac41x18){return _0xac41x7[_0x1bb5[46]](404)};if(_0xac41x18[_0x1bb5[56]]>0){return _0xac41x7[_0x1bb5[33]](500)[_0x1bb5[32]]({message:_0x1bb5[57]})};Trunk[_0x1bb5[54]](_0xac41x6[_0x1bb5[51]])[_0x1bb5[43]](function(_0xac41x16){return _0xac41x7[_0x1bb5[33]](201)[_0x1bb5[32]](_0xac41x16)})[_0x1bb5[34]](function(_0xac41x11){console[_0x1bb5[52]](_0x1bb5[58],_0xac41x11);return handleError(_0xac41x7,_0xac41x11)})})[_0x1bb5[34]](function(_0xac41x11){console[_0x1bb5[52]](_0x1bb5[55],_0xac41x11);return handleError(_0xac41x7,_0xac41x11)})};exports[_0x1bb5[59]]=function(_0xac41x6,_0xac41x7,_0xac41x8){Trunk[_0x1bb5[53]]({where:{name:_0xac41x6[_0x1bb5[51]][_0x1bb5[8]],id:{$ne:_0xac41x6[_0x1bb5[51]][_0x1bb5[47]]}}})[_0x1bb5[43]](function(_0xac41x18){console[_0x1bb5[52]](_0xac41x18);console[_0x1bb5[52]](_0x1bb5[60]);if(!_0xac41x18){return _0xac41x7[_0x1bb5[46]](404)};if(_0xac41x18[_0x1bb5[56]]>0){return _0xac41x7[_0x1bb5[33]](500)[_0x1bb5[32]]({message:_0x1bb5[57]})};if(_0xac41x6[_0x1bb5[51]][_0x1bb5[47]]){delete _0xac41x6[_0x1bb5[51]][_0x1bb5[47]]};Trunk[_0x1bb5[49]](_0xac41x6[_0x1bb5[48]][_0x1bb5[47]])[_0x1bb5[43]](function(_0xac41x16){if(!_0xac41x16){return _0xac41x7[_0x1bb5[46]](404)};var _0xac41x19=_[_0x1bb5[61]](_0xac41x16,_0xac41x6[_0x1bb5[51]]);return sequelize[_0x1bb5[65]](function(_0xac41x1a){return _0xac41x19[_0x1bb5[64]]({transaction:_0xac41x1a})[_0x1bb5[43]](function(_0xac41x16){return VoiceExtension[_0x1bb5[59]]({trunk:_0xac41x16[_0x1bb5[8]],cutdigits:sequelize[_0x1bb5[63]](_0x1bb5[62])},{where:{TrunkId:_0xac41x16[_0x1bb5[47]]}},{transaction:_0xac41x1a})[_0x1bb5[43]](function(){return _0xac41x7[_0x1bb5[33]](200)[_0x1bb5[32]](_0xac41x16)})})})[_0x1bb5[34]](function(_0xac41x11){return handleError(_0xac41x7,_0xac41x11)})})[_0x1bb5[34]](function(_0xac41x11){return _0xac41x8(_0xac41x11)})})[_0x1bb5[34]](function(_0xac41x11){return _0xac41x8(_0xac41x11)})};exports[_0x1bb5[66]]=function(_0xac41x6,_0xac41x7){Trunk[_0x1bb5[49]](_0xac41x6[_0x1bb5[48]][_0x1bb5[47]])[_0x1bb5[43]](function(_0xac41x16){if(!_0xac41x16){return _0xac41x7[_0x1bb5[46]](404)};_0xac41x16[_0x1bb5[68]]({where:{isApp:true}})[_0x1bb5[43]](function(_0xac41x1b){console[_0x1bb5[52]](_0xac41x1b[_0x1bb5[56]]);if(_0xac41x1b[_0x1bb5[56]]>0){return _0xac41x7[_0x1bb5[33]](500)[_0x1bb5[32]]({message:_0x1bb5[67]})};_0xac41x16[_0x1bb5[66]]()[_0x1bb5[43]](function(){return _0xac41x7[_0x1bb5[46]](204)})[_0x1bb5[34]](function(_0xac41x11){console[_0x1bb5[52]](_0x1bb5[66],_0xac41x11);return handleError(_0xac41x7,_0xac41x11)})})[_0x1bb5[34]](function(_0xac41x11){return handleError(_0xac41x7,_0xac41x11)})})[_0x1bb5[34]](function(_0xac41x11){return handleError(_0xac41x7,_0xac41x11)})};exports[_0x1bb5[69]]=function(_0xac41x6,_0xac41x7){var _0xac41x1c=false;Trunk[_0x1bb5[53]]({where:{id:_0xac41x6[_0x1bb5[13]][_0x1bb5[47]]},include:[{all:true}]})[_0x1bb5[43]](function(_0xac41x17){if(!_0xac41x17){return _0xac41x7[_0x1bb5[46]](404)};_0xac41x17[_0x1bb5[25]](function(_0xac41x1d){if(_0xac41x1d[_0x1bb5[70]][_0x1bb5[56]]>0){_0xac41x1c=true}});if(_0xac41x1c){return _0xac41x7[_0x1bb5[33]](500)[_0x1bb5[32]]({message:_0x1bb5[67]})};Trunk[_0x1bb5[66]]({where:{id:_0xac41x6[_0x1bb5[13]][_0x1bb5[47]]},individualHooks:true})[_0x1bb5[43]](function(){return _0xac41x7[_0x1bb5[46]](204)})[_0x1bb5[34]](function(_0xac41x11){return handleError(_0xac41x7,_0xac41x11)})})[_0x1bb5[34]](function(_0xac41x11){return handleError(_0xac41x7,_0xac41x11)})};function handleError(_0xac41x7,_0xac41x11){return _0xac41x7[_0x1bb5[33]](500)[_0x1bb5[32]](_0xac41x11)}
\ No newline at end of file
+var _0x6eb6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x54\x72\x75\x6E\x6B","\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","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\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","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x74\x72\x75\x6E\x6B\x20\x75\x70\x64\x61\x74\x65\x20\x65\x72\x72\x6F\x72","\x6C\x6F\x67","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x6eb6[0];var _=require(_0x6eb6[1]);var Trunk=require(_0x6eb6[3])[_0x6eb6[2]];var VoiceExtension=require(_0x6eb6[3])[_0x6eb6[4]];var sequelize=require(_0x6eb6[3])[_0x6eb6[5]];var util=require(_0x6eb6[6]);var Util=require(_0x6eb6[7]);exports[_0x6eb6[8]]= function(_0xb600x7,_0xb600x8,_0xb600x9){return Trunk[_0x6eb6[15]](Util[_0x6eb6[14]](_0xb600x7[_0x6eb6[13]]))[_0x6eb6[12]](function(_0xb600xb){_0xb600x8[_0x6eb6[11]](200)[_0x6eb6[10]](_0xb600xb)})[_0x6eb6[9]](function(_0xb600xa){return handleError(_0xb600x8,_0xb600xa)})};exports[_0x6eb6[16]]= function(_0xb600x7,_0xb600x8){return Trunk[_0x6eb6[20]](_0xb600x7[_0x6eb6[19]][_0x6eb6[18]])[_0x6eb6[12]](function(_0xb600xc){if(!_0xb600xc){return _0xb600x8[_0x6eb6[17]](404)};return _0xb600x8[_0x6eb6[10]](_0xb600xc)})[_0x6eb6[9]](function(_0xb600xa){return handleError(_0xb600x8,_0xb600xa)})};exports[_0x6eb6[21]]= function(_0xb600x7,_0xb600x8){return Trunk[_0x6eb6[21]](_0xb600x7[_0x6eb6[22]])[_0x6eb6[12]](function(_0xb600xc){return _0xb600x8[_0x6eb6[11]](201)[_0x6eb6[10]](_0xb600xc)})[_0x6eb6[9]](function(_0xb600xa){return handleError(_0xb600x8,_0xb600xa)})};exports[_0x6eb6[23]]= function(_0xb600x7,_0xb600x8){if(_0xb600x7[_0x6eb6[22]][_0x6eb6[18]]){delete _0xb600x7[_0x6eb6[22]][_0x6eb6[18]]};return Trunk[_0x6eb6[20]](_0xb600x7[_0x6eb6[19]][_0x6eb6[18]])[_0x6eb6[12]](function(_0xb600xc){if(!_0xb600xc){return _0xb600x8[_0x6eb6[17]](404)};var _0xb600xd=_[_0x6eb6[26]](_0xb600xc,_0xb600x7[_0x6eb6[22]]);return _0xb600xd[_0x6eb6[27]]()})[_0x6eb6[12]](function(_0xb600xc){return _0xb600x8[_0x6eb6[11]](200)[_0x6eb6[10]](_0xb600xc)})[_0x6eb6[9]](function(_0xb600xa){console[_0x6eb6[25]](_0x6eb6[24],_0xb600xa);return handleError(_0xb600x8,_0xb600xa)})};exports[_0x6eb6[28]]= function(_0xb600x7,_0xb600x8){return Trunk[_0x6eb6[20]](_0xb600x7[_0x6eb6[19]][_0x6eb6[18]])[_0x6eb6[12]](function(_0xb600xc){if(!_0xb600xc){return _0xb600x8[_0x6eb6[17]](404)};return _0xb600xc[_0x6eb6[28]]()})[_0x6eb6[12]](function(){return _0xb600x8[_0x6eb6[17]](204)})[_0x6eb6[9]](function(_0xb600xa){return handleError(_0xb600x8,_0xb600xa)})};exports[_0x6eb6[29]]= function(_0xb600x7,_0xb600x8){return Trunk[_0x6eb6[28]]({where:{id:_0xb600x7[_0x6eb6[13]][_0x6eb6[30]]},individualHooks:true})[_0x6eb6[12]](function(){return _0xb600x8[_0x6eb6[17]](204)})[_0x6eb6[9]](function(_0xb600xa){return handleError(_0xb600x8,_0xb600xa)})};function handleError(_0xb600x8,_0xb600xa){return _0xb600x8[_0x6eb6[11]](500)[_0x6eb6[10]](_0xb600xa)}
\ No newline at end of file