Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / server / services / xdr / utils.js
index ca9f88b..f168b61 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf77f=['[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','internal','name','then','[utils][getUser]\x20where:%s','stringify','result','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s'];(function(_0x2bff0b,_0x449287){var _0x28f51c=function(_0x2a6b34){while(--_0x2a6b34){_0x2bff0b['push'](_0x2bff0b['shift']());}};_0x28f51c(++_0x449287);}(_0xf77f,0x134));var _0xff77=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xf77f[_0x243b2f];return _0xcb3c2d;};'use strict';var BPromise=require(_0xff77('0x0'));var jayson=require('jayson/promise');var moment=require(_0xff77('0x1'));var util=require(_0xff77('0x2'));var client=jayson[_0xff77('0x3')][_0xff77('0x4')]({'port':0x2329});var logger=require(_0xff77('0x5'))(_0xff77('0x6'));exports[_0xff77('0x7')]=function(_0x46d176,_0x5ecdd9){logger[_0xff77('0x7')](_0x46d176,_0x5ecdd9?util[_0xff77('0x8')](_0x5ecdd9,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x4e6e64,_0x3c7cd9){logger[_0xff77('0x9')](_0x4e6e64,_0x3c7cd9?util[_0xff77('0x8')](_0x3c7cd9,{'showHidden':![],'depth':null}):'');};exports[_0xff77('0xa')]=function(_0x4a4f77,_0x224f88){logger[_0xff77('0xa')](_0x4a4f77,_0x224f88?util[_0xff77('0x8')](_0x224f88,{'showHidden':![],'depth':null}):'');};exports[_0xff77('0xb')]=function(_0x155db7,_0x2d4d30){return client[_0xff77('0xb')](_0x155db7,{'body':_0x2d4d30})['then'](function(_0x17ef60){logger[_0xff77('0x9')](_0xff77('0xc'),_0x155db7,_0x17ef60?util[_0xff77('0x8')](_0x17ef60,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x5a1287){logger['error'](_0xff77('0xc'),_0x155db7,_0x5a1287?util[_0xff77('0x8')](_0x5a1287,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4b3e95){return client[_0xff77('0xb')](_0xff77('0xd'),{'options':{'raw':!![],'attributes':['id',_0xff77('0xe'),_0xff77('0xf'),'interface'],'where':_0x4b3e95,'limit':0x1}})[_0xff77('0x10')](function(_0xb191b3){logger[_0xff77('0x9')](_0xff77('0x11'),JSON[_0xff77('0x12')](_0x4b3e95),_0xb191b3?util['inspect'](_0xb191b3,{'showHidden':![],'depth':null}):'');return _0xb191b3['result']['length']?_0xb191b3[_0xff77('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x69d6c9){return new BPromise(function(_0x5e48e3,_0x4574d3){if(_0x69d6c9){return getUser({'internal':_0x69d6c9})['then'](function(_0x16078f){logger[_0xff77('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x69d6c9,_0x16078f?'found':_0xff77('0x14'));return _0x5e48e3(_0x16078f);})[_0xff77('0x15')](function(_0x26b323){logger['error'](_0xff77('0x16'),_0x26b323?util[_0xff77('0x8')](_0x26b323,{'showHidden':![],'depth':null}):'');return _0x5e48e3(null);});}return _0x5e48e3(null);});};exports[_0xff77('0x17')]=function(_0x299e79){return new BPromise(function(_0x1eed7f,_0x19d1ee){if(_0x299e79){return getUser({'interface':_0x299e79})['then'](function(_0x28d57d){logger[_0xff77('0x7')](_0xff77('0x18'),_0x299e79,_0x28d57d?_0xff77('0x19'):_0xff77('0x14'));return _0x1eed7f(_0x28d57d);})['catch'](function(_0x238374){logger[_0xff77('0xa')](_0xff77('0x1a'),_0x238374?util[_0xff77('0x8')](_0x238374,{'showHidden':![],'depth':null}):'');return _0x1eed7f(null);});}return _0x1eed7f(null);});};exports['getUserByName']=function(_0x40f114){return new BPromise(function(_0x1fb504,_0x44dc37){if(_0x40f114){return getUser({'name':_0x40f114})[_0xff77('0x10')](function(_0x4ddfaa){logger['info'](_0xff77('0x1b'),_0x40f114,_0x4ddfaa?_0xff77('0x19'):_0xff77('0x14'));return _0x1fb504(_0x4ddfaa);})[_0xff77('0x15')](function(_0x33e69f){logger[_0xff77('0xa')](_0xff77('0x1c'),_0x33e69f?util[_0xff77('0x8')](_0x33e69f,{'showHidden':![],'depth':null}):'');return _0x1fb504(null);});}return _0x1fb504(null);});};exports[_0xff77('0x1d')]=function(_0x14ca34){return new BPromise(function(_0x527bd8,_0x199f40){if(_0x14ca34){return client[_0xff77('0xb')](_0xff77('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xff77('0xf'),'type',_0xff77('0x1f'),_0xff77('0x20')],'where':{'name':_0x14ca34},'limit':0x1}})['then'](function(_0x6c362b){logger[_0xff77('0x9')](_0xff77('0x21'),_0x14ca34,_0x6c362b?util['inspect'](_0x6c362b,{'showHidden':![],'depth':null}):'');logger[_0xff77('0x7')](_0xff77('0x22'),_0x14ca34,_0x6c362b?'found':_0xff77('0x14'));return _0x527bd8(_0x6c362b['result'][_0xff77('0x23')]?_0x6c362b['result'][0x0]:null);})[_0xff77('0x15')](function(_0x618109){logger[_0xff77('0xa')](_0xff77('0x24'),_0x618109?util[_0xff77('0x8')](_0x618109,{'showHidden':![],'depth':null}):'');return _0x527bd8(null);});}return _0x527bd8(null);});};exports[_0xff77('0x25')]=function(_0xe7a76f,_0x2d1410){return moment(_0xe7a76f)[_0xff77('0x26')](_0x2d1410,_0xff77('0x27'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xff77('0x28')]=function(_0x318001,_0x2d83d4){return moment(_0x318001)[_0xff77('0x29')](_0x2d83d4,_0xff77('0x27'))[_0xff77('0x2a')](_0xff77('0x2b'));};exports['diffTime']=function(_0x5a6a07,_0x1f2e47){return moment(_0x5a6a07)[_0xff77('0x2c')](moment(_0x1f2e47),_0xff77('0x27'));};exports[_0xff77('0x2d')]=function(_0x5328d5,_0x1b1de4){return parseInt(_0x5328d5,0xa)+parseInt(_0x1b1de4,0xa);};exports['now']=function(){return moment()[_0xff77('0x2a')](_0xff77('0x2b'));};exports[_0xff77('0x2e')]=function(_0x5be65a,_0x283311){if(_0x283311){return moment(_0x5be65a)[_0xff77('0x2e')](_0x283311);}return!![];};exports[_0xff77('0x2f')]=function(_0x310009,_0x334baa){if(_0x334baa){return moment(_0x310009)['isBefore'](_0x334baa);}else if(_0x310009){return!![];}return![];};
\ No newline at end of file
+var _0x2ba6=['add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime'];(function(_0x38a4a0,_0x4511cc){var _0x44a772=function(_0x77cade){while(--_0x77cade){_0x38a4a0['push'](_0x38a4a0['shift']());}};_0x44a772(++_0x4511cc);}(_0x2ba6,0x1ea));var _0x62ba=function(_0x18437c,_0x47d616){_0x18437c=_0x18437c-0x0;var _0x3f4276=_0x2ba6[_0x18437c];return _0x3f4276;};'use strict';var BPromise=require(_0x62ba('0x0'));var jayson=require(_0x62ba('0x1'));var moment=require(_0x62ba('0x2'));var util=require(_0x62ba('0x3'));var client=jayson[_0x62ba('0x4')]['http']({'port':0x2329});var logger=require(_0x62ba('0x5'))(_0x62ba('0x6'));exports[_0x62ba('0x7')]=function(_0x362f2c,_0x42eef5){logger[_0x62ba('0x7')](_0x362f2c,_0x42eef5?util['inspect'](_0x42eef5,{'showHidden':![],'depth':null}):'');};exports[_0x62ba('0x8')]=function(_0x24c78a,_0x8a432d){logger['debug'](_0x24c78a,_0x8a432d?util[_0x62ba('0x9')](_0x8a432d,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xb60414,_0xc1cb24){logger[_0x62ba('0xa')](_0xb60414,_0xc1cb24?util[_0x62ba('0x9')](_0xc1cb24,{'showHidden':![],'depth':null}):'');};exports[_0x62ba('0xb')]=function(_0x1c5e97,_0x22e81e){return client[_0x62ba('0xb')](_0x1c5e97,{'body':_0x22e81e})[_0x62ba('0xc')](function(_0x54366b){logger[_0x62ba('0x8')](_0x62ba('0xd'),_0x1c5e97,_0x54366b?util[_0x62ba('0x9')](_0x54366b,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4a4aeb){logger[_0x62ba('0xa')](_0x62ba('0xd'),_0x1c5e97,_0x4a4aeb?util[_0x62ba('0x9')](_0x4a4aeb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2bd312){return client[_0x62ba('0xb')](_0x62ba('0xe'),{'options':{'raw':!![],'attributes':['id',_0x62ba('0xf'),_0x62ba('0x10'),_0x62ba('0x11')],'where':_0x2bd312,'limit':0x1}})[_0x62ba('0xc')](function(_0x4535db){logger[_0x62ba('0x8')]('[utils][getUser]\x20where:%s',JSON[_0x62ba('0x12')](_0x2bd312),_0x4535db?util[_0x62ba('0x9')](_0x4535db,{'showHidden':![],'depth':null}):'');return _0x4535db[_0x62ba('0x13')][_0x62ba('0x14')]?_0x4535db['result'][0x0]:null;});}exports[_0x62ba('0x15')]=function(_0x453010){return new BPromise(function(_0x3e0a33,_0x567a38){if(_0x453010){return getUser({'internal':_0x453010})[_0x62ba('0xc')](function(_0x1ea7ab){logger['info'](_0x62ba('0x16'),_0x453010,_0x1ea7ab?_0x62ba('0x17'):_0x62ba('0x18'));return _0x3e0a33(_0x1ea7ab);})[_0x62ba('0x19')](function(_0xf00b36){logger[_0x62ba('0xa')](_0x62ba('0x1a'),_0xf00b36?util[_0x62ba('0x9')](_0xf00b36,{'showHidden':![],'depth':null}):'');return _0x3e0a33(null);});}return _0x3e0a33(null);});};exports[_0x62ba('0x1b')]=function(_0x44ecb3){return new BPromise(function(_0x439cc6,_0x2f7ab2){if(_0x44ecb3){return getUser({'interface':_0x44ecb3})[_0x62ba('0xc')](function(_0x27a867){logger[_0x62ba('0x7')](_0x62ba('0x1c'),_0x44ecb3,_0x27a867?_0x62ba('0x17'):_0x62ba('0x18'));return _0x439cc6(_0x27a867);})[_0x62ba('0x19')](function(_0x84cd96){logger[_0x62ba('0xa')](_0x62ba('0x1d'),_0x84cd96?util[_0x62ba('0x9')](_0x84cd96,{'showHidden':![],'depth':null}):'');return _0x439cc6(null);});}return _0x439cc6(null);});};exports['getUserByName']=function(_0x3b2230){return new BPromise(function(_0x1055a0,_0x146950){if(_0x3b2230){return getUser({'name':_0x3b2230})[_0x62ba('0xc')](function(_0x183b26){logger['info'](_0x62ba('0x1e'),_0x3b2230,_0x183b26?_0x62ba('0x17'):_0x62ba('0x18'));return _0x1055a0(_0x183b26);})['catch'](function(_0x2d2151){logger[_0x62ba('0xa')]('[utils][getUserByName]',_0x2d2151?util[_0x62ba('0x9')](_0x2d2151,{'showHidden':![],'depth':null}):'');return _0x1055a0(null);});}return _0x1055a0(null);});};exports[_0x62ba('0x1f')]=function(_0x8c0e7a){return new BPromise(function(_0x4d4e57,_0x245629){if(_0x8c0e7a){return client[_0x62ba('0xb')](_0x62ba('0x20'),{'options':{'raw':!![],'attributes':['id',_0x62ba('0x10'),_0x62ba('0x21'),_0x62ba('0x22'),'acwTimeout'],'where':{'name':_0x8c0e7a},'limit':0x1}})[_0x62ba('0xc')](function(_0xe587ef){logger['debug'](_0x62ba('0x23'),_0x8c0e7a,_0xe587ef?util[_0x62ba('0x9')](_0xe587ef,{'showHidden':![],'depth':null}):'');logger[_0x62ba('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x8c0e7a,_0xe587ef?'found':_0x62ba('0x18'));return _0x4d4e57(_0xe587ef[_0x62ba('0x13')]['length']?_0xe587ef['result'][0x0]:null);})[_0x62ba('0x19')](function(_0x4b09b0){logger[_0x62ba('0xa')](_0x62ba('0x24'),_0x4b09b0?util[_0x62ba('0x9')](_0x4b09b0,{'showHidden':![],'depth':null}):'');return _0x4d4e57(null);});}return _0x4d4e57(null);});};exports[_0x62ba('0x25')]=function(_0x4e4eec,_0x4cd8fb){return moment(_0x4e4eec)[_0x62ba('0x26')](_0x4cd8fb,_0x62ba('0x27'))[_0x62ba('0x28')](_0x62ba('0x29'));};exports['subtractTime']=function(_0x38a866,_0x5b79df){return moment(_0x38a866)[_0x62ba('0x2a')](_0x5b79df,_0x62ba('0x27'))['format'](_0x62ba('0x29'));};exports['diffTime']=function(_0xe225b2,_0x2cc332){return moment(_0xe225b2)[_0x62ba('0x2b')](moment(_0x2cc332),_0x62ba('0x27'));};exports[_0x62ba('0x2c')]=function(_0x5a307c,_0x5c1c6a){return parseInt(_0x5a307c,0xa)+parseInt(_0x5c1c6a,0xa);};exports[_0x62ba('0x2d')]=function(){return moment()[_0x62ba('0x28')](_0x62ba('0x29'));};exports[_0x62ba('0x2e')]=function(_0x7acf85,_0x9b8efe){if(_0x9b8efe){return moment(_0x7acf85)['isAfter'](_0x9b8efe);}return!![];};exports[_0x62ba('0x2f')]=function(_0x194527,_0x5e21cf){if(_0x5e21cf){return moment(_0x194527)[_0x62ba('0x2f')](_0x5e21cf);}else if(_0x194527){return!![];}return![];};
\ No newline at end of file