Built motion from commit 97153652.|2.6.26
[motion2.git] / server / services / agi / project.js
index 2caf09b..7d38edf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f5b=['finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','production','start','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','clear','vertex','agicommand','gotoc','info','context','extension','priority','response','result','evtHangup','isUndefined','toString'];(function(_0x5011da,_0x698ce0){var _0xd0cd45=function(_0x523d55){while(--_0x523d55){_0x5011da['push'](_0x5011da['shift']());}};_0xd0cd45(++_0x698ce0);}(_0x1f5b,0xc1));var _0xb1f5=function(_0x446a5f,_0x490261){_0x446a5f=_0x446a5f-0x0;var _0x3922f7=_0x1f5b[_0x446a5f];return _0x3922f7;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require('xml2json');var util=require('util');var logger=require(_0xb1f5('0x0'))(_0xb1f5('0x1'));var rpc=require(_0xb1f5('0x2'));var mailRpc=require(_0xb1f5('0x3'));var Graph=require(_0xb1f5('0x4'));var Vertices=require(_0xb1f5('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb1f5('0x6')]()[_0xb1f5('0x7')](function(_0x33493f){logger[_0xb1f5('0x8')](_0xb1f5('0x9'),_0x33493f[_0xb1f5('0xa')]);return[];});}function addVertex(_0x7e98bc,_0x296c91,_0x4190fd){_0x296c91['agicommand']=_0x4190fd;if(_0x296c91[_0xb1f5('0xb')](_0xb1f5('0xc'))){_0x296c91[_0xb1f5('0xd')]=parseInt(_0x296c91[_0xb1f5('0xc')],0xa);}_0x7e98bc[_0xb1f5('0xe')](_[_0xb1f5('0xf')](_0x296c91,_0xb1f5('0x10')));}function initGraph(_0x4e5166,_0x373a33){var _0xc12fc9=new Graph();for(var _0x68f334 in _0x4e5166){if(_0x4e5166['hasOwnProperty'](_0x68f334)){if(_[_0xb1f5('0x11')](_0x4e5166[_0x68f334])){for(var _0x29bd58=0x0;_0x29bd58<_0x4e5166[_0x68f334]['length'];_0x29bd58+=0x1){addVertex(_0xc12fc9,_0x4e5166[_0x68f334][_0x29bd58],_0x68f334);}}else{addVertex(_0xc12fc9,_0x4e5166[_0x68f334],_0x68f334);}}}for(var _0x13908c=0x0;_0x13908c<_0x373a33[_0xb1f5('0x12')];_0x13908c+=0x1){if(_0x373a33[_0x13908c][_0xb1f5('0x13')]&&_0x373a33[_0x13908c][_0xb1f5('0x14')]){_0xc12fc9[_0xb1f5('0x15')](_0x373a33[_0x13908c][_0xb1f5('0x13')],_0x373a33[_0x13908c][_0xb1f5('0x14')],_0x373a33[_0x13908c][_0xb1f5('0x16')]);}}return _0xc12fc9;}function getRoot(_0x34c6f2){return parser[_0xb1f5('0x17')](_0x34c6f2,{'object':!![]})[_0xb1f5('0x18')]['root'];}function inspect(_0x432563){return util[_0xb1f5('0x19')](_0x432563,{'showHidden':![],'depth':null});}function initialize(_0x5c677c,_0x5cff05){var _0x3afb1a=getRoot(_0x5c677c[_0xb1f5('0x1a')]);if(!_0x3afb1a||!_0x3afb1a[_0xb1f5('0x1b')])return;var _0x4ea179,_0xd99879,_0x43e3eb;logger[_0xb1f5('0x1c')](_0xb1f5('0x1d'),JSON[_0xb1f5('0x1e')](_0x3afb1a,null,0x2));_0x5cff05[_0xb1f5('0x1f')]=moment()[_0xb1f5('0x20')](_0xb1f5('0x21'));_0x4ea179=initGraph(_[_0xb1f5('0xf')](_0x3afb1a,'mxCell'),_0x3afb1a[_0xb1f5('0x10')]);_0xd99879=new Vertices(_0x5cff05,rpc,mailRpc);logger['info'](util[_0xb1f5('0x20')](_0xb1f5('0x22'),_0x5cff05[_0xb1f5('0x23')],_0x5cff05['calleridname'],_0x5cff05[_0xb1f5('0x24')],_0x5cff05[_0xb1f5('0x25')],_0x5cff05['uniqueid']));_0x4ea179['traverseBFS'](_0x3afb1a['start']['id'],function(_0x1f12f6){try{_0x1f12f6=_0xd99879[_0xb1f5('0x26')](_0x1f12f6);logger[_0xb1f5('0x1c')](_0xb1f5('0x27'),JSON[_0xb1f5('0x1e')](_0x1f12f6,null,0x2));if(_0x1f12f6[_0xb1f5('0x28')]===_0xb1f5('0x29')){logger[_0xb1f5('0x2a')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5cff05['context']=_0x1f12f6[_0xb1f5('0x2b')]||_0x5cff05[_0xb1f5('0x2b')];_0x5cff05[_0xb1f5('0x2c')]=_0x1f12f6[_0xb1f5('0x2c')];_0x5cff05[_0xb1f5('0x2d')]=_0x1f12f6[_0xb1f5('0x2d')]?_0x1f12f6[_0xb1f5('0x2d')]-0x1:0x1;return null;}else if(_0x1f12f6&&_0xd99879[_0x1f12f6[_0xb1f5('0x28')]]){_0x43e3eb=_0xd99879[_0x1f12f6[_0xb1f5('0x28')]](_0x1f12f6);logger['info'](_0xb1f5('0x2e'),JSON[_0xb1f5('0x1e')](_0x43e3eb,null,0x2));if(_0x43e3eb&&_0x43e3eb['code']===AGI_CODE_SUCCESS&&_0x43e3eb[_0xb1f5('0x2f')]!==AGI_RESULT_ERROR&&!_0x5cff05[_0xb1f5('0x30')]){logger[_0xb1f5('0x1c')](_0xb1f5('0x2e'),inspect(_0x43e3eb));return _[_0xb1f5('0x31')](_0x43e3eb[_0xb1f5('0x2f')])?null:_0x43e3eb[_0xb1f5('0x2f')][_0xb1f5('0x32')]();}else{logger[_0xb1f5('0x8')](_0xb1f5('0x2e'),inspect(_0x43e3eb));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x274789){logger['error'](_0x274789[_0xb1f5('0xa')]);return null;}});if(_0x3afb1a[_0xb1f5('0x33')]){logger[_0xb1f5('0x2a')](util[_0xb1f5('0x20')](_0xb1f5('0x34'),_0x5cff05[_0xb1f5('0x23')],_0x5cff05['calleridname'],_0x5cff05[_0xb1f5('0x24')],_0x5cff05[_0xb1f5('0x25')],_0x5cff05[_0xb1f5('0x35')]));_0x4ea179['traverseBFS'](_0x3afb1a[_0xb1f5('0x33')]['id'],function(_0x260553){try{_0x260553=_0xd99879[_0xb1f5('0x26')](_0x260553);logger['debug']('vertex',JSON[_0xb1f5('0x1e')](_0x260553,null,0x2));if(_0x260553&&_0xd99879[_0x260553[_0xb1f5('0x28')]]){_0x43e3eb=_0xd99879[_0x260553[_0xb1f5('0x28')]](_0x260553);if(_0x43e3eb){logger[_0xb1f5('0x1c')](_0xb1f5('0x2e'),inspect(_0x43e3eb));return _[_0xb1f5('0x31')](_0x43e3eb[_0xb1f5('0x2f')])?null:_0x43e3eb[_0xb1f5('0x2f')][_0xb1f5('0x32')]();}else{logger[_0xb1f5('0x8')]('response',inspect(_0x43e3eb));return null;}}else{logger[_0xb1f5('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x33043e){logger[_0xb1f5('0x8')](_0x33043e[_0xb1f5('0xa')]);return null;}});}logger[_0xb1f5('0x2a')](util[_0xb1f5('0x20')](_0xb1f5('0x36'),_0x5cff05[_0xb1f5('0x23')],_0x5cff05[_0xb1f5('0x37')],_0x5cff05[_0xb1f5('0x24')],_0x5cff05[_0xb1f5('0x25')],_0x5cff05[_0xb1f5('0x35')]));logger[_0xb1f5('0x2a')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5cff05['context'],_0x5cff05[_0xb1f5('0x2c')],parseInt(_0x5cff05[_0xb1f5('0x2d')],0xa)+0x1));_0x5cff05[_0xb1f5('0x38')](_0x5cff05[_0xb1f5('0x2b')],_0x5cff05['extension'],parseInt(_0x5cff05[_0xb1f5('0x2d')],0xa)+0x1);_0x5cff05[_0xb1f5('0x39')]();}function handleNotFound(_0xe2103f){logger[_0xb1f5('0x8')](util[_0xb1f5('0x20')](_0xb1f5('0x3a'),_0xe2103f[_0xb1f5('0x23')]));_0xe2103f[_0xb1f5('0x38')](_0xe2103f[_0xb1f5('0x2b')],_0xe2103f[_0xb1f5('0x2c')],parseInt(_0xe2103f[_0xb1f5('0x2d')],0xa)+0x1);_0xe2103f[_0xb1f5('0x39')]();}function handleUnpublished(_0xfb95f3){logger['error'](util['format'](_0xb1f5('0x3b'),_0xfb95f3[_0xb1f5('0x23')]));_0xfb95f3[_0xb1f5('0x38')](_0xfb95f3[_0xb1f5('0x2b')],_0xfb95f3[_0xb1f5('0x2c')],parseInt(_0xfb95f3['priority'],0xa)+0x1);_0xfb95f3['close']();}module[_0xb1f5('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
+var _0x92c7=['close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','catch','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','addEdge','value','root','inspect','production','debug','joinAt','mxCell','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','start','clear','stringify','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','toString','agicommand\x20not\x20found','error','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','traverseBFS','vertex','result','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt'];(function(_0x1a9273,_0x4c1c68){var _0x140de3=function(_0x5cd45b){while(--_0x5cd45b){_0x1a9273['push'](_0x1a9273['shift']());}};_0x140de3(++_0x4c1c68);}(_0x92c7,0x1eb));var _0x792c=function(_0x2a303a,_0x10867f){_0x2a303a=_0x2a303a-0x0;var _0x147a51=_0x92c7[_0x2a303a];return _0x147a51;};'use strict';var _=require(_0x792c('0x0'));var moment=require(_0x792c('0x1'));var parser=require(_0x792c('0x2'));var util=require('util');var logger=require(_0x792c('0x3'))(_0x792c('0x4'));var rpc=require(_0x792c('0x5'));var mailRpc=require(_0x792c('0x6'));var Graph=require(_0x792c('0x7'));var Vertices=require(_0x792c('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x792c('0x9')](function(_0x42511a){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x42511a[_0x792c('0xa')]);return[];});}function addVertex(_0x449748,_0x4647e1,_0x52d8bf){_0x4647e1[_0x792c('0xb')]=_0x52d8bf;if(_0x4647e1[_0x792c('0xc')](_0x792c('0xd'))){_0x4647e1[_0x792c('0xe')]=parseInt(_0x4647e1[_0x792c('0xd')],0xa);}_0x449748[_0x792c('0xf')](_[_0x792c('0x10')](_0x4647e1,'mxCell'));}function initGraph(_0x2f3134,_0x5b8a26){var _0x12af1d=new Graph();for(var _0x5b6e00 in _0x2f3134){if(_0x2f3134[_0x792c('0xc')](_0x5b6e00)){if(_[_0x792c('0x11')](_0x2f3134[_0x5b6e00])){for(var _0x3f0f02=0x0;_0x3f0f02<_0x2f3134[_0x5b6e00][_0x792c('0x12')];_0x3f0f02+=0x1){addVertex(_0x12af1d,_0x2f3134[_0x5b6e00][_0x3f0f02],_0x5b6e00);}}else{addVertex(_0x12af1d,_0x2f3134[_0x5b6e00],_0x5b6e00);}}}for(var _0x4d1efe=0x0;_0x4d1efe<_0x5b8a26['length'];_0x4d1efe+=0x1){if(_0x5b8a26[_0x4d1efe][_0x792c('0x13')]&&_0x5b8a26[_0x4d1efe][_0x792c('0x14')]){_0x12af1d[_0x792c('0x15')](_0x5b8a26[_0x4d1efe][_0x792c('0x13')],_0x5b8a26[_0x4d1efe][_0x792c('0x14')],_0x5b8a26[_0x4d1efe][_0x792c('0x16')]);}}return _0x12af1d;}function getRoot(_0x507efa){return parser['toJson'](_0x507efa,{'object':!![]})['mxGraphModel'][_0x792c('0x17')];}function inspect(_0x4d0fb6){return util[_0x792c('0x18')](_0x4d0fb6,{'showHidden':![],'depth':null});}function initialize(_0x2b4902,_0x18cfad){var _0x51fb40=getRoot(_0x2b4902[_0x792c('0x19')]);if(!_0x51fb40||!_0x51fb40['start'])return;var _0x2292c1,_0x2e694c,_0x1486ec;logger[_0x792c('0x1a')]('root',JSON['stringify'](_0x51fb40,null,0x2));_0x18cfad[_0x792c('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2292c1=initGraph(_[_0x792c('0x10')](_0x51fb40,_0x792c('0x1c')),_0x51fb40[_0x792c('0x1c')]);_0x2e694c=new Vertices(_0x18cfad,rpc,mailRpc);logger['info'](util[_0x792c('0x1d')](_0x792c('0x1e'),_0x18cfad['arg_1'],_0x18cfad[_0x792c('0x1f')],_0x18cfad[_0x792c('0x20')],_0x18cfad[_0x792c('0x21')],_0x18cfad[_0x792c('0x22')]));_0x2292c1['traverseBFS'](_0x51fb40[_0x792c('0x23')]['id'],function(_0x49d457){try{_0x49d457=_0x2e694c[_0x792c('0x24')](_0x49d457);logger[_0x792c('0x1a')]('vertex',JSON[_0x792c('0x25')](_0x49d457,null,0x2));if(_0x49d457[_0x792c('0xb')]===_0x792c('0x26')){logger[_0x792c('0x27')](_0x792c('0x28'));_0x18cfad[_0x792c('0x29')]=_0x49d457[_0x792c('0x29')]||_0x18cfad[_0x792c('0x29')];_0x18cfad[_0x792c('0x2a')]=_0x49d457['extension'];_0x18cfad['priority']=_0x49d457[_0x792c('0x2b')]?_0x49d457['priority']-0x1:0x1;return null;}else if(_0x49d457&&_0x2e694c[_0x49d457[_0x792c('0xb')]]){_0x1486ec=_0x2e694c[_0x49d457[_0x792c('0xb')]](_0x49d457);logger[_0x792c('0x27')](_0x792c('0x2c'),JSON['stringify'](_0x1486ec,null,0x2));if(_0x1486ec&&_0x1486ec[_0x792c('0x2d')]===AGI_CODE_SUCCESS&&_0x1486ec['result']!==AGI_RESULT_ERROR&&!_0x18cfad[_0x792c('0x2e')]){logger[_0x792c('0x1a')](_0x792c('0x2c'),inspect(_0x1486ec));return _['isUndefined'](_0x1486ec['result'])?null:_0x1486ec['result'][_0x792c('0x2f')]();}else{logger['error'](_0x792c('0x2c'),inspect(_0x1486ec));return null;}}else{logger['error'](_0x792c('0x30'));return null;}}catch(_0x2406dd){logger[_0x792c('0x31')](_0x2406dd['stack']);return null;}});if(_0x51fb40[_0x792c('0x32')]){logger[_0x792c('0x27')](util[_0x792c('0x1d')](_0x792c('0x33'),_0x18cfad[_0x792c('0x34')],_0x18cfad[_0x792c('0x1f')],_0x18cfad[_0x792c('0x20')],_0x18cfad['dnid'],_0x18cfad[_0x792c('0x22')]));_0x2292c1[_0x792c('0x35')](_0x51fb40[_0x792c('0x32')]['id'],function(_0x2730e3){try{_0x2730e3=_0x2e694c[_0x792c('0x24')](_0x2730e3);logger[_0x792c('0x1a')](_0x792c('0x36'),JSON[_0x792c('0x25')](_0x2730e3,null,0x2));if(_0x2730e3&&_0x2e694c[_0x2730e3[_0x792c('0xb')]]){_0x1486ec=_0x2e694c[_0x2730e3['agicommand']](_0x2730e3);if(_0x1486ec){logger[_0x792c('0x1a')](_0x792c('0x2c'),inspect(_0x1486ec));return _['isUndefined'](_0x1486ec['result'])?null:_0x1486ec[_0x792c('0x37')]['toString']();}else{logger[_0x792c('0x31')](_0x792c('0x2c'),inspect(_0x1486ec));return null;}}else{logger[_0x792c('0x31')](_0x792c('0x30'));return null;}}catch(_0x2fd7e1){logger[_0x792c('0x31')](_0x2fd7e1['stack']);return null;}});}logger[_0x792c('0x27')](util[_0x792c('0x1d')](_0x792c('0x38'),_0x18cfad[_0x792c('0x34')],_0x18cfad[_0x792c('0x1f')],_0x18cfad['callerid'],_0x18cfad[_0x792c('0x21')],_0x18cfad[_0x792c('0x22')]));logger['info'](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x18cfad[_0x792c('0x29')],_0x18cfad[_0x792c('0x2a')],parseInt(_0x18cfad[_0x792c('0x2b')],0xa)+0x1));_0x18cfad[_0x792c('0x39')](_0x18cfad['context'],_0x18cfad[_0x792c('0x2a')],parseInt(_0x18cfad[_0x792c('0x2b')],0xa)+0x1);_0x18cfad[_0x792c('0x3a')]();}function handleNotFound(_0x27fa89){logger[_0x792c('0x31')](util[_0x792c('0x1d')](_0x792c('0x3b'),_0x27fa89[_0x792c('0x34')]));_0x27fa89[_0x792c('0x39')](_0x27fa89[_0x792c('0x29')],_0x27fa89['extension'],parseInt(_0x27fa89[_0x792c('0x2b')],0xa)+0x1);_0x27fa89[_0x792c('0x3a')]();}function handleUnpublished(_0x17d436){logger[_0x792c('0x31')](util['format']('Project\x20%s\x20not\x20published',_0x17d436['arg_1']));_0x17d436['continueAt'](_0x17d436[_0x792c('0x29')],_0x17d436['extension'],parseInt(_0x17d436[_0x792c('0x2b')],0xa)+0x1);_0x17d436[_0x792c('0x3a')]();}module[_0x792c('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file