Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / services / agi / project.js
index 53b9dc2..80b54c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3fff=['agi','./rpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','hasOwnProperty','maxRetry','retry','addVertex','omit','isArray','length','source','addEdge','target','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','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','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','isUndefined','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','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger'];(function(_0x4e8836,_0x31c212){var _0x236266=function(_0x2e03ff){while(--_0x2e03ff){_0x4e8836['push'](_0x4e8836['shift']());}};_0x236266(++_0x31c212);}(_0x3fff,0x7b));var _0xf3ff=function(_0x43450f,_0x109af9){_0x43450f=_0x43450f-0x0;var _0x496603=_0x3fff[_0x43450f];return _0x496603;};'use strict';var _=require(_0xf3ff('0x0'));var moment=require(_0xf3ff('0x1'));var parser=require(_0xf3ff('0x2'));var util=require(_0xf3ff('0x3'));var logger=require(_0xf3ff('0x4'))(_0xf3ff('0x5'));var rpc=require(_0xf3ff('0x6'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xf3ff('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xf3ff('0x8')]()[_0xf3ff('0x9')](function(_0x1c6136){logger[_0xf3ff('0xa')](_0xf3ff('0xb'),_0x1c6136['stack']);return[];});}function addVertex(_0x54e9d5,_0x528635,_0x60c8f3){_0x528635['agicommand']=_0x60c8f3;if(_0x528635[_0xf3ff('0xc')]('retry')){_0x528635[_0xf3ff('0xd')]=parseInt(_0x528635[_0xf3ff('0xe')],0xa);}_0x54e9d5[_0xf3ff('0xf')](_[_0xf3ff('0x10')](_0x528635,'mxCell'));}function initGraph(_0x5dfa8a,_0x4b94b2){var _0x179217=new Graph();for(var _0x59960d in _0x5dfa8a){if(_0x5dfa8a[_0xf3ff('0xc')](_0x59960d)){if(_[_0xf3ff('0x11')](_0x5dfa8a[_0x59960d])){for(var _0x449937=0x0;_0x449937<_0x5dfa8a[_0x59960d]['length'];_0x449937+=0x1){addVertex(_0x179217,_0x5dfa8a[_0x59960d][_0x449937],_0x59960d);}}else{addVertex(_0x179217,_0x5dfa8a[_0x59960d],_0x59960d);}}}for(var _0x52d483=0x0;_0x52d483<_0x4b94b2[_0xf3ff('0x12')];_0x52d483+=0x1){if(_0x4b94b2[_0x52d483][_0xf3ff('0x13')]&&_0x4b94b2[_0x52d483]['target']){_0x179217[_0xf3ff('0x14')](_0x4b94b2[_0x52d483]['source'],_0x4b94b2[_0x52d483][_0xf3ff('0x15')],_0x4b94b2[_0x52d483]['value']);}}return _0x179217;}function getRoot(_0x4f1193){return parser[_0xf3ff('0x16')](_0x4f1193,{'object':!![]})[_0xf3ff('0x17')][_0xf3ff('0x18')];}function inspect(_0x3189f1){return util[_0xf3ff('0x19')](_0x3189f1,{'showHidden':![],'depth':null});}function initialize(_0x3dbc49,_0x342882){var _0x55464c=getRoot(_0x3dbc49[_0xf3ff('0x1a')]);if(!_0x55464c||!_0x55464c[_0xf3ff('0x1b')])return;var _0x192af8,_0x1260d4,_0x2e48e9;logger[_0xf3ff('0x1c')](_0xf3ff('0x18'),JSON[_0xf3ff('0x1d')](_0x55464c,null,0x2));_0x342882[_0xf3ff('0x1e')]=moment()[_0xf3ff('0x1f')](_0xf3ff('0x20'));_0x192af8=initGraph(_[_0xf3ff('0x10')](_0x55464c,_0xf3ff('0x21')),_0x55464c[_0xf3ff('0x21')]);_0x1260d4=new Vertices(_0x342882,rpc,mailRpc);logger[_0xf3ff('0x22')](util[_0xf3ff('0x1f')](_0xf3ff('0x23'),_0x342882[_0xf3ff('0x24')],_0x342882[_0xf3ff('0x25')],_0x342882[_0xf3ff('0x26')],_0x342882[_0xf3ff('0x27')],_0x342882[_0xf3ff('0x28')]));_0x192af8[_0xf3ff('0x29')](_0x55464c[_0xf3ff('0x1b')]['id'],function(_0x55a5f0){try{_0x55a5f0=_0x1260d4[_0xf3ff('0x2a')](_0x55a5f0);logger['debug'](_0xf3ff('0x2b'),JSON[_0xf3ff('0x1d')](_0x55a5f0,null,0x2));if(_0x55a5f0['agicommand']===_0xf3ff('0x2c')){logger[_0xf3ff('0x22')](_0xf3ff('0x2d'));_0x342882[_0xf3ff('0x2e')]=_0x55a5f0[_0xf3ff('0x2e')]||_0x342882[_0xf3ff('0x2e')];_0x342882[_0xf3ff('0x2f')]=_0x55a5f0[_0xf3ff('0x2f')];_0x342882[_0xf3ff('0x30')]=_0x55a5f0[_0xf3ff('0x30')]?_0x55a5f0[_0xf3ff('0x30')]-0x1:0x1;return null;}else if(_0x55a5f0&&_0x1260d4[_0x55a5f0[_0xf3ff('0x31')]]){_0x2e48e9=_0x1260d4[_0x55a5f0[_0xf3ff('0x31')]](_0x55a5f0);logger['info'](_0xf3ff('0x32'),JSON[_0xf3ff('0x1d')](_0x2e48e9,null,0x2));if(_0x2e48e9&&_0x2e48e9[_0xf3ff('0x33')]===AGI_CODE_SUCCESS&&_0x2e48e9[_0xf3ff('0x34')]!==AGI_RESULT_ERROR&&!_0x342882['evtHangup']){logger[_0xf3ff('0x1c')](_0xf3ff('0x32'),inspect(_0x2e48e9));return _[_0xf3ff('0x35')](_0x2e48e9[_0xf3ff('0x34')])?null:_0x2e48e9['result'][_0xf3ff('0x36')]();}else{logger['error'](_0xf3ff('0x32'),inspect(_0x2e48e9));return null;}}else{logger[_0xf3ff('0xa')](_0xf3ff('0x37'));return null;}}catch(_0x1ef238){logger[_0xf3ff('0xa')](_0x1ef238['stack']);return null;}});if(_0x55464c[_0xf3ff('0x38')]){logger[_0xf3ff('0x22')](util['format'](_0xf3ff('0x39'),_0x342882['arg_1'],_0x342882[_0xf3ff('0x25')],_0x342882[_0xf3ff('0x26')],_0x342882['dnid'],_0x342882[_0xf3ff('0x28')]));_0x192af8[_0xf3ff('0x29')](_0x55464c[_0xf3ff('0x38')]['id'],function(_0x392596){try{_0x392596=_0x1260d4[_0xf3ff('0x2a')](_0x392596);logger[_0xf3ff('0x1c')](_0xf3ff('0x2b'),JSON[_0xf3ff('0x1d')](_0x392596,null,0x2));if(_0x392596&&_0x1260d4[_0x392596['agicommand']]){_0x2e48e9=_0x1260d4[_0x392596[_0xf3ff('0x31')]](_0x392596);if(_0x2e48e9){logger[_0xf3ff('0x1c')](_0xf3ff('0x32'),inspect(_0x2e48e9));return _[_0xf3ff('0x35')](_0x2e48e9[_0xf3ff('0x34')])?null:_0x2e48e9[_0xf3ff('0x34')][_0xf3ff('0x36')]();}else{logger[_0xf3ff('0xa')](_0xf3ff('0x32'),inspect(_0x2e48e9));return null;}}else{logger['error'](_0xf3ff('0x37'));return null;}}catch(_0x4dba7b){logger[_0xf3ff('0xa')](_0x4dba7b['stack']);return null;}});}logger[_0xf3ff('0x22')](util[_0xf3ff('0x1f')](_0xf3ff('0x3a'),_0x342882[_0xf3ff('0x24')],_0x342882[_0xf3ff('0x25')],_0x342882[_0xf3ff('0x26')],_0x342882[_0xf3ff('0x27')],_0x342882[_0xf3ff('0x28')]));logger[_0xf3ff('0x22')](util[_0xf3ff('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x342882[_0xf3ff('0x2e')],_0x342882['extension'],parseInt(_0x342882[_0xf3ff('0x30')],0xa)+0x1));_0x342882[_0xf3ff('0x3b')](_0x342882['context'],_0x342882[_0xf3ff('0x2f')],parseInt(_0x342882[_0xf3ff('0x30')],0xa)+0x1);_0x342882[_0xf3ff('0x3c')]();}function handleNotFound(_0x34b202){logger[_0xf3ff('0xa')](util[_0xf3ff('0x1f')](_0xf3ff('0x3d'),_0x34b202['arg_1']));_0x34b202[_0xf3ff('0x3b')](_0x34b202[_0xf3ff('0x2e')],_0x34b202[_0xf3ff('0x2f')],parseInt(_0x34b202[_0xf3ff('0x30')],0xa)+0x1);_0x34b202[_0xf3ff('0x3c')]();}function handleUnpublished(_0x2c09e5){logger[_0xf3ff('0xa')](util['format'](_0xf3ff('0x3e'),_0x2c09e5['arg_1']));_0x2c09e5['continueAt'](_0x2c09e5[_0xf3ff('0x2e')],_0x2c09e5[_0xf3ff('0x2f')],parseInt(_0x2c09e5[_0xf3ff('0x30')],0xa)+0x1);_0x2c09e5[_0xf3ff('0x3c')]();}module[_0xf3ff('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
+var _0x712a=['xml2json','../../config/logger','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','traverseBFS','clear','vertex','gotoc','context','extension','priority','code','response','isUndefined','toString','error','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','result','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment'];(function(_0x485d46,_0x5b3dac){var _0x45eeca=function(_0x3ddbbb){while(--_0x3ddbbb){_0x485d46['push'](_0x485d46['shift']());}};_0x45eeca(++_0x5b3dac);}(_0x712a,0x1b7));var _0xa712=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x712a[_0x2e04ef];return _0x5722b0;};'use strict';var _=require(_0xa712('0x0'));var moment=require(_0xa712('0x1'));var parser=require(_0xa712('0x2'));var util=require('util');var logger=require(_0xa712('0x3'))(_0xa712('0x4'));var rpc=require(_0xa712('0x5'));var mailRpc=require(_0xa712('0x6'));var Graph=require('./graph');var Vertices=require(_0xa712('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xa712('0x8')]()[_0xa712('0x9')](function(_0x514dd8){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x514dd8[_0xa712('0xa')]);return[];});}function addVertex(_0x497e8a,_0x382b43,_0x6d3221){_0x382b43[_0xa712('0xb')]=_0x6d3221;if(_0x382b43[_0xa712('0xc')](_0xa712('0xd'))){_0x382b43[_0xa712('0xe')]=parseInt(_0x382b43[_0xa712('0xd')],0xa);}_0x497e8a[_0xa712('0xf')](_[_0xa712('0x10')](_0x382b43,_0xa712('0x11')));}function initGraph(_0x8d23fa,_0x239d26){var _0x1d9471=new Graph();for(var _0x31f46c in _0x8d23fa){if(_0x8d23fa[_0xa712('0xc')](_0x31f46c)){if(_[_0xa712('0x12')](_0x8d23fa[_0x31f46c])){for(var _0x1522af=0x0;_0x1522af<_0x8d23fa[_0x31f46c][_0xa712('0x13')];_0x1522af+=0x1){addVertex(_0x1d9471,_0x8d23fa[_0x31f46c][_0x1522af],_0x31f46c);}}else{addVertex(_0x1d9471,_0x8d23fa[_0x31f46c],_0x31f46c);}}}for(var _0x164026=0x0;_0x164026<_0x239d26[_0xa712('0x13')];_0x164026+=0x1){if(_0x239d26[_0x164026][_0xa712('0x14')]&&_0x239d26[_0x164026][_0xa712('0x15')]){_0x1d9471[_0xa712('0x16')](_0x239d26[_0x164026]['source'],_0x239d26[_0x164026][_0xa712('0x15')],_0x239d26[_0x164026][_0xa712('0x17')]);}}return _0x1d9471;}function getRoot(_0xcc4c3b){return parser[_0xa712('0x18')](_0xcc4c3b,{'object':!![]})[_0xa712('0x19')][_0xa712('0x1a')];}function inspect(_0x308f38){return util[_0xa712('0x1b')](_0x308f38,{'showHidden':![],'depth':null});}function initialize(_0x28203c,_0x5a54a4){var _0x4faf59=getRoot(_0x28203c[_0xa712('0x1c')]);if(!_0x4faf59||!_0x4faf59[_0xa712('0x1d')])return;var _0x5147e8,_0x415b1c,_0x4b3bca;logger[_0xa712('0x1e')]('root',JSON[_0xa712('0x1f')](_0x4faf59,null,0x2));_0x5a54a4[_0xa712('0x20')]=moment()['format'](_0xa712('0x21'));_0x5147e8=initGraph(_[_0xa712('0x10')](_0x4faf59,_0xa712('0x11')),_0x4faf59[_0xa712('0x11')]);_0x415b1c=new Vertices(_0x5a54a4,rpc,mailRpc);logger[_0xa712('0x22')](util[_0xa712('0x23')](_0xa712('0x24'),_0x5a54a4[_0xa712('0x25')],_0x5a54a4['calleridname'],_0x5a54a4['callerid'],_0x5a54a4[_0xa712('0x26')],_0x5a54a4['uniqueid']));_0x5147e8[_0xa712('0x27')](_0x4faf59[_0xa712('0x1d')]['id'],function(_0x1fbb58){try{_0x1fbb58=_0x415b1c[_0xa712('0x28')](_0x1fbb58);logger[_0xa712('0x1e')](_0xa712('0x29'),JSON['stringify'](_0x1fbb58,null,0x2));if(_0x1fbb58[_0xa712('0xb')]===_0xa712('0x2a')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5a54a4[_0xa712('0x2b')]=_0x1fbb58[_0xa712('0x2b')]||_0x5a54a4[_0xa712('0x2b')];_0x5a54a4[_0xa712('0x2c')]=_0x1fbb58[_0xa712('0x2c')];_0x5a54a4['priority']=_0x1fbb58[_0xa712('0x2d')]?_0x1fbb58[_0xa712('0x2d')]-0x1:0x1;return null;}else if(_0x1fbb58&&_0x415b1c[_0x1fbb58[_0xa712('0xb')]]){_0x4b3bca=_0x415b1c[_0x1fbb58[_0xa712('0xb')]](_0x1fbb58);logger[_0xa712('0x22')]('response',JSON[_0xa712('0x1f')](_0x4b3bca,null,0x2));if(_0x4b3bca&&_0x4b3bca[_0xa712('0x2e')]===AGI_CODE_SUCCESS&&_0x4b3bca['result']!==AGI_RESULT_ERROR&&!_0x5a54a4['evtHangup']){logger[_0xa712('0x1e')](_0xa712('0x2f'),inspect(_0x4b3bca));return _[_0xa712('0x30')](_0x4b3bca['result'])?null:_0x4b3bca['result'][_0xa712('0x31')]();}else{logger['error']('response',inspect(_0x4b3bca));return null;}}else{logger[_0xa712('0x32')](_0xa712('0x33'));return null;}}catch(_0x246439){logger[_0xa712('0x32')](_0x246439[_0xa712('0xa')]);return null;}});if(_0x4faf59['finally']){logger[_0xa712('0x22')](util[_0xa712('0x23')](_0xa712('0x34'),_0x5a54a4[_0xa712('0x25')],_0x5a54a4[_0xa712('0x35')],_0x5a54a4['callerid'],_0x5a54a4[_0xa712('0x26')],_0x5a54a4[_0xa712('0x36')]));_0x5147e8['traverseBFS'](_0x4faf59['finally']['id'],function(_0x2a1522){try{_0x2a1522=_0x415b1c['clear'](_0x2a1522);logger[_0xa712('0x1e')](_0xa712('0x29'),JSON[_0xa712('0x1f')](_0x2a1522,null,0x2));if(_0x2a1522&&_0x415b1c[_0x2a1522[_0xa712('0xb')]]){_0x4b3bca=_0x415b1c[_0x2a1522['agicommand']](_0x2a1522);if(_0x4b3bca){logger[_0xa712('0x1e')]('response',inspect(_0x4b3bca));return _[_0xa712('0x30')](_0x4b3bca[_0xa712('0x37')])?null:_0x4b3bca[_0xa712('0x37')][_0xa712('0x31')]();}else{logger[_0xa712('0x32')](_0xa712('0x2f'),inspect(_0x4b3bca));return null;}}else{logger[_0xa712('0x32')]('agicommand\x20not\x20found');return null;}}catch(_0x46d998){logger['error'](_0x46d998[_0xa712('0xa')]);return null;}});}logger[_0xa712('0x22')](util[_0xa712('0x23')](_0xa712('0x38'),_0x5a54a4[_0xa712('0x25')],_0x5a54a4[_0xa712('0x35')],_0x5a54a4[_0xa712('0x39')],_0x5a54a4[_0xa712('0x26')],_0x5a54a4[_0xa712('0x36')]));logger['info'](util[_0xa712('0x23')](_0xa712('0x3a'),_0x5a54a4[_0xa712('0x2b')],_0x5a54a4[_0xa712('0x2c')],parseInt(_0x5a54a4['priority'],0xa)+0x1));_0x5a54a4[_0xa712('0x3b')](_0x5a54a4[_0xa712('0x2b')],_0x5a54a4[_0xa712('0x2c')],parseInt(_0x5a54a4[_0xa712('0x2d')],0xa)+0x1);_0x5a54a4[_0xa712('0x3c')]();}function handleNotFound(_0xd06e31){logger[_0xa712('0x32')](util[_0xa712('0x23')]('Project\x20%s\x20not\x20found',_0xd06e31[_0xa712('0x25')]));_0xd06e31[_0xa712('0x3b')](_0xd06e31[_0xa712('0x2b')],_0xd06e31[_0xa712('0x2c')],parseInt(_0xd06e31[_0xa712('0x2d')],0xa)+0x1);_0xd06e31[_0xa712('0x3c')]();}function handleUnpublished(_0x343104){logger[_0xa712('0x32')](util[_0xa712('0x23')](_0xa712('0x3d'),_0x343104[_0xa712('0x25')]));_0x343104['continueAt'](_0x343104['context'],_0x343104['extension'],parseInt(_0x343104['priority'],0xa)+0x1);_0x343104[_0xa712('0x3c')]();}module[_0xa712('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file