Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / services / xdr / utils.js
index 81e54fb..3638f2f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f47=['bluebird','client','../../config/logger','info','debug','stringify','error','request','then','stack','GetUser','internal','name','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','catch','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment'];(function(_0x5b816b,_0x269404){var _0x3363f8=function(_0x2c121f){while(--_0x2c121f){_0x5b816b['push'](_0x5b816b['shift']());}};_0x3363f8(++_0x269404);}(_0x5f47,0x146));var _0x75f4=function(_0x53b243,_0x13e5a6){_0x53b243=_0x53b243-0x0;var _0x502dfd=_0x5f47[_0x53b243];return _0x502dfd;};'use strict';var jayson=require(_0x75f4('0x0'));var moment=require(_0x75f4('0x1'));var BPromise=require(_0x75f4('0x2'));var client=jayson[_0x75f4('0x3')]['http']({'port':0x2329});var logger=require(_0x75f4('0x4'))('xdr');exports[_0x75f4('0x5')]=function(_0xc98c54){logger[_0x75f4('0x5')](_0xc98c54);};exports[_0x75f4('0x6')]=function(_0x141931){logger[_0x75f4('0x6')](JSON[_0x75f4('0x7')](_0x141931));};exports[_0x75f4('0x8')]=function(_0x21328b){logger[_0x75f4('0x8')](_0x21328b['stack']);};exports['request']=function(_0x36ab98,_0x3737a6){return client[_0x75f4('0x9')](_0x36ab98,{'body':_0x3737a6})[_0x75f4('0xa')](function(_0x95222a){logger[_0x75f4('0x6')](JSON[_0x75f4('0x7')](_0x95222a));})['catch'](function(_0x3285c6){logger[_0x75f4('0x8')](_0x3285c6[_0x75f4('0xb')]);});};function getUser(_0x1037d1){return client['request'](_0x75f4('0xc'),{'options':{'raw':!![],'attributes':['id',_0x75f4('0xd'),_0x75f4('0xe'),_0x75f4('0xf')],'where':_0x1037d1,'limit':0x1}})['then'](function(_0x9f99a2){logger['info'](_0x75f4('0x10')+JSON[_0x75f4('0x7')](_0x1037d1)+'|'+(_0x9f99a2[_0x75f4('0x11')][_0x75f4('0x12')]?_0x75f4('0x13'):_0x75f4('0x14')));return _0x9f99a2[_0x75f4('0x11')][_0x75f4('0x12')]?_0x9f99a2[_0x75f4('0x11')][0x0]:null;});}exports[_0x75f4('0x15')]=function(_0x34c5c2){return new BPromise(function(_0x1f84ba,_0x109bdb){if(_0x34c5c2){return getUser({'internal':_0x34c5c2})[_0x75f4('0xa')](function(_0x385508){return _0x1f84ba(_0x385508);})['catch'](function(_0x170e8e){logger[_0x75f4('0x8')](_0x170e8e[_0x75f4('0xb')]);return _0x1f84ba(null);});}else{return _0x1f84ba(null);}});};exports['getUserByInterface']=function(_0x4982a7){return new BPromise(function(_0x14b354,_0x28af6e){if(_0x4982a7){return getUser({'interface':_0x4982a7})[_0x75f4('0xa')](function(_0x4fe624){return _0x14b354(_0x4fe624);})[_0x75f4('0x16')](function(_0xece96f){logger[_0x75f4('0x8')](_0xece96f['stack']);return _0x14b354(null);});}else{return _0x14b354(null);}});};exports[_0x75f4('0x17')]=function(_0x101308){return new BPromise(function(_0x55bccc,_0x167920){if(_0x101308){return getUser({'name':_0x101308})[_0x75f4('0xa')](function(_0x116dd1){return _0x55bccc(_0x116dd1);})[_0x75f4('0x16')](function(_0x65386){logger[_0x75f4('0x8')](_0x65386[_0x75f4('0xb')]);return _0x55bccc(null);});}else{return _0x55bccc(null);}});};exports[_0x75f4('0x18')]=function(_0x52ad02){return new BPromise(function(_0x59e4d1,_0x5b1fc8){if(_0x52ad02){return client[_0x75f4('0x9')](_0x75f4('0x19'),{'options':{'raw':!![],'attributes':['id',_0x75f4('0xe'),_0x75f4('0x1a'),'acw',_0x75f4('0x1b')],'where':{'name':_0x52ad02},'limit':0x1}})[_0x75f4('0xa')](function(_0x44548c){logger[_0x75f4('0x5')](_0x75f4('0x1c')+_0x52ad02+'|'+(_0x44548c[_0x75f4('0x11')][_0x75f4('0x12')]?_0x75f4('0x13'):_0x75f4('0x14')));return _0x59e4d1(_0x44548c[_0x75f4('0x11')][_0x75f4('0x12')]?_0x44548c[_0x75f4('0x11')][0x0]:null);})['catch'](function(_0x50bdd5){logger[_0x75f4('0x8')](_0x50bdd5[_0x75f4('0xb')]);return _0x59e4d1(null);});}else{return _0x59e4d1(null);}});};exports['addTime']=function(_0x160d28,_0x45d8f9){return moment(_0x160d28)[_0x75f4('0x1d')](_0x45d8f9,_0x75f4('0x1e'))[_0x75f4('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x75f4('0x20')]=function(_0x22fcfc,_0x5b46be){return moment(_0x22fcfc)[_0x75f4('0x21')](_0x5b46be,'seconds')[_0x75f4('0x1f')](_0x75f4('0x22'));};exports[_0x75f4('0x23')]=function(_0x5d45a6,_0x210c58){return moment(_0x5d45a6)[_0x75f4('0x24')](moment(_0x210c58),_0x75f4('0x1e'));};exports[_0x75f4('0x25')]=function(_0x1a1559,_0x5477ba){return parseInt(_0x1a1559,0xa)+parseInt(_0x5477ba,0xa);};exports[_0x75f4('0x26')]=function(){return moment()[_0x75f4('0x1f')](_0x75f4('0x22'));};exports[_0x75f4('0x27')]=function(_0x355ad0,_0x589877){if(_0x589877){return moment(_0x355ad0)[_0x75f4('0x27')](_0x589877);}else{return!![];}};exports[_0x75f4('0x28')]=function(_0x474ac9,_0x438d71){if(_0x438d71){return moment(_0x474ac9)[_0x75f4('0x28')](_0x438d71);}else if(_0x474ac9){return!![];}else{return![];}};
\ No newline at end of file
+var _0xd840=['catch','internal','name','interface','then','GETUSER|','stringify','length','FOUND','NOTFOUND','result','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diff','sumTime','isAfter','isBefore','moment','bluebird','client','http','../../config/logger','info','debug','error','stack','request'];(function(_0x49933b,_0xf55e90){var _0xe9b5c0=function(_0x389ef3){while(--_0x389ef3){_0x49933b['push'](_0x49933b['shift']());}};_0xe9b5c0(++_0xf55e90);}(_0xd840,0x1be));var _0x0d84=function(_0x5a09db,_0x41a70c){_0x5a09db=_0x5a09db-0x0;var _0x3f722a=_0xd840[_0x5a09db];return _0x3f722a;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x0d84('0x0'));var BPromise=require(_0x0d84('0x1'));var client=jayson[_0x0d84('0x2')][_0x0d84('0x3')]({'port':0x2329});var logger=require(_0x0d84('0x4'))('xdr');exports[_0x0d84('0x5')]=function(_0x1ce2f4){logger['info'](_0x1ce2f4);};exports['debug']=function(_0x54484f){logger[_0x0d84('0x6')](JSON['stringify'](_0x54484f));};exports[_0x0d84('0x7')]=function(_0x36bc7e){logger[_0x0d84('0x7')](_0x36bc7e[_0x0d84('0x8')]);};exports[_0x0d84('0x9')]=function(_0x4afede,_0x4bbd86){return client[_0x0d84('0x9')](_0x4afede,{'body':_0x4bbd86})['then'](function(_0x5674b0){logger[_0x0d84('0x6')](JSON['stringify'](_0x5674b0));})[_0x0d84('0xa')](function(_0x2e2474){logger[_0x0d84('0x7')](_0x2e2474['stack']);});};function getUser(_0x17e946){return client[_0x0d84('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0d84('0xb'),_0x0d84('0xc'),_0x0d84('0xd')],'where':_0x17e946,'limit':0x1}})[_0x0d84('0xe')](function(_0x323a22){logger[_0x0d84('0x5')](_0x0d84('0xf')+JSON[_0x0d84('0x10')](_0x17e946)+'|'+(_0x323a22['result'][_0x0d84('0x11')]?_0x0d84('0x12'):_0x0d84('0x13')));return _0x323a22[_0x0d84('0x14')]['length']?_0x323a22[_0x0d84('0x14')][0x0]:null;});}exports[_0x0d84('0x15')]=function(_0x348511){return new BPromise(function(_0x38f2d7,_0x263886){if(_0x348511){return getUser({'internal':_0x348511})[_0x0d84('0xe')](function(_0x20294f){return _0x38f2d7(_0x20294f);})['catch'](function(_0x3d6c2a){logger['error'](_0x3d6c2a['stack']);return _0x38f2d7(null);});}else{return _0x38f2d7(null);}});};exports[_0x0d84('0x16')]=function(_0x5e3957){return new BPromise(function(_0x186b36,_0x235afb){if(_0x5e3957){return getUser({'interface':_0x5e3957})['then'](function(_0x11789e){return _0x186b36(_0x11789e);})[_0x0d84('0xa')](function(_0x2e7956){logger[_0x0d84('0x7')](_0x2e7956[_0x0d84('0x8')]);return _0x186b36(null);});}else{return _0x186b36(null);}});};exports[_0x0d84('0x17')]=function(_0x51068c){return new BPromise(function(_0x12edcb,_0x1c02c1){if(_0x51068c){return getUser({'name':_0x51068c})[_0x0d84('0xe')](function(_0x999c9c){return _0x12edcb(_0x999c9c);})[_0x0d84('0xa')](function(_0x1e323c){logger[_0x0d84('0x7')](_0x1e323c['stack']);return _0x12edcb(null);});}else{return _0x12edcb(null);}});};exports['getVoiceQueueByName']=function(_0x18644a){return new BPromise(function(_0x1141d8,_0x3c2a82){if(_0x18644a){return client['request'](_0x0d84('0x18'),{'options':{'raw':!![],'attributes':['id',_0x0d84('0xc'),_0x0d84('0x19'),_0x0d84('0x1a'),'acwTimeout'],'where':{'name':_0x18644a},'limit':0x1}})['then'](function(_0x305ecb){logger[_0x0d84('0x5')](_0x0d84('0x1b')+_0x18644a+'|'+(_0x305ecb['result']['length']?_0x0d84('0x12'):_0x0d84('0x13')));return _0x1141d8(_0x305ecb[_0x0d84('0x14')][_0x0d84('0x11')]?_0x305ecb[_0x0d84('0x14')][0x0]:null);})[_0x0d84('0xa')](function(_0x491c6c){logger[_0x0d84('0x7')](_0x491c6c[_0x0d84('0x8')]);return _0x1141d8(null);});}else{return _0x1141d8(null);}});};exports['addTime']=function(_0x3e6625,_0x5a6274){return moment(_0x3e6625)[_0x0d84('0x1c')](_0x5a6274,'seconds')[_0x0d84('0x1d')](_0x0d84('0x1e'));};exports[_0x0d84('0x1f')]=function(_0x5e9316,_0x425da6){return moment(_0x5e9316)[_0x0d84('0x20')](_0x425da6,_0x0d84('0x21'))[_0x0d84('0x1d')](_0x0d84('0x1e'));};exports['diffTime']=function(_0xc1ff69,_0x44e08b){return moment(_0xc1ff69)[_0x0d84('0x22')](moment(_0x44e08b),'seconds');};exports[_0x0d84('0x23')]=function(_0x32f52a,_0x5e30d2){return parseInt(_0x32f52a,0xa)+parseInt(_0x5e30d2,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0d84('0x24')]=function(_0x566595,_0x79b554){if(_0x79b554){return moment(_0x566595)[_0x0d84('0x24')](_0x79b554);}else{return!![];}};exports[_0x0d84('0x25')]=function(_0x5d324f,_0x540372){if(_0x540372){return moment(_0x5d324f)[_0x0d84('0x25')](_0x540372);}else if(_0x5d324f){return!![];}else{return![];}};
\ No newline at end of file