Built motion from commit 9d0783e6.|2.6.13
[motion2.git] / server / services / agi / project.js
index b9bb236..e247abe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd37=['info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','traverseBFS','start','clear','vertex','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','agi','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','length','source','target','toJson','root','production','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell'];(function(_0x46f06a,_0x1a2fe6){var _0x3ce9c1=function(_0x302a09){while(--_0x302a09){_0x46f06a['push'](_0x46f06a['shift']());}};_0x3ce9c1(++_0x1a2fe6);}(_0xfd37,0x134));var _0x7fd3=function(_0x4f9de5,_0x36a67e){_0x4f9de5=_0x4f9de5-0x0;var _0x2538fa=_0xfd37[_0x4f9de5];return _0x2538fa;};'use strict';var _=require(_0x7fd3('0x0'));var moment=require('moment');var parser=require(_0x7fd3('0x1'));var util=require(_0x7fd3('0x2'));var logger=require('../../config/logger')(_0x7fd3('0x3'));var rpc=require(_0x7fd3('0x4'));var mailRpc=require(_0x7fd3('0x5'));var Graph=require(_0x7fd3('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x7fd3('0x7')]()[_0x7fd3('0x8')](function(_0x18768c){logger[_0x7fd3('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x18768c[_0x7fd3('0xa')]);return[];});}function addVertex(_0x236bea,_0x38ca94,_0x27d982){_0x38ca94[_0x7fd3('0xb')]=_0x27d982;if(_0x38ca94[_0x7fd3('0xc')](_0x7fd3('0xd'))){_0x38ca94[_0x7fd3('0xe')]=parseInt(_0x38ca94['retry'],0xa);}_0x236bea[_0x7fd3('0xf')](_['omit'](_0x38ca94,'mxCell'));}function initGraph(_0x462882,_0x1bd82d){var _0x26f188=new Graph();for(var _0x5807b7 in _0x462882){if(_0x462882[_0x7fd3('0xc')](_0x5807b7)){if(_['isArray'](_0x462882[_0x5807b7])){for(var _0x31badf=0x0;_0x31badf<_0x462882[_0x5807b7]['length'];_0x31badf+=0x1){addVertex(_0x26f188,_0x462882[_0x5807b7][_0x31badf],_0x5807b7);}}else{addVertex(_0x26f188,_0x462882[_0x5807b7],_0x5807b7);}}}for(var _0x33ffe5=0x0;_0x33ffe5<_0x1bd82d[_0x7fd3('0x10')];_0x33ffe5+=0x1){if(_0x1bd82d[_0x33ffe5][_0x7fd3('0x11')]&&_0x1bd82d[_0x33ffe5]['target']){_0x26f188['addEdge'](_0x1bd82d[_0x33ffe5][_0x7fd3('0x11')],_0x1bd82d[_0x33ffe5][_0x7fd3('0x12')],_0x1bd82d[_0x33ffe5]['value']);}}return _0x26f188;}function getRoot(_0x4cfb5e){return parser[_0x7fd3('0x13')](_0x4cfb5e,{'object':!![]})['mxGraphModel'][_0x7fd3('0x14')];}function inspect(_0x289056){return util['inspect'](_0x289056,{'showHidden':![],'depth':null});}function initialize(_0xfdc6c,_0xddfb6d){var _0x1c0a53=getRoot(_0xfdc6c[_0x7fd3('0x15')]);if(!_0x1c0a53||!_0x1c0a53['start'])return;var _0xff19a,_0x3d0cea,_0x46441a;logger[_0x7fd3('0x16')]('root',JSON[_0x7fd3('0x17')](_0x1c0a53,null,0x2));_0xddfb6d['joinAt']=moment()[_0x7fd3('0x18')](_0x7fd3('0x19'));_0xff19a=initGraph(_[_0x7fd3('0x1a')](_0x1c0a53,_0x7fd3('0x1b')),_0x1c0a53[_0x7fd3('0x1b')]);_0x3d0cea=new Vertices(_0xddfb6d,rpc,mailRpc);logger[_0x7fd3('0x1c')](util[_0x7fd3('0x18')](_0x7fd3('0x1d'),_0xddfb6d[_0x7fd3('0x1e')],_0xddfb6d[_0x7fd3('0x1f')],_0xddfb6d[_0x7fd3('0x20')],_0xddfb6d['dnid'],_0xddfb6d['uniqueid']));_0xff19a[_0x7fd3('0x21')](_0x1c0a53[_0x7fd3('0x22')]['id'],function(_0x356a23){try{_0x356a23=_0x3d0cea[_0x7fd3('0x23')](_0x356a23);logger['debug'](_0x7fd3('0x24'),JSON[_0x7fd3('0x17')](_0x356a23,null,0x2));if(_0x356a23['agicommand']==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xddfb6d[_0x7fd3('0x25')]=_0x356a23[_0x7fd3('0x25')]||_0xddfb6d[_0x7fd3('0x25')];_0xddfb6d['extension']=_0x356a23[_0x7fd3('0x26')];_0xddfb6d[_0x7fd3('0x27')]=_0x356a23[_0x7fd3('0x27')]?_0x356a23[_0x7fd3('0x27')]-0x1:0x1;return null;}else if(_0x356a23&&_0x3d0cea[_0x356a23[_0x7fd3('0xb')]]){_0x46441a=_0x3d0cea[_0x356a23[_0x7fd3('0xb')]](_0x356a23);logger[_0x7fd3('0x1c')](_0x7fd3('0x28'),JSON[_0x7fd3('0x17')](_0x46441a,null,0x2));if(_0x46441a&&_0x46441a[_0x7fd3('0x29')]===AGI_CODE_SUCCESS&&_0x46441a['result']!==AGI_RESULT_ERROR&&!_0xddfb6d['evtHangup']){logger[_0x7fd3('0x16')](_0x7fd3('0x28'),inspect(_0x46441a));return _[_0x7fd3('0x2a')](_0x46441a[_0x7fd3('0x2b')])?null:_0x46441a['result'][_0x7fd3('0x2c')]();}else{logger['error'](_0x7fd3('0x28'),inspect(_0x46441a));return null;}}else{logger['error'](_0x7fd3('0x2d'));return null;}}catch(_0x3d4769){logger[_0x7fd3('0x9')](_0x3d4769[_0x7fd3('0xa')]);return null;}});if(_0x1c0a53[_0x7fd3('0x2e')]){logger[_0x7fd3('0x1c')](util[_0x7fd3('0x18')](_0x7fd3('0x2f'),_0xddfb6d['arg_1'],_0xddfb6d[_0x7fd3('0x1f')],_0xddfb6d[_0x7fd3('0x20')],_0xddfb6d['dnid'],_0xddfb6d['uniqueid']));_0xff19a[_0x7fd3('0x21')](_0x1c0a53[_0x7fd3('0x2e')]['id'],function(_0x23cccd){try{_0x23cccd=_0x3d0cea['clear'](_0x23cccd);logger[_0x7fd3('0x16')]('vertex',JSON[_0x7fd3('0x17')](_0x23cccd,null,0x2));if(_0x23cccd&&_0x3d0cea[_0x23cccd[_0x7fd3('0xb')]]){_0x46441a=_0x3d0cea[_0x23cccd['agicommand']](_0x23cccd);if(_0x46441a){logger['debug'](_0x7fd3('0x28'),inspect(_0x46441a));return _[_0x7fd3('0x2a')](_0x46441a[_0x7fd3('0x2b')])?null:_0x46441a[_0x7fd3('0x2b')][_0x7fd3('0x2c')]();}else{logger[_0x7fd3('0x9')](_0x7fd3('0x28'),inspect(_0x46441a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x274615){logger['error'](_0x274615['stack']);return null;}});}logger[_0x7fd3('0x1c')](util[_0x7fd3('0x18')](_0x7fd3('0x30'),_0xddfb6d[_0x7fd3('0x1e')],_0xddfb6d[_0x7fd3('0x1f')],_0xddfb6d['callerid'],_0xddfb6d[_0x7fd3('0x31')],_0xddfb6d['uniqueid']));logger[_0x7fd3('0x1c')](util[_0x7fd3('0x18')](_0x7fd3('0x32'),_0xddfb6d[_0x7fd3('0x25')],_0xddfb6d[_0x7fd3('0x26')],parseInt(_0xddfb6d[_0x7fd3('0x27')],0xa)+0x1));_0xddfb6d[_0x7fd3('0x33')](_0xddfb6d[_0x7fd3('0x25')],_0xddfb6d[_0x7fd3('0x26')],parseInt(_0xddfb6d[_0x7fd3('0x27')],0xa)+0x1);_0xddfb6d[_0x7fd3('0x34')]();}function handleNotFound(_0x194b3d){logger[_0x7fd3('0x9')](util[_0x7fd3('0x18')](_0x7fd3('0x35'),_0x194b3d['arg_1']));_0x194b3d[_0x7fd3('0x33')](_0x194b3d[_0x7fd3('0x25')],_0x194b3d[_0x7fd3('0x26')],parseInt(_0x194b3d['priority'],0xa)+0x1);_0x194b3d[_0x7fd3('0x34')]();}function handleUnpublished(_0xbb15b8){logger[_0x7fd3('0x9')](util['format'](_0x7fd3('0x36'),_0xbb15b8['arg_1']));_0xbb15b8[_0x7fd3('0x33')](_0xbb15b8['context'],_0xbb15b8['extension'],parseInt(_0xbb15b8[_0x7fd3('0x27')],0xa)+0x1);_0xbb15b8[_0x7fd3('0x34')]();}module[_0x7fd3('0x37')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
+var _0x64ae=['calleridname','uniqueid','[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','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./graph','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','inspect','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','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','traverseBFS','start','clear','debug','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x4ec4c6,_0xee1082){var _0x25c91d=function(_0xdfd764){while(--_0xdfd764){_0x4ec4c6['push'](_0x4ec4c6['shift']());}};_0x25c91d(++_0xee1082);}(_0x64ae,0x87));var _0xe64a=function(_0x5a0826,_0x1d3677){_0x5a0826=_0x5a0826-0x0;var _0x2912d3=_0x64ae[_0x5a0826];return _0x2912d3;};'use strict';var _=require(_0xe64a('0x0'));var moment=require(_0xe64a('0x1'));var parser=require(_0xe64a('0x2'));var util=require(_0xe64a('0x3'));var logger=require(_0xe64a('0x4'))(_0xe64a('0x5'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xe64a('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe64a('0x7')]()['catch'](function(_0x1db2a3){logger[_0xe64a('0x8')](_0xe64a('0x9'),_0x1db2a3['stack']);return[];});}function addVertex(_0xa714e9,_0x2fc630,_0xf03f7){_0x2fc630[_0xe64a('0xa')]=_0xf03f7;if(_0x2fc630[_0xe64a('0xb')]('retry')){_0x2fc630[_0xe64a('0xc')]=parseInt(_0x2fc630[_0xe64a('0xd')],0xa);}_0xa714e9[_0xe64a('0xe')](_['omit'](_0x2fc630,_0xe64a('0xf')));}function initGraph(_0x54dc18,_0x4527a7){var _0x47060c=new Graph();for(var _0xcab766 in _0x54dc18){if(_0x54dc18[_0xe64a('0xb')](_0xcab766)){if(_[_0xe64a('0x10')](_0x54dc18[_0xcab766])){for(var _0x1b4086=0x0;_0x1b4086<_0x54dc18[_0xcab766][_0xe64a('0x11')];_0x1b4086+=0x1){addVertex(_0x47060c,_0x54dc18[_0xcab766][_0x1b4086],_0xcab766);}}else{addVertex(_0x47060c,_0x54dc18[_0xcab766],_0xcab766);}}}for(var _0x5b4810=0x0;_0x5b4810<_0x4527a7[_0xe64a('0x11')];_0x5b4810+=0x1){if(_0x4527a7[_0x5b4810][_0xe64a('0x12')]&&_0x4527a7[_0x5b4810]['target']){_0x47060c['addEdge'](_0x4527a7[_0x5b4810][_0xe64a('0x12')],_0x4527a7[_0x5b4810][_0xe64a('0x13')],_0x4527a7[_0x5b4810][_0xe64a('0x14')]);}}return _0x47060c;}function getRoot(_0x5aa52b){return parser[_0xe64a('0x15')](_0x5aa52b,{'object':!![]})[_0xe64a('0x16')][_0xe64a('0x17')];}function inspect(_0x4fba68){return util[_0xe64a('0x18')](_0x4fba68,{'showHidden':![],'depth':null});}function initialize(_0x58ea1f,_0x2d891b){var _0x2074b8=getRoot(_0x58ea1f['production']);if(!_0x2074b8||!_0x2074b8['start'])return;var _0x16976f,_0x50cc82,_0x584945;logger['debug'](_0xe64a('0x17'),JSON[_0xe64a('0x19')](_0x2074b8,null,0x2));_0x2d891b[_0xe64a('0x1a')]=moment()[_0xe64a('0x1b')](_0xe64a('0x1c'));_0x16976f=initGraph(_[_0xe64a('0x1d')](_0x2074b8,'mxCell'),_0x2074b8['mxCell']);_0x50cc82=new Vertices(_0x2d891b,rpc,mailRpc);logger[_0xe64a('0x1e')](util['format'](_0xe64a('0x1f'),_0x2d891b[_0xe64a('0x20')],_0x2d891b['calleridname'],_0x2d891b[_0xe64a('0x21')],_0x2d891b[_0xe64a('0x22')],_0x2d891b['uniqueid']));_0x16976f[_0xe64a('0x23')](_0x2074b8[_0xe64a('0x24')]['id'],function(_0x13c1c7){try{_0x13c1c7=_0x50cc82[_0xe64a('0x25')](_0x13c1c7);logger[_0xe64a('0x26')](_0xe64a('0x27'),JSON[_0xe64a('0x19')](_0x13c1c7,null,0x2));if(_0x13c1c7[_0xe64a('0xa')]==='gotoc'){logger[_0xe64a('0x1e')](_0xe64a('0x28'));_0x2d891b['context']=_0x13c1c7[_0xe64a('0x29')]||_0x2d891b[_0xe64a('0x29')];_0x2d891b[_0xe64a('0x2a')]=_0x13c1c7[_0xe64a('0x2a')];_0x2d891b[_0xe64a('0x2b')]=_0x13c1c7[_0xe64a('0x2b')]?_0x13c1c7[_0xe64a('0x2b')]-0x1:0x1;return null;}else if(_0x13c1c7&&_0x50cc82[_0x13c1c7['agicommand']]){_0x584945=_0x50cc82[_0x13c1c7[_0xe64a('0xa')]](_0x13c1c7);logger[_0xe64a('0x1e')]('response',JSON['stringify'](_0x584945,null,0x2));if(_0x584945&&_0x584945[_0xe64a('0x2c')]===AGI_CODE_SUCCESS&&_0x584945[_0xe64a('0x2d')]!==AGI_RESULT_ERROR&&!_0x2d891b[_0xe64a('0x2e')]){logger[_0xe64a('0x26')](_0xe64a('0x2f'),inspect(_0x584945));return _[_0xe64a('0x30')](_0x584945[_0xe64a('0x2d')])?null:_0x584945[_0xe64a('0x2d')][_0xe64a('0x31')]();}else{logger['error'](_0xe64a('0x2f'),inspect(_0x584945));return null;}}else{logger[_0xe64a('0x8')](_0xe64a('0x32'));return null;}}catch(_0x225f93){logger[_0xe64a('0x8')](_0x225f93[_0xe64a('0x33')]);return null;}});if(_0x2074b8[_0xe64a('0x34')]){logger[_0xe64a('0x1e')](util[_0xe64a('0x1b')](_0xe64a('0x35'),_0x2d891b['arg_1'],_0x2d891b[_0xe64a('0x36')],_0x2d891b[_0xe64a('0x21')],_0x2d891b['dnid'],_0x2d891b[_0xe64a('0x37')]));_0x16976f[_0xe64a('0x23')](_0x2074b8[_0xe64a('0x34')]['id'],function(_0x453b74){try{_0x453b74=_0x50cc82[_0xe64a('0x25')](_0x453b74);logger['debug'](_0xe64a('0x27'),JSON[_0xe64a('0x19')](_0x453b74,null,0x2));if(_0x453b74&&_0x50cc82[_0x453b74['agicommand']]){_0x584945=_0x50cc82[_0x453b74['agicommand']](_0x453b74);if(_0x584945){logger[_0xe64a('0x26')]('response',inspect(_0x584945));return _['isUndefined'](_0x584945[_0xe64a('0x2d')])?null:_0x584945[_0xe64a('0x2d')][_0xe64a('0x31')]();}else{logger['error'](_0xe64a('0x2f'),inspect(_0x584945));return null;}}else{logger[_0xe64a('0x8')](_0xe64a('0x32'));return null;}}catch(_0x559a6d){logger[_0xe64a('0x8')](_0x559a6d[_0xe64a('0x33')]);return null;}});}logger[_0xe64a('0x1e')](util[_0xe64a('0x1b')](_0xe64a('0x38'),_0x2d891b[_0xe64a('0x20')],_0x2d891b[_0xe64a('0x36')],_0x2d891b['callerid'],_0x2d891b[_0xe64a('0x22')],_0x2d891b[_0xe64a('0x37')]));logger[_0xe64a('0x1e')](util[_0xe64a('0x1b')](_0xe64a('0x39'),_0x2d891b[_0xe64a('0x29')],_0x2d891b['extension'],parseInt(_0x2d891b[_0xe64a('0x2b')],0xa)+0x1));_0x2d891b[_0xe64a('0x3a')](_0x2d891b[_0xe64a('0x29')],_0x2d891b[_0xe64a('0x2a')],parseInt(_0x2d891b[_0xe64a('0x2b')],0xa)+0x1);_0x2d891b[_0xe64a('0x3b')]();}function handleNotFound(_0x388c1c){logger[_0xe64a('0x8')](util[_0xe64a('0x1b')](_0xe64a('0x3c'),_0x388c1c[_0xe64a('0x20')]));_0x388c1c['continueAt'](_0x388c1c[_0xe64a('0x29')],_0x388c1c['extension'],parseInt(_0x388c1c[_0xe64a('0x2b')],0xa)+0x1);_0x388c1c['close']();}function handleUnpublished(_0x2a71e6){logger[_0xe64a('0x8')](util[_0xe64a('0x1b')](_0xe64a('0x3d'),_0x2a71e6[_0xe64a('0x20')]));_0x2a71e6[_0xe64a('0x3a')](_0x2a71e6[_0xe64a('0x29')],_0x2a71e6[_0xe64a('0x2a')],parseInt(_0x2a71e6[_0xe64a('0x2b')],0xa)+0x1);_0x2a71e6[_0xe64a('0x3b')]();}module[_0xe64a('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file