Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / services / xdr / utils.js
index ed42b8f..ca9f88b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x60b0=['getUserByInternal','then','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x60b0,0x77));var _0x060b=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x60b0[_0x4de877];return _0xb2cfeb;};'use strict';var BPromise=require(_0x060b('0x0'));var jayson=require(_0x060b('0x1'));var moment=require(_0x060b('0x2'));var util=require(_0x060b('0x3'));var client=jayson[_0x060b('0x4')]['http']({'port':0x2329});var logger=require(_0x060b('0x5'))(_0x060b('0x6'));exports['info']=function(_0x527216,_0x4fa7d3){logger[_0x060b('0x7')](_0x527216,_0x4fa7d3?util['inspect'](_0x4fa7d3,{'showHidden':![],'depth':null}):'');};exports[_0x060b('0x8')]=function(_0x443c79,_0x222945){logger['debug'](_0x443c79,_0x222945?util[_0x060b('0x9')](_0x222945,{'showHidden':![],'depth':null}):'');};exports[_0x060b('0xa')]=function(_0x8cc615,_0xa6ac17){logger[_0x060b('0xa')](_0x8cc615,_0xa6ac17?util['inspect'](_0xa6ac17,{'showHidden':![],'depth':null}):'');};exports[_0x060b('0xb')]=function(_0x1bbc0f,_0x160fed){return client[_0x060b('0xb')](_0x1bbc0f,{'body':_0x160fed})['then'](function(_0x451ffd){logger[_0x060b('0x8')](_0x060b('0xc'),_0x1bbc0f,_0x451ffd?util[_0x060b('0x9')](_0x451ffd,{'showHidden':![],'depth':null}):'');})[_0x060b('0xd')](function(_0x570065){logger['error']('[utils][request]\x20name:%s',_0x1bbc0f,_0x570065?util[_0x060b('0x9')](_0x570065,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1c3796){return client[_0x060b('0xb')](_0x060b('0xe'),{'options':{'raw':!![],'attributes':['id',_0x060b('0xf'),_0x060b('0x10'),_0x060b('0x11')],'where':_0x1c3796,'limit':0x1}})['then'](function(_0x4190b5){logger[_0x060b('0x8')](_0x060b('0x12'),JSON[_0x060b('0x13')](_0x1c3796),_0x4190b5?util[_0x060b('0x9')](_0x4190b5,{'showHidden':![],'depth':null}):'');return _0x4190b5['result'][_0x060b('0x14')]?_0x4190b5[_0x060b('0x15')][0x0]:null;});}exports[_0x060b('0x16')]=function(_0x4194c9){return new BPromise(function(_0x3cce9c,_0x2f9beb){if(_0x4194c9){return getUser({'internal':_0x4194c9})[_0x060b('0x17')](function(_0x61bb65){logger['info'](_0x060b('0x18'),_0x4194c9,_0x61bb65?_0x060b('0x19'):_0x060b('0x1a'));return _0x3cce9c(_0x61bb65);})[_0x060b('0xd')](function(_0x3ef756){logger[_0x060b('0xa')]('[utils][getUserByInternal]',_0x3ef756?util[_0x060b('0x9')](_0x3ef756,{'showHidden':![],'depth':null}):'');return _0x3cce9c(null);});}return _0x3cce9c(null);});};exports[_0x060b('0x1b')]=function(_0x31d8b6){return new BPromise(function(_0x2572bb,_0x26215f){if(_0x31d8b6){return getUser({'interface':_0x31d8b6})[_0x060b('0x17')](function(_0x94d29e){logger[_0x060b('0x7')](_0x060b('0x1c'),_0x31d8b6,_0x94d29e?_0x060b('0x19'):_0x060b('0x1a'));return _0x2572bb(_0x94d29e);})[_0x060b('0xd')](function(_0x340b73){logger[_0x060b('0xa')]('[utils][getUserByInterface]',_0x340b73?util[_0x060b('0x9')](_0x340b73,{'showHidden':![],'depth':null}):'');return _0x2572bb(null);});}return _0x2572bb(null);});};exports[_0x060b('0x1d')]=function(_0x16aa9a){return new BPromise(function(_0x28b4f9,_0x5d129b){if(_0x16aa9a){return getUser({'name':_0x16aa9a})[_0x060b('0x17')](function(_0x2dbff7){logger[_0x060b('0x7')](_0x060b('0x1e'),_0x16aa9a,_0x2dbff7?'found':_0x060b('0x1a'));return _0x28b4f9(_0x2dbff7);})['catch'](function(_0xea3717){logger[_0x060b('0xa')](_0x060b('0x1f'),_0xea3717?util[_0x060b('0x9')](_0xea3717,{'showHidden':![],'depth':null}):'');return _0x28b4f9(null);});}return _0x28b4f9(null);});};exports[_0x060b('0x20')]=function(_0x5b3c8b){return new BPromise(function(_0x524293,_0x2a3523){if(_0x5b3c8b){return client[_0x060b('0xb')](_0x060b('0x21'),{'options':{'raw':!![],'attributes':['id',_0x060b('0x10'),_0x060b('0x22'),'acw',_0x060b('0x23')],'where':{'name':_0x5b3c8b},'limit':0x1}})[_0x060b('0x17')](function(_0x39536d){logger[_0x060b('0x8')](_0x060b('0x24'),_0x5b3c8b,_0x39536d?util[_0x060b('0x9')](_0x39536d,{'showHidden':![],'depth':null}):'');logger[_0x060b('0x7')](_0x060b('0x25'),_0x5b3c8b,_0x39536d?_0x060b('0x19'):_0x060b('0x1a'));return _0x524293(_0x39536d['result'][_0x060b('0x14')]?_0x39536d['result'][0x0]:null);})[_0x060b('0xd')](function(_0x110d05){logger['error']('[utils][getVoiceQueueByName]',_0x110d05?util['inspect'](_0x110d05,{'showHidden':![],'depth':null}):'');return _0x524293(null);});}return _0x524293(null);});};exports['addTime']=function(_0x435078,_0x19edbf){return moment(_0x435078)['add'](_0x19edbf,'seconds')[_0x060b('0x26')](_0x060b('0x27'));};exports[_0x060b('0x28')]=function(_0xaadc9a,_0x51903c){return moment(_0xaadc9a)['subtract'](_0x51903c,_0x060b('0x29'))[_0x060b('0x26')](_0x060b('0x27'));};exports['diffTime']=function(_0x349f81,_0x3241e9){return moment(_0x349f81)[_0x060b('0x2a')](moment(_0x3241e9),_0x060b('0x29'));};exports[_0x060b('0x2b')]=function(_0x4d25aa,_0x541fd6){return parseInt(_0x4d25aa,0xa)+parseInt(_0x541fd6,0xa);};exports[_0x060b('0x2c')]=function(){return moment()['format'](_0x060b('0x27'));};exports['isAfter']=function(_0x2125a2,_0x34491d){if(_0x34491d){return moment(_0x2125a2)[_0x060b('0x2d')](_0x34491d);}return!![];};exports[_0x060b('0x2e')]=function(_0x286706,_0x5e4240){if(_0x5e4240){return moment(_0x286706)['isBefore'](_0x5e4240);}else if(_0x286706){return!![];}return![];};
\ No newline at end of file
+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