Built motion from commit bfa6da2.|0.0.130
[motion.git] / server / api / trunk / trunk.controller.js
index f6dd24f..071fc72 100644 (file)
@@ -1 +1 @@
-var _0xe073=["\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"];_0xe073[0];var _=require(_0xe073[1]);var Trunk=require(_0xe073[3])[_0xe073[2]];var VoiceExtension=require(_0xe073[3])[_0xe073[4]];var sequelize=require(_0xe073[3])[_0xe073[5]];var util=require(_0xe073[6]);exports[_0xe073[7]]=function(_0x7d2bx6,_0x7d2bx7,_0x7d2bx8){var _0x7d2bx9=[_0xe073[8],_0xe073[9],_0xe073[10],_0xe073[11]];var _0x7d2bxa=_0x7d2bx6[_0xe073[13]][_0xe073[12]]?parseInt(_0x7d2bx6[_0xe073[13]][_0xe073[12]],10):100;var _0x7d2bxb=_0x7d2bx6[_0xe073[13]][_0xe073[14]]?parseInt(_0x7d2bx6[_0xe073[13]][_0xe073[14]],10):0;var _0x7d2bxc={where:{},limit:_0x7d2bxa,offset:_0x7d2bxb*_0x7d2bxa};_[_0xe073[30]](_0x7d2bx6[_0xe073[13]],function(_0x7d2bxd,_0x7d2bxe){switch(_0x7d2bxe){case _0xe073[12]:;case _0xe073[14]:break ;;case _0xe073[17]:_0x7d2bxc[_0xe073[15]]=util[_0xe073[20]](_0xe073[16],_0x7d2bx6[_0xe073[13]][_0xe073[17]],_0x7d2bx6[_0xe073[13]][_0xe073[18]]||_0xe073[19])||null;break ;;case _0xe073[18]:break ;;case _0xe073[26]:_0x7d2bxc[_0xe073[22]][_0xe073[21]]=[];_0x7d2bx9[_0xe073[25]](function(_0x7d2bxf){var _0x7d2bx10={};_0x7d2bx10[_0x7d2bxf]={$like:_0xe073[23]+_0x7d2bxd+_0xe073[23]};_0x7d2bxc[_0xe073[22]][_0xe073[21]][_0xe073[24]](_0x7d2bx10);});break ;;case _0xe073[27]:_0x7d2bxc[_0xe073[22]][_0xe073[27]]={$or:_0x7d2bxd[_0xe073[28]](/[\s,]+/)};break ;;default:_0x7d2bxc[_0xe073[22]][_0x7d2bxe]={$like:{}};_0x7d2bxc[_0xe073[22]][_0x7d2bxe][_0xe073[29]]=_0xe073[23]+_0x7d2bxd+_0xe073[23];;}});Trunk[_0xe073[44]](_0x7d2bxc)[_0xe073[43]](function(_0x7d2bx12){var _0x7d2bx13=Math[_0xe073[36]](_0x7d2bx12[_0xe073[35]]/_0x7d2bxa);var _0x7d2bx14=_0x7d2bx13>(_0x7d2bxc[_0xe073[37]]+1)?util[_0xe073[20]](_0xe073[38],_0x7d2bx6[_0xe073[39]],_0x7d2bx6[_0xe073[40]][_0xe073[9]],_0x7d2bx6[_0xe073[41]],_0x7d2bxb+1):null;var _0x7d2bx15=_0x7d2bxb>0?util[_0xe073[20]](_0xe073[38],_0x7d2bx6[_0xe073[39]],_0x7d2bx6[_0xe073[40]][_0xe073[9]],_0x7d2bx6[_0xe073[41]],_0x7d2bxb-1):null;_0x7d2bx7[_0xe073[33]](200)[_0xe073[32]]({count:_0x7d2bx12[_0xe073[35]],rows:_0x7d2bx12[_0xe073[42]],next_page:_0x7d2bx14,previous_page:_0x7d2bx15,total_pages:_0x7d2bx13});})[_0xe073[34]](function(_0x7d2bx11){_0x7d2bx7[_0xe073[33]](500)[_0xe073[32]]({error:_0xe073[31]})});};exports[_0xe073[45]]=function(_0x7d2bx6,_0x7d2bx7){Trunk[_0xe073[49]](_0x7d2bx6[_0xe073[48]][_0xe073[47]])[_0xe073[43]](function(_0x7d2bx16){if(!_0x7d2bx16){return _0x7d2bx7[_0xe073[46]](404)};return _0x7d2bx7[_0xe073[32]](_0x7d2bx16);})[_0xe073[34]](function(_0x7d2bx11){return handleError(_0x7d2bx7,_0x7d2bx11)})};exports[_0xe073[50]]=function(_0x7d2bx6,_0x7d2bx7){console[_0xe073[52]](_0x7d2bx6[_0xe073[51]]);Trunk[_0xe073[53]]({where:{name:_0x7d2bx6[_0xe073[51]][_0xe073[8]]}})[_0xe073[43]](function(_0x7d2bx17){if(!_0x7d2bx17){return _0x7d2bx7[_0xe073[46]](404)};return _0x7d2bx7[_0xe073[32]](_0x7d2bx17);})[_0xe073[34]](function(_0x7d2bx11){return handleError(_0x7d2bx7,_0x7d2bx11)});};exports[_0xe073[54]]=function(_0x7d2bx6,_0x7d2bx7){Trunk[_0xe073[53]]({where:{name:_0x7d2bx6[_0xe073[51]][_0xe073[8]]}})[_0xe073[43]](function(_0x7d2bx18){if(!_0x7d2bx18){return _0x7d2bx7[_0xe073[46]](404)};if(_0x7d2bx18[_0xe073[56]]>0){return _0x7d2bx7[_0xe073[33]](500)[_0xe073[32]]({message:_0xe073[57]})};Trunk[_0xe073[54]](_0x7d2bx6[_0xe073[51]])[_0xe073[43]](function(_0x7d2bx16){return _0x7d2bx7[_0xe073[33]](201)[_0xe073[32]](_0x7d2bx16)})[_0xe073[34]](function(_0x7d2bx11){console[_0xe073[52]](_0xe073[58],_0x7d2bx11);return handleError(_0x7d2bx7,_0x7d2bx11);});})[_0xe073[34]](function(_0x7d2bx11){console[_0xe073[52]](_0xe073[55],_0x7d2bx11);return handleError(_0x7d2bx7,_0x7d2bx11);})};exports[_0xe073[59]]=function(_0x7d2bx6,_0x7d2bx7,_0x7d2bx8){Trunk[_0xe073[53]]({where:{name:_0x7d2bx6[_0xe073[51]][_0xe073[8]],id:{$ne:_0x7d2bx6[_0xe073[51]][_0xe073[47]]}}})[_0xe073[43]](function(_0x7d2bx18){console[_0xe073[52]](_0x7d2bx18);console[_0xe073[52]](_0xe073[60]);if(!_0x7d2bx18){return _0x7d2bx7[_0xe073[46]](404)};if(_0x7d2bx18[_0xe073[56]]>0){return _0x7d2bx7[_0xe073[33]](500)[_0xe073[32]]({message:_0xe073[57]})};if(_0x7d2bx6[_0xe073[51]][_0xe073[47]]){delete _0x7d2bx6[_0xe073[51]][_0xe073[47]]};Trunk[_0xe073[49]](_0x7d2bx6[_0xe073[48]][_0xe073[47]])[_0xe073[43]](function(_0x7d2bx16){if(!_0x7d2bx16){return _0x7d2bx7[_0xe073[46]](404)};var _0x7d2bx19=_[_0xe073[61]](_0x7d2bx16,_0x7d2bx6[_0xe073[51]]);return sequelize[_0xe073[65]](function(_0x7d2bx1a){return _0x7d2bx19[_0xe073[64]]({transaction:_0x7d2bx1a})[_0xe073[43]](function(_0x7d2bx16){return VoiceExtension[_0xe073[59]]({trunk:_0x7d2bx16[_0xe073[8]],cutdigits:sequelize[_0xe073[63]](_0xe073[62])},{where:{TrunkId:_0x7d2bx16[_0xe073[47]]}},{transaction:_0x7d2bx1a})[_0xe073[43]](function(){return _0x7d2bx7[_0xe073[33]](200)[_0xe073[32]](_0x7d2bx16)})})})[_0xe073[34]](function(_0x7d2bx11){return handleError(_0x7d2bx7,_0x7d2bx11)});})[_0xe073[34]](function(_0x7d2bx11){return _0x7d2bx8(_0x7d2bx11)});})[_0xe073[34]](function(_0x7d2bx11){return _0x7d2bx8(_0x7d2bx11)})};exports[_0xe073[66]]=function(_0x7d2bx6,_0x7d2bx7){Trunk[_0xe073[49]](_0x7d2bx6[_0xe073[48]][_0xe073[47]])[_0xe073[43]](function(_0x7d2bx16){if(!_0x7d2bx16){return _0x7d2bx7[_0xe073[46]](404)};_0x7d2bx16[_0xe073[68]]({where:{isApp:true}})[_0xe073[43]](function(_0x7d2bx1b){console[_0xe073[52]](_0x7d2bx1b[_0xe073[56]]);if(_0x7d2bx1b[_0xe073[56]]>0){return _0x7d2bx7[_0xe073[33]](500)[_0xe073[32]]({message:_0xe073[67]})};_0x7d2bx16[_0xe073[66]]()[_0xe073[43]](function(){return _0x7d2bx7[_0xe073[46]](204)})[_0xe073[34]](function(_0x7d2bx11){console[_0xe073[52]](_0xe073[66],_0x7d2bx11);return handleError(_0x7d2bx7,_0x7d2bx11);});})[_0xe073[34]](function(_0x7d2bx11){return handleError(_0x7d2bx7,_0x7d2bx11)});})[_0xe073[34]](function(_0x7d2bx11){return handleError(_0x7d2bx7,_0x7d2bx11)})};exports[_0xe073[69]]=function(_0x7d2bx6,_0x7d2bx7){var _0x7d2bx1c=false;Trunk[_0xe073[53]]({where:{id:_0x7d2bx6[_0xe073[13]][_0xe073[47]]},include:[{all:true}]})[_0xe073[43]](function(_0x7d2bx17){if(!_0x7d2bx17){return _0x7d2bx7[_0xe073[46]](404)};_0x7d2bx17[_0xe073[25]](function(_0x7d2bx1d){if(_0x7d2bx1d[_0xe073[70]][_0xe073[56]]>0){_0x7d2bx1c=true}});if(_0x7d2bx1c){return _0x7d2bx7[_0xe073[33]](500)[_0xe073[32]]({message:_0xe073[67]})};Trunk[_0xe073[66]]({where:{id:_0x7d2bx6[_0xe073[13]][_0xe073[47]]},individualHooks:true})[_0xe073[43]](function(){return _0x7d2bx7[_0xe073[46]](204)})[_0xe073[34]](function(_0x7d2bx11){return handleError(_0x7d2bx7,_0x7d2bx11)});})[_0xe073[34]](function(_0x7d2bx11){return handleError(_0x7d2bx7,_0x7d2bx11)});};function handleError(_0x7d2bx7,_0x7d2bx11){return _0x7d2bx7[_0xe073[33]](500)[_0xe073[32]](_0x7d2bx11)}
\ No newline at end of file
+var _0x274a=["\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"];_0x274a[0];var _=require(_0x274a[1]);var Trunk=require(_0x274a[3])[_0x274a[2]];var VoiceExtension=require(_0x274a[3])[_0x274a[4]];var sequelize=require(_0x274a[3])[_0x274a[5]];var util=require(_0x274a[6]);var Util=require(_0x274a[7]);exports[_0x274a[8]]= function(_0xf949x7,_0xf949x8,_0xf949x9){return Trunk[_0x274a[15]](Util[_0x274a[14]](_0xf949x7[_0x274a[13]]))[_0x274a[12]](function(_0xf949xb){_0xf949x8[_0x274a[11]](200)[_0x274a[10]](_0xf949xb)})[_0x274a[9]](function(_0xf949xa){return handleError(_0xf949x8,_0xf949xa)})};exports[_0x274a[16]]= function(_0xf949x7,_0xf949x8){return Trunk[_0x274a[20]](_0xf949x7[_0x274a[19]][_0x274a[18]])[_0x274a[12]](function(_0xf949xc){if(!_0xf949xc){return _0xf949x8[_0x274a[17]](404)};return _0xf949x8[_0x274a[10]](_0xf949xc)})[_0x274a[9]](function(_0xf949xa){return handleError(_0xf949x8,_0xf949xa)})};exports[_0x274a[21]]= function(_0xf949x7,_0xf949x8){return Trunk[_0x274a[21]](_0xf949x7[_0x274a[22]])[_0x274a[12]](function(_0xf949xc){return _0xf949x8[_0x274a[11]](201)[_0x274a[10]](_0xf949xc)})[_0x274a[9]](function(_0xf949xa){return handleError(_0xf949x8,_0xf949xa)})};exports[_0x274a[23]]= function(_0xf949x7,_0xf949x8){if(_0xf949x7[_0x274a[22]][_0x274a[18]]){delete _0xf949x7[_0x274a[22]][_0x274a[18]]};return Trunk[_0x274a[20]](_0xf949x7[_0x274a[19]][_0x274a[18]])[_0x274a[12]](function(_0xf949xc){if(!_0xf949xc){return _0xf949x8[_0x274a[17]](404)};var _0xf949xd=_[_0x274a[26]](_0xf949xc,_0xf949x7[_0x274a[22]]);return _0xf949xd[_0x274a[27]]()})[_0x274a[12]](function(_0xf949xc){return _0xf949x8[_0x274a[11]](200)[_0x274a[10]](_0xf949xc)})[_0x274a[9]](function(_0xf949xa){console[_0x274a[25]](_0x274a[24],_0xf949xa);return handleError(_0xf949x8,_0xf949xa)})};exports[_0x274a[28]]= function(_0xf949x7,_0xf949x8){return Trunk[_0x274a[20]](_0xf949x7[_0x274a[19]][_0x274a[18]])[_0x274a[12]](function(_0xf949xc){if(!_0xf949xc){return _0xf949x8[_0x274a[17]](404)};return _0xf949xc[_0x274a[28]]()})[_0x274a[12]](function(){return _0xf949x8[_0x274a[17]](204)})[_0x274a[9]](function(_0xf949xa){return handleError(_0xf949x8,_0xf949xa)})};exports[_0x274a[29]]= function(_0xf949x7,_0xf949x8){return Trunk[_0x274a[28]]({where:{id:_0xf949x7[_0x274a[13]][_0x274a[30]]},individualHooks:true})[_0x274a[12]](function(){return _0xf949x8[_0x274a[17]](204)})[_0x274a[9]](function(_0xf949xa){return handleError(_0xf949x8,_0xf949xa)})};function handleError(_0xf949x8,_0xf949xa){return _0xf949x8[_0x274a[11]](500)[_0x274a[10]](_0xf949xa)}
\ No newline at end of file