Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / services / agi / project.js
index 2caf09b..81fc638 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 _0xde11=['code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','callerid','dnid','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','close','Project\x20%s\x20not\x20found','continueAt','exports','lodash','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','toJson','mxGraphModel','root','production','start','debug','stringify','joinAt','format','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','calleridname','uniqueid','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand'];(function(_0xbdf6b4,_0x251d4e){var _0x1ba78d=function(_0x24e9f6){while(--_0x24e9f6){_0xbdf6b4['push'](_0xbdf6b4['shift']());}};_0x1ba78d(++_0x251d4e);}(_0xde11,0x1c3));var _0x1de1=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xde11[_0x3b19ea];return _0x40ece9;};'use strict';var _=require(_0x1de1('0x0'));var moment=require('moment');var parser=require(_0x1de1('0x1'));var util=require(_0x1de1('0x2'));var logger=require(_0x1de1('0x3'))(_0x1de1('0x4'));var rpc=require(_0x1de1('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x1de1('0x6'));var Vertices=require(_0x1de1('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1de1('0x8')]()[_0x1de1('0x9')](function(_0x497a62){logger[_0x1de1('0xa')](_0x1de1('0xb'),_0x497a62[_0x1de1('0xc')]);return[];});}function addVertex(_0x48b4da,_0xc533de,_0x1a2caf){_0xc533de['agicommand']=_0x1a2caf;if(_0xc533de['hasOwnProperty'](_0x1de1('0xd'))){_0xc533de[_0x1de1('0xe')]=parseInt(_0xc533de['retry'],0xa);}_0x48b4da[_0x1de1('0xf')](_[_0x1de1('0x10')](_0xc533de,_0x1de1('0x11')));}function initGraph(_0x33629c,_0x484abf){var _0x202176=new Graph();for(var _0x3f723d in _0x33629c){if(_0x33629c[_0x1de1('0x12')](_0x3f723d)){if(_[_0x1de1('0x13')](_0x33629c[_0x3f723d])){for(var _0xd6f6cc=0x0;_0xd6f6cc<_0x33629c[_0x3f723d][_0x1de1('0x14')];_0xd6f6cc+=0x1){addVertex(_0x202176,_0x33629c[_0x3f723d][_0xd6f6cc],_0x3f723d);}}else{addVertex(_0x202176,_0x33629c[_0x3f723d],_0x3f723d);}}}for(var _0x185aed=0x0;_0x185aed<_0x484abf['length'];_0x185aed+=0x1){if(_0x484abf[_0x185aed][_0x1de1('0x15')]&&_0x484abf[_0x185aed][_0x1de1('0x16')]){_0x202176['addEdge'](_0x484abf[_0x185aed]['source'],_0x484abf[_0x185aed][_0x1de1('0x16')],_0x484abf[_0x185aed]['value']);}}return _0x202176;}function getRoot(_0x270e20){return parser[_0x1de1('0x17')](_0x270e20,{'object':!![]})[_0x1de1('0x18')][_0x1de1('0x19')];}function inspect(_0x70c1b){return util['inspect'](_0x70c1b,{'showHidden':![],'depth':null});}function initialize(_0x102761,_0x7bb4f3){var _0x919648=getRoot(_0x102761[_0x1de1('0x1a')]);if(!_0x919648||!_0x919648[_0x1de1('0x1b')])return;var _0x534ef4,_0xc184cf,_0x21e2f4;logger[_0x1de1('0x1c')]('root',JSON[_0x1de1('0x1d')](_0x919648,null,0x2));_0x7bb4f3[_0x1de1('0x1e')]=moment()[_0x1de1('0x1f')](_0x1de1('0x20'));_0x534ef4=initGraph(_[_0x1de1('0x10')](_0x919648,_0x1de1('0x11')),_0x919648[_0x1de1('0x11')]);_0xc184cf=new Vertices(_0x7bb4f3,rpc,mailRpc);logger[_0x1de1('0x21')](util['format'](_0x1de1('0x22'),_0x7bb4f3['arg_1'],_0x7bb4f3[_0x1de1('0x23')],_0x7bb4f3['callerid'],_0x7bb4f3['dnid'],_0x7bb4f3[_0x1de1('0x24')]));_0x534ef4['traverseBFS'](_0x919648[_0x1de1('0x1b')]['id'],function(_0x406451){try{_0x406451=_0xc184cf[_0x1de1('0x25')](_0x406451);logger[_0x1de1('0x1c')](_0x1de1('0x26'),JSON[_0x1de1('0x1d')](_0x406451,null,0x2));if(_0x406451['agicommand']===_0x1de1('0x27')){logger[_0x1de1('0x21')](_0x1de1('0x28'));_0x7bb4f3[_0x1de1('0x29')]=_0x406451[_0x1de1('0x29')]||_0x7bb4f3[_0x1de1('0x29')];_0x7bb4f3[_0x1de1('0x2a')]=_0x406451[_0x1de1('0x2a')];_0x7bb4f3[_0x1de1('0x2b')]=_0x406451['priority']?_0x406451[_0x1de1('0x2b')]-0x1:0x1;return null;}else if(_0x406451&&_0xc184cf[_0x406451[_0x1de1('0x2c')]]){_0x21e2f4=_0xc184cf[_0x406451[_0x1de1('0x2c')]](_0x406451);logger[_0x1de1('0x21')]('response',JSON[_0x1de1('0x1d')](_0x21e2f4,null,0x2));if(_0x21e2f4&&_0x21e2f4[_0x1de1('0x2d')]===AGI_CODE_SUCCESS&&_0x21e2f4[_0x1de1('0x2e')]!==AGI_RESULT_ERROR&&!_0x7bb4f3[_0x1de1('0x2f')]){logger['debug'](_0x1de1('0x30'),inspect(_0x21e2f4));return _[_0x1de1('0x31')](_0x21e2f4[_0x1de1('0x2e')])?null:_0x21e2f4['result'][_0x1de1('0x32')]();}else{logger[_0x1de1('0xa')](_0x1de1('0x30'),inspect(_0x21e2f4));return null;}}else{logger[_0x1de1('0xa')](_0x1de1('0x33'));return null;}}catch(_0x42d25f){logger[_0x1de1('0xa')](_0x42d25f[_0x1de1('0xc')]);return null;}});if(_0x919648[_0x1de1('0x34')]){logger[_0x1de1('0x21')](util[_0x1de1('0x1f')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x7bb4f3['arg_1'],_0x7bb4f3[_0x1de1('0x23')],_0x7bb4f3[_0x1de1('0x35')],_0x7bb4f3[_0x1de1('0x36')],_0x7bb4f3['uniqueid']));_0x534ef4[_0x1de1('0x37')](_0x919648[_0x1de1('0x34')]['id'],function(_0x46e4a5){try{_0x46e4a5=_0xc184cf[_0x1de1('0x25')](_0x46e4a5);logger[_0x1de1('0x1c')](_0x1de1('0x26'),JSON[_0x1de1('0x1d')](_0x46e4a5,null,0x2));if(_0x46e4a5&&_0xc184cf[_0x46e4a5[_0x1de1('0x2c')]]){_0x21e2f4=_0xc184cf[_0x46e4a5[_0x1de1('0x2c')]](_0x46e4a5);if(_0x21e2f4){logger[_0x1de1('0x1c')](_0x1de1('0x30'),inspect(_0x21e2f4));return _['isUndefined'](_0x21e2f4[_0x1de1('0x2e')])?null:_0x21e2f4['result']['toString']();}else{logger['error'](_0x1de1('0x30'),inspect(_0x21e2f4));return null;}}else{logger[_0x1de1('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x33142e){logger[_0x1de1('0xa')](_0x33142e[_0x1de1('0xc')]);return null;}});}logger['info'](util[_0x1de1('0x1f')](_0x1de1('0x38'),_0x7bb4f3[_0x1de1('0x39')],_0x7bb4f3[_0x1de1('0x23')],_0x7bb4f3['callerid'],_0x7bb4f3[_0x1de1('0x36')],_0x7bb4f3['uniqueid']));logger['info'](util[_0x1de1('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x7bb4f3[_0x1de1('0x29')],_0x7bb4f3[_0x1de1('0x2a')],parseInt(_0x7bb4f3[_0x1de1('0x2b')],0xa)+0x1));_0x7bb4f3['continueAt'](_0x7bb4f3[_0x1de1('0x29')],_0x7bb4f3['extension'],parseInt(_0x7bb4f3[_0x1de1('0x2b')],0xa)+0x1);_0x7bb4f3[_0x1de1('0x3a')]();}function handleNotFound(_0x5d97d2){logger[_0x1de1('0xa')](util[_0x1de1('0x1f')](_0x1de1('0x3b'),_0x5d97d2['arg_1']));_0x5d97d2[_0x1de1('0x3c')](_0x5d97d2[_0x1de1('0x29')],_0x5d97d2[_0x1de1('0x2a')],parseInt(_0x5d97d2[_0x1de1('0x2b')],0xa)+0x1);_0x5d97d2[_0x1de1('0x3a')]();}function handleUnpublished(_0x22136e){logger[_0x1de1('0xa')](util[_0x1de1('0x1f')]('Project\x20%s\x20not\x20published',_0x22136e['arg_1']));_0x22136e[_0x1de1('0x3c')](_0x22136e[_0x1de1('0x29')],_0x22136e['extension'],parseInt(_0x22136e[_0x1de1('0x2b')],0xa)+0x1);_0x22136e[_0x1de1('0x3a')]();}module[_0x1de1('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file