Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / services / agi / project.js
index 17f8fb5..44bbeb1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc007=['[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','lodash','moment','../../config/logger','agi','./mailRpc','./graph','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','root','production','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','traverseBFS','start','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','evtHangup','isUndefined','toString','response','agicommand\x20not\x20found','finally','format','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','clear','vertex','result'];(function(_0x64c61a,_0x39926){var _0x53701f=function(_0x2f5981){while(--_0x2f5981){_0x64c61a['push'](_0x64c61a['shift']());}};_0x53701f(++_0x39926);}(_0xc007,0x12b));var _0x7c00=function(_0x1265e2,_0x567f3f){_0x1265e2=_0x1265e2-0x0;var _0x19d325=_0xc007[_0x1265e2];return _0x19d325;};'use strict';var _=require(_0x7c00('0x0'));var moment=require(_0x7c00('0x1'));var parser=require('xml2json');var util=require('util');var logger=require(_0x7c00('0x2'))(_0x7c00('0x3'));var rpc=require('./rpc');var mailRpc=require(_0x7c00('0x4'));var Graph=require(_0x7c00('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x7c00('0x6')]()[_0x7c00('0x7')](function(_0x4d280){logger[_0x7c00('0x8')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x4d280[_0x7c00('0x9')]);return[];});}function addVertex(_0x19ecc6,_0x61ed4e,_0x517573){_0x61ed4e[_0x7c00('0xa')]=_0x517573;if(_0x61ed4e[_0x7c00('0xb')]('retry')){_0x61ed4e[_0x7c00('0xc')]=parseInt(_0x61ed4e[_0x7c00('0xd')],0xa);}_0x19ecc6[_0x7c00('0xe')](_[_0x7c00('0xf')](_0x61ed4e,_0x7c00('0x10')));}function initGraph(_0x2abd88,_0x4a4962){var _0x186a06=new Graph();for(var _0x580fc4 in _0x2abd88){if(_0x2abd88[_0x7c00('0xb')](_0x580fc4)){if(_[_0x7c00('0x11')](_0x2abd88[_0x580fc4])){for(var _0x1bac9b=0x0;_0x1bac9b<_0x2abd88[_0x580fc4][_0x7c00('0x12')];_0x1bac9b+=0x1){addVertex(_0x186a06,_0x2abd88[_0x580fc4][_0x1bac9b],_0x580fc4);}}else{addVertex(_0x186a06,_0x2abd88[_0x580fc4],_0x580fc4);}}}for(var _0x3ae957=0x0;_0x3ae957<_0x4a4962[_0x7c00('0x12')];_0x3ae957+=0x1){if(_0x4a4962[_0x3ae957][_0x7c00('0x13')]&&_0x4a4962[_0x3ae957][_0x7c00('0x14')]){_0x186a06[_0x7c00('0x15')](_0x4a4962[_0x3ae957][_0x7c00('0x13')],_0x4a4962[_0x3ae957][_0x7c00('0x14')],_0x4a4962[_0x3ae957][_0x7c00('0x16')]);}}return _0x186a06;}function getRoot(_0x1bcc91){return parser[_0x7c00('0x17')](_0x1bcc91,{'object':!![]})['mxGraphModel'][_0x7c00('0x18')];}function inspect(_0x11ffc2){return util['inspect'](_0x11ffc2,{'showHidden':![],'depth':null});}function initialize(_0x8a9a53,_0x27cde8){var _0x2e9db5=getRoot(_0x8a9a53[_0x7c00('0x19')]);if(!_0x2e9db5||!_0x2e9db5['start'])return;var _0x5efd06,_0x4ae4e2,_0x36d738;logger[_0x7c00('0x1a')]('root',JSON[_0x7c00('0x1b')](_0x2e9db5,null,0x2));_0x27cde8[_0x7c00('0x1c')]=moment()['format'](_0x7c00('0x1d'));_0x5efd06=initGraph(_['omit'](_0x2e9db5,_0x7c00('0x10')),_0x2e9db5['mxCell']);_0x4ae4e2=new Vertices(_0x27cde8,rpc,mailRpc);logger[_0x7c00('0x1e')](util['format'](_0x7c00('0x1f'),_0x27cde8['arg_1'],_0x27cde8['calleridname'],_0x27cde8[_0x7c00('0x20')],_0x27cde8[_0x7c00('0x21')],_0x27cde8[_0x7c00('0x22')]));_0x5efd06[_0x7c00('0x23')](_0x2e9db5[_0x7c00('0x24')]['id'],function(_0x3e125a){try{_0x3e125a=_0x4ae4e2['clear'](_0x3e125a);logger[_0x7c00('0x1a')]('vertex',JSON[_0x7c00('0x1b')](_0x3e125a,null,0x2));if(_0x3e125a[_0x7c00('0xa')]==='gotoc'){logger[_0x7c00('0x1e')](_0x7c00('0x25'));_0x27cde8[_0x7c00('0x26')]=_0x3e125a[_0x7c00('0x26')]||_0x27cde8[_0x7c00('0x26')];_0x27cde8[_0x7c00('0x27')]=_0x3e125a[_0x7c00('0x27')];_0x27cde8[_0x7c00('0x28')]=_0x3e125a[_0x7c00('0x28')]?_0x3e125a['priority']-0x1:0x1;return null;}else if(_0x3e125a&&_0x4ae4e2[_0x3e125a[_0x7c00('0xa')]]){_0x36d738=_0x4ae4e2[_0x3e125a[_0x7c00('0xa')]](_0x3e125a);logger['info']('response',JSON[_0x7c00('0x1b')](_0x36d738,null,0x2));if(_0x36d738&&_0x36d738[_0x7c00('0x29')]===AGI_CODE_SUCCESS&&_0x36d738['result']!==AGI_RESULT_ERROR&&!_0x27cde8[_0x7c00('0x2a')]){logger[_0x7c00('0x1a')]('response',inspect(_0x36d738));return _[_0x7c00('0x2b')](_0x36d738['result'])?null:_0x36d738['result'][_0x7c00('0x2c')]();}else{logger[_0x7c00('0x8')](_0x7c00('0x2d'),inspect(_0x36d738));return null;}}else{logger[_0x7c00('0x8')](_0x7c00('0x2e'));return null;}}catch(_0x2b42d1){logger[_0x7c00('0x8')](_0x2b42d1['stack']);return null;}});if(_0x2e9db5[_0x7c00('0x2f')]){logger[_0x7c00('0x1e')](util[_0x7c00('0x30')](_0x7c00('0x31'),_0x27cde8[_0x7c00('0x32')],_0x27cde8[_0x7c00('0x33')],_0x27cde8[_0x7c00('0x20')],_0x27cde8[_0x7c00('0x21')],_0x27cde8[_0x7c00('0x22')]));_0x5efd06[_0x7c00('0x23')](_0x2e9db5['finally']['id'],function(_0x553b19){try{_0x553b19=_0x4ae4e2[_0x7c00('0x34')](_0x553b19);logger[_0x7c00('0x1a')](_0x7c00('0x35'),JSON[_0x7c00('0x1b')](_0x553b19,null,0x2));if(_0x553b19&&_0x4ae4e2[_0x553b19[_0x7c00('0xa')]]){_0x36d738=_0x4ae4e2[_0x553b19[_0x7c00('0xa')]](_0x553b19);if(_0x36d738){logger[_0x7c00('0x1a')](_0x7c00('0x2d'),inspect(_0x36d738));return _[_0x7c00('0x2b')](_0x36d738[_0x7c00('0x36')])?null:_0x36d738[_0x7c00('0x36')][_0x7c00('0x2c')]();}else{logger[_0x7c00('0x8')](_0x7c00('0x2d'),inspect(_0x36d738));return null;}}else{logger[_0x7c00('0x8')](_0x7c00('0x2e'));return null;}}catch(_0x51a174){logger[_0x7c00('0x8')](_0x51a174[_0x7c00('0x9')]);return null;}});}logger[_0x7c00('0x1e')](util[_0x7c00('0x30')](_0x7c00('0x37'),_0x27cde8['arg_1'],_0x27cde8['calleridname'],_0x27cde8[_0x7c00('0x20')],_0x27cde8[_0x7c00('0x21')],_0x27cde8[_0x7c00('0x22')]));logger[_0x7c00('0x1e')](util['format'](_0x7c00('0x38'),_0x27cde8[_0x7c00('0x26')],_0x27cde8[_0x7c00('0x27')],parseInt(_0x27cde8[_0x7c00('0x28')],0xa)+0x1));_0x27cde8[_0x7c00('0x39')](_0x27cde8[_0x7c00('0x26')],_0x27cde8[_0x7c00('0x27')],parseInt(_0x27cde8[_0x7c00('0x28')],0xa)+0x1);_0x27cde8[_0x7c00('0x3a')]();}function handleNotFound(_0x15dd1a){logger[_0x7c00('0x8')](util['format']('Project\x20%s\x20not\x20found',_0x15dd1a[_0x7c00('0x32')]));_0x15dd1a[_0x7c00('0x39')](_0x15dd1a[_0x7c00('0x26')],_0x15dd1a[_0x7c00('0x27')],parseInt(_0x15dd1a[_0x7c00('0x28')],0xa)+0x1);_0x15dd1a[_0x7c00('0x3a')]();}function handleUnpublished(_0x3063f5){logger[_0x7c00('0x8')](util[_0x7c00('0x30')]('Project\x20%s\x20not\x20published',_0x3063f5['arg_1']));_0x3063f5[_0x7c00('0x39')](_0x3063f5[_0x7c00('0x26')],_0x3063f5[_0x7c00('0x27')],parseInt(_0x3063f5[_0x7c00('0x28')],0xa)+0x1);_0x3063f5['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
+var _0xa76a=['error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','traverseBFS','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','value','mxGraphModel','start','debug','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','toString'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xa76a,0x88));var _0xaa76=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xa76a[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require(_0xaa76('0x0'));var moment=require(_0xaa76('0x1'));var parser=require(_0xaa76('0x2'));var util=require('util');var logger=require(_0xaa76('0x3'))(_0xaa76('0x4'));var rpc=require(_0xaa76('0x5'));var mailRpc=require(_0xaa76('0x6'));var Graph=require(_0xaa76('0x7'));var Vertices=require(_0xaa76('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xaa76('0x9')]()['catch'](function(_0x415ea1){logger['error'](_0xaa76('0xa'),_0x415ea1[_0xaa76('0xb')]);return[];});}function addVertex(_0x1d559e,_0x28e679,_0x128fb9){_0x28e679[_0xaa76('0xc')]=_0x128fb9;if(_0x28e679['hasOwnProperty'](_0xaa76('0xd'))){_0x28e679[_0xaa76('0xe')]=parseInt(_0x28e679['retry'],0xa);}_0x1d559e[_0xaa76('0xf')](_[_0xaa76('0x10')](_0x28e679,_0xaa76('0x11')));}function initGraph(_0x267c87,_0x3e4d5f){var _0x54d78b=new Graph();for(var _0x8745b9 in _0x267c87){if(_0x267c87['hasOwnProperty'](_0x8745b9)){if(_['isArray'](_0x267c87[_0x8745b9])){for(var _0x2ccfe2=0x0;_0x2ccfe2<_0x267c87[_0x8745b9][_0xaa76('0x12')];_0x2ccfe2+=0x1){addVertex(_0x54d78b,_0x267c87[_0x8745b9][_0x2ccfe2],_0x8745b9);}}else{addVertex(_0x54d78b,_0x267c87[_0x8745b9],_0x8745b9);}}}for(var _0x22dbf9=0x0;_0x22dbf9<_0x3e4d5f[_0xaa76('0x12')];_0x22dbf9+=0x1){if(_0x3e4d5f[_0x22dbf9][_0xaa76('0x13')]&&_0x3e4d5f[_0x22dbf9][_0xaa76('0x14')]){_0x54d78b[_0xaa76('0x15')](_0x3e4d5f[_0x22dbf9][_0xaa76('0x13')],_0x3e4d5f[_0x22dbf9][_0xaa76('0x14')],_0x3e4d5f[_0x22dbf9][_0xaa76('0x16')]);}}return _0x54d78b;}function getRoot(_0x13be12){return parser['toJson'](_0x13be12,{'object':!![]})[_0xaa76('0x17')]['root'];}function inspect(_0x469319){return util['inspect'](_0x469319,{'showHidden':![],'depth':null});}function initialize(_0x554da8,_0x538736){var _0x533102=getRoot(_0x554da8['production']);if(!_0x533102||!_0x533102[_0xaa76('0x18')])return;var _0xac6a3,_0x53fc2a,_0x4410c4;logger[_0xaa76('0x19')]('root',JSON[_0xaa76('0x1a')](_0x533102,null,0x2));_0x538736[_0xaa76('0x1b')]=moment()[_0xaa76('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0xac6a3=initGraph(_[_0xaa76('0x10')](_0x533102,'mxCell'),_0x533102[_0xaa76('0x11')]);_0x53fc2a=new Vertices(_0x538736,rpc,mailRpc);logger[_0xaa76('0x1d')](util[_0xaa76('0x1c')](_0xaa76('0x1e'),_0x538736[_0xaa76('0x1f')],_0x538736['calleridname'],_0x538736[_0xaa76('0x20')],_0x538736[_0xaa76('0x21')],_0x538736[_0xaa76('0x22')]));_0xac6a3['traverseBFS'](_0x533102[_0xaa76('0x18')]['id'],function(_0x4848f6){try{_0x4848f6=_0x53fc2a[_0xaa76('0x23')](_0x4848f6);logger[_0xaa76('0x19')](_0xaa76('0x24'),JSON[_0xaa76('0x1a')](_0x4848f6,null,0x2));if(_0x4848f6[_0xaa76('0xc')]===_0xaa76('0x25')){logger[_0xaa76('0x1d')](_0xaa76('0x26'));_0x538736[_0xaa76('0x27')]=_0x4848f6[_0xaa76('0x27')]||_0x538736['context'];_0x538736[_0xaa76('0x28')]=_0x4848f6['extension'];_0x538736['priority']=_0x4848f6[_0xaa76('0x29')]?_0x4848f6[_0xaa76('0x29')]-0x1:0x1;return null;}else if(_0x4848f6&&_0x53fc2a[_0x4848f6[_0xaa76('0xc')]]){_0x4410c4=_0x53fc2a[_0x4848f6[_0xaa76('0xc')]](_0x4848f6);logger[_0xaa76('0x1d')]('response',JSON[_0xaa76('0x1a')](_0x4410c4,null,0x2));if(_0x4410c4&&_0x4410c4[_0xaa76('0x2a')]===AGI_CODE_SUCCESS&&_0x4410c4[_0xaa76('0x2b')]!==AGI_RESULT_ERROR&&!_0x538736[_0xaa76('0x2c')]){logger[_0xaa76('0x19')](_0xaa76('0x2d'),inspect(_0x4410c4));return _['isUndefined'](_0x4410c4[_0xaa76('0x2b')])?null:_0x4410c4[_0xaa76('0x2b')][_0xaa76('0x2e')]();}else{logger[_0xaa76('0x2f')]('response',inspect(_0x4410c4));return null;}}else{logger[_0xaa76('0x2f')](_0xaa76('0x30'));return null;}}catch(_0x2e618e){logger[_0xaa76('0x2f')](_0x2e618e[_0xaa76('0xb')]);return null;}});if(_0x533102[_0xaa76('0x31')]){logger[_0xaa76('0x1d')](util[_0xaa76('0x1c')](_0xaa76('0x32'),_0x538736[_0xaa76('0x1f')],_0x538736[_0xaa76('0x33')],_0x538736[_0xaa76('0x20')],_0x538736[_0xaa76('0x21')],_0x538736[_0xaa76('0x22')]));_0xac6a3[_0xaa76('0x34')](_0x533102[_0xaa76('0x31')]['id'],function(_0xb5ddcc){try{_0xb5ddcc=_0x53fc2a[_0xaa76('0x23')](_0xb5ddcc);logger[_0xaa76('0x19')](_0xaa76('0x24'),JSON[_0xaa76('0x1a')](_0xb5ddcc,null,0x2));if(_0xb5ddcc&&_0x53fc2a[_0xb5ddcc['agicommand']]){_0x4410c4=_0x53fc2a[_0xb5ddcc[_0xaa76('0xc')]](_0xb5ddcc);if(_0x4410c4){logger[_0xaa76('0x19')]('response',inspect(_0x4410c4));return _[_0xaa76('0x35')](_0x4410c4[_0xaa76('0x2b')])?null:_0x4410c4[_0xaa76('0x2b')][_0xaa76('0x2e')]();}else{logger[_0xaa76('0x2f')](_0xaa76('0x2d'),inspect(_0x4410c4));return null;}}else{logger[_0xaa76('0x2f')](_0xaa76('0x30'));return null;}}catch(_0x445912){logger[_0xaa76('0x2f')](_0x445912['stack']);return null;}});}logger[_0xaa76('0x1d')](util['format'](_0xaa76('0x36'),_0x538736[_0xaa76('0x1f')],_0x538736[_0xaa76('0x33')],_0x538736[_0xaa76('0x20')],_0x538736['dnid'],_0x538736[_0xaa76('0x22')]));logger[_0xaa76('0x1d')](util[_0xaa76('0x1c')](_0xaa76('0x37'),_0x538736[_0xaa76('0x27')],_0x538736[_0xaa76('0x28')],parseInt(_0x538736[_0xaa76('0x29')],0xa)+0x1));_0x538736[_0xaa76('0x38')](_0x538736[_0xaa76('0x27')],_0x538736[_0xaa76('0x28')],parseInt(_0x538736[_0xaa76('0x29')],0xa)+0x1);_0x538736['close']();}function handleNotFound(_0x583535){logger[_0xaa76('0x2f')](util[_0xaa76('0x1c')](_0xaa76('0x39'),_0x583535[_0xaa76('0x1f')]));_0x583535[_0xaa76('0x38')](_0x583535[_0xaa76('0x27')],_0x583535[_0xaa76('0x28')],parseInt(_0x583535[_0xaa76('0x29')],0xa)+0x1);_0x583535['close']();}function handleUnpublished(_0x5269e4){logger[_0xaa76('0x2f')](util[_0xaa76('0x1c')](_0xaa76('0x3a'),_0x5269e4[_0xaa76('0x1f')]));_0x5269e4[_0xaa76('0x38')](_0x5269e4[_0xaa76('0x27')],_0x5269e4[_0xaa76('0x28')],parseInt(_0x5269e4['priority'],0xa)+0x1);_0x5269e4[_0xaa76('0x3b')]();}module[_0xaa76('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file