Built motion from commit 06eb8eb0.|2.6.31
[motion2.git] / server / services / xdr / utils.js
index 6fad905..7da928b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x529d=['debug','error','request','then','[utils][request]\x20name:%s','catch','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','notfound','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','sumTime','now','format','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','xdr','info','inspect'];(function(_0x101d59,_0x331222){var _0x31dddd=function(_0x1598e8){while(--_0x1598e8){_0x101d59['push'](_0x101d59['shift']());}};_0x31dddd(++_0x331222);}(_0x529d,0x177));var _0xd529=function(_0x256c1e,_0x2ad331){_0x256c1e=_0x256c1e-0x0;var _0x2871ad=_0x529d[_0x256c1e];return _0x2871ad;};'use strict';var BPromise=require(_0xd529('0x0'));var jayson=require(_0xd529('0x1'));var moment=require('moment');var util=require(_0xd529('0x2'));var client=jayson[_0xd529('0x3')][_0xd529('0x4')]({'port':0x2329});var logger=require(_0xd529('0x5'))(_0xd529('0x6'));exports[_0xd529('0x7')]=function(_0x5b2006,_0x3dd639){logger[_0xd529('0x7')](_0x5b2006,_0x3dd639?util[_0xd529('0x8')](_0x3dd639,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x310e1b,_0xa10a61){logger[_0xd529('0x9')](_0x310e1b,_0xa10a61?util[_0xd529('0x8')](_0xa10a61,{'showHidden':![],'depth':null}):'');};exports[_0xd529('0xa')]=function(_0x3d3171,_0x1b1879){logger[_0xd529('0xa')](_0x3d3171,_0x1b1879?util[_0xd529('0x8')](_0x1b1879,{'showHidden':![],'depth':null}):'');};exports[_0xd529('0xb')]=function(_0x13314b,_0x510151){return client[_0xd529('0xb')](_0x13314b,{'body':_0x510151})[_0xd529('0xc')](function(_0xb89101){logger[_0xd529('0x9')](_0xd529('0xd'),_0x13314b,_0xb89101?util[_0xd529('0x8')](_0xb89101,{'showHidden':![],'depth':null}):'');})[_0xd529('0xe')](function(_0x7d9cc2){logger[_0xd529('0xa')]('[utils][request]\x20name:%s',_0x13314b,_0x7d9cc2?util['inspect'](_0x7d9cc2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x20d90b){return client[_0xd529('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xd529('0xf'),_0xd529('0x10')],'where':_0x20d90b,'limit':0x1}})[_0xd529('0xc')](function(_0x157c76){logger[_0xd529('0x9')](_0xd529('0x11'),JSON[_0xd529('0x12')](_0x20d90b),_0x157c76?util[_0xd529('0x8')](_0x157c76,{'showHidden':![],'depth':null}):'');return _0x157c76[_0xd529('0x13')][_0xd529('0x14')]?_0x157c76['result'][0x0]:null;});}exports[_0xd529('0x15')]=function(_0x280bae){return new BPromise(function(_0x23565d,_0x1fc9aa){if(_0x280bae){return getUser({'internal':_0x280bae})[_0xd529('0xc')](function(_0x2a6ca8){logger[_0xd529('0x7')](_0xd529('0x16'),_0x280bae,_0x2a6ca8?_0xd529('0x17'):'notfound');return _0x23565d(_0x2a6ca8);})[_0xd529('0xe')](function(_0x5719b5){logger[_0xd529('0xa')](_0xd529('0x18'),_0x5719b5?util[_0xd529('0x8')](_0x5719b5,{'showHidden':![],'depth':null}):'');return _0x23565d(null);});}return _0x23565d(null);});};exports['getUserByInterface']=function(_0x1d4c09){return new BPromise(function(_0x3ba832,_0x597837){if(_0x1d4c09){return getUser({'interface':_0x1d4c09})[_0xd529('0xc')](function(_0x47d33f){logger[_0xd529('0x7')](_0xd529('0x19'),_0x1d4c09,_0x47d33f?_0xd529('0x17'):'notfound');return _0x3ba832(_0x47d33f);})['catch'](function(_0x447ba5){logger[_0xd529('0xa')](_0xd529('0x1a'),_0x447ba5?util[_0xd529('0x8')](_0x447ba5,{'showHidden':![],'depth':null}):'');return _0x3ba832(null);});}return _0x3ba832(null);});};exports[_0xd529('0x1b')]=function(_0x408a9c){return new BPromise(function(_0x3f7f7,_0x23e589){if(_0x408a9c){return getUser({'name':_0x408a9c})[_0xd529('0xc')](function(_0x244ee3){logger[_0xd529('0x7')](_0xd529('0x1c'),_0x408a9c,_0x244ee3?_0xd529('0x17'):'notfound');return _0x3f7f7(_0x244ee3);})[_0xd529('0xe')](function(_0x8edd67){logger[_0xd529('0xa')]('[utils][getUserByName]',_0x8edd67?util['inspect'](_0x8edd67,{'showHidden':![],'depth':null}):'');return _0x3f7f7(null);});}return _0x3f7f7(null);});};exports[_0xd529('0x1d')]=function(_0x2ad375){return new BPromise(function(_0x4762ee,_0x8e9f3d){if(_0x2ad375){return client[_0xd529('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xd529('0xf'),_0xd529('0x1e'),_0xd529('0x1f'),'acwTimeout'],'where':{'name':_0x2ad375},'limit':0x1}})['then'](function(_0x23b94d){logger['debug'](_0xd529('0x20'),_0x2ad375,_0x23b94d?util[_0xd529('0x8')](_0x23b94d,{'showHidden':![],'depth':null}):'');logger[_0xd529('0x7')](_0xd529('0x21'),_0x2ad375,_0x23b94d?'found':_0xd529('0x22'));return _0x4762ee(_0x23b94d[_0xd529('0x13')]['length']?_0x23b94d[_0xd529('0x13')][0x0]:null);})['catch'](function(_0x564054){logger[_0xd529('0xa')]('[utils][getVoiceQueueByName]',_0x564054?util[_0xd529('0x8')](_0x564054,{'showHidden':![],'depth':null}):'');return _0x4762ee(null);});}return _0x4762ee(null);});};exports[_0xd529('0x23')]=function(_0x2aa31f,_0x5d81be){return moment(_0x2aa31f)[_0xd529('0x24')](_0x5d81be,'seconds')['format'](_0xd529('0x25'));};exports[_0xd529('0x26')]=function(_0x489c59,_0x388856){return moment(_0x489c59)[_0xd529('0x27')](_0x388856,_0xd529('0x28'))['format'](_0xd529('0x25'));};exports[_0xd529('0x29')]=function(_0x41ce9f,_0x164e2b){return moment(_0x41ce9f)[_0xd529('0x2a')](moment(_0x164e2b),_0xd529('0x28'));};exports[_0xd529('0x2b')]=function(_0x1c4bdb,_0x16fb31){return parseInt(_0x1c4bdb,0xa)+parseInt(_0x16fb31,0xa);};exports[_0xd529('0x2c')]=function(){return moment()[_0xd529('0x2d')](_0xd529('0x25'));};exports[_0xd529('0x2e')]=function(_0x2fb714,_0x2848da){if(_0x2848da){return moment(_0x2fb714)['isAfter'](_0x2848da);}return!![];};exports[_0xd529('0x2f')]=function(_0x5c2f1d,_0x1e597e){if(_0x1e597e){return moment(_0x5c2f1d)['isBefore'](_0x1e597e);}else if(_0x5c2f1d){return!![];}return![];};
\ No newline at end of file
+var _0xc15b=['[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','isAfter','isBefore','bluebird','client','http','../../config/logger','xdr','info','inspect','error','request','then','debug','catch','GetUser','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface'];(function(_0x21b771,_0x4bbdaa){var _0x485e47=function(_0x4a1149){while(--_0x4a1149){_0x21b771['push'](_0x21b771['shift']());}};_0x485e47(++_0x4bbdaa);}(_0xc15b,0x159));var _0xbc15=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xc15b[_0x377a6e];return _0x37f751;};'use strict';var BPromise=require(_0xbc15('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson[_0xbc15('0x1')][_0xbc15('0x2')]({'port':0x2329});var logger=require(_0xbc15('0x3'))(_0xbc15('0x4'));exports[_0xbc15('0x5')]=function(_0x7d9dc7,_0x3c1cf4){logger[_0xbc15('0x5')](_0x7d9dc7,_0x3c1cf4?util[_0xbc15('0x6')](_0x3c1cf4,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x20f628,_0x5816d1){logger['debug'](_0x20f628,_0x5816d1?util[_0xbc15('0x6')](_0x5816d1,{'showHidden':![],'depth':null}):'');};exports[_0xbc15('0x7')]=function(_0x40db8b,_0x5a1f5d){logger[_0xbc15('0x7')](_0x40db8b,_0x5a1f5d?util[_0xbc15('0x6')](_0x5a1f5d,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5e2eff,_0x2e834c){return client[_0xbc15('0x8')](_0x5e2eff,{'body':_0x2e834c})[_0xbc15('0x9')](function(_0x4c48fc){logger[_0xbc15('0xa')]('[utils][request]\x20name:%s',_0x5e2eff,_0x4c48fc?util[_0xbc15('0x6')](_0x4c48fc,{'showHidden':![],'depth':null}):'');})[_0xbc15('0xb')](function(_0x59b19b){logger[_0xbc15('0x7')]('[utils][request]\x20name:%s',_0x5e2eff,_0x59b19b?util[_0xbc15('0x6')](_0x59b19b,{'showHidden':![],'depth':null}):'');});};function getUser(_0xefb2d6){return client['request'](_0xbc15('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name','interface'],'where':_0xefb2d6,'limit':0x1}})[_0xbc15('0x9')](function(_0x2975e3){logger[_0xbc15('0xa')](_0xbc15('0xd'),JSON[_0xbc15('0xe')](_0xefb2d6),_0x2975e3?util[_0xbc15('0x6')](_0x2975e3,{'showHidden':![],'depth':null}):'');return _0x2975e3[_0xbc15('0xf')][_0xbc15('0x10')]?_0x2975e3[_0xbc15('0xf')][0x0]:null;});}exports[_0xbc15('0x11')]=function(_0x1040b8){return new BPromise(function(_0x1b4d24,_0x277c37){if(_0x1040b8){return getUser({'internal':_0x1040b8})[_0xbc15('0x9')](function(_0x548681){logger['info'](_0xbc15('0x12'),_0x1040b8,_0x548681?_0xbc15('0x13'):_0xbc15('0x14'));return _0x1b4d24(_0x548681);})[_0xbc15('0xb')](function(_0x58cc43){logger[_0xbc15('0x7')](_0xbc15('0x15'),_0x58cc43?util[_0xbc15('0x6')](_0x58cc43,{'showHidden':![],'depth':null}):'');return _0x1b4d24(null);});}return _0x1b4d24(null);});};exports[_0xbc15('0x16')]=function(_0x2f9f4){return new BPromise(function(_0x24315e,_0x576d38){if(_0x2f9f4){return getUser({'interface':_0x2f9f4})[_0xbc15('0x9')](function(_0x5d8bda){logger[_0xbc15('0x5')](_0xbc15('0x17'),_0x2f9f4,_0x5d8bda?_0xbc15('0x13'):_0xbc15('0x14'));return _0x24315e(_0x5d8bda);})[_0xbc15('0xb')](function(_0x19d76f){logger['error'](_0xbc15('0x18'),_0x19d76f?util['inspect'](_0x19d76f,{'showHidden':![],'depth':null}):'');return _0x24315e(null);});}return _0x24315e(null);});};exports[_0xbc15('0x19')]=function(_0x4daeb5){return new BPromise(function(_0x24d64e,_0x4e738a){if(_0x4daeb5){return getUser({'name':_0x4daeb5})[_0xbc15('0x9')](function(_0x1d81d2){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x4daeb5,_0x1d81d2?_0xbc15('0x13'):_0xbc15('0x14'));return _0x24d64e(_0x1d81d2);})[_0xbc15('0xb')](function(_0x133954){logger[_0xbc15('0x7')](_0xbc15('0x1a'),_0x133954?util[_0xbc15('0x6')](_0x133954,{'showHidden':![],'depth':null}):'');return _0x24d64e(null);});}return _0x24d64e(null);});};exports[_0xbc15('0x1b')]=function(_0x39a532){return new BPromise(function(_0x5f4387,_0x4962da){if(_0x39a532){return client[_0xbc15('0x8')](_0xbc15('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xbc15('0x1d'),_0xbc15('0x1e'),_0xbc15('0x1f'),_0xbc15('0x20')],'where':{'name':_0x39a532},'limit':0x1}})['then'](function(_0x56f2a4){logger[_0xbc15('0xa')](_0xbc15('0x21'),_0x39a532,_0x56f2a4?util[_0xbc15('0x6')](_0x56f2a4,{'showHidden':![],'depth':null}):'');logger[_0xbc15('0x5')](_0xbc15('0x22'),_0x39a532,_0x56f2a4?_0xbc15('0x13'):_0xbc15('0x14'));return _0x5f4387(_0x56f2a4[_0xbc15('0xf')][_0xbc15('0x10')]?_0x56f2a4[_0xbc15('0xf')][0x0]:null);})[_0xbc15('0xb')](function(_0xc5fd0a){logger[_0xbc15('0x7')]('[utils][getVoiceQueueByName]',_0xc5fd0a?util[_0xbc15('0x6')](_0xc5fd0a,{'showHidden':![],'depth':null}):'');return _0x5f4387(null);});}return _0x5f4387(null);});};exports[_0xbc15('0x23')]=function(_0x36e7c0,_0x134ba2){return moment(_0x36e7c0)[_0xbc15('0x24')](_0x134ba2,_0xbc15('0x25'))[_0xbc15('0x26')](_0xbc15('0x27'));};exports[_0xbc15('0x28')]=function(_0x1f3ade,_0x792bf2){return moment(_0x1f3ade)[_0xbc15('0x29')](_0x792bf2,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xbc15('0x2a')]=function(_0x1bb668,_0x3c8c4f){return moment(_0x1bb668)['diff'](moment(_0x3c8c4f),_0xbc15('0x25'));};exports[_0xbc15('0x2b')]=function(_0x123463,_0x492b2c){return parseInt(_0x123463,0xa)+parseInt(_0x492b2c,0xa);};exports['now']=function(){return moment()['format'](_0xbc15('0x27'));};exports[_0xbc15('0x2c')]=function(_0x4d4390,_0x119dd2){if(_0x119dd2){return moment(_0x4d4390)['isAfter'](_0x119dd2);}return!![];};exports['isBefore']=function(_0xf6b693,_0x5bf875){if(_0x5bf875){return moment(_0xf6b693)[_0xbc15('0x2d')](_0x5bf875);}else if(_0xf6b693){return!![];}return![];};
\ No newline at end of file