Built motion from commit ddca4d0d.|2.5.47
[motion2.git] / server / services / agi / index.js
index 65e2909..5bd111a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0bb=['catch','createSquareReport','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','evtHangup','response','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','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','connection','xml2json','lodash','syncho','moment','../../config/logger','agi','./rpc','./graph','./vertices','defaults','nextTick','error','stack','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','addEdge','source','target','value','getSquareProject'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x23d2a0,_0x516174){_0x23d2a0=_0x23d2a0-0x0;var _0x409e80=_0xd0bb[_0x23d2a0];return _0x409e80;};'use strict';var parser=require(_0xbd0b('0x0'));var _=require(_0xbd0b('0x1'));var syncho=require(_0xbd0b('0x2'));var util=require('util');var moment=require(_0xbd0b('0x3'));var config=require('../../config/environment');var logger=require(_0xbd0b('0x4'))(_0xbd0b('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xbd0b('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0xbd0b('0x7'));var Vertices=require(_0xbd0b('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xbd0b('0x5')]=_[_0xbd0b('0x9')](config[_0xbd0b('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x2a4075){process[_0xbd0b('0xa')](function(){syncho(function(){try{setChannelVariables(_0x2a4075);agiHandler(_0x2a4075);}catch(_0x39c099){logger[_0xbd0b('0xb')](_0x39c099[_0xbd0b('0xc')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xbd0b('0x5')][_0xbd0b('0xd')]);logger['info'](util[_0xbd0b('0xe')](_0xbd0b('0xf'),config['agi']['ip'],config[_0xbd0b('0x5')][_0xbd0b('0xd')]));}function errorHandler(_0x3a4b28){if(_0x3a4b28&&_0x3a4b28[_0xbd0b('0x10')]&&_0x3a4b28[_0xbd0b('0x11')]){logger[_0xbd0b('0xb')](util[_0xbd0b('0xe')](_0xbd0b('0x12'),_0x3a4b28[_0xbd0b('0x10')],_0x3a4b28[_0xbd0b('0x11')]));}else{logger[_0xbd0b('0xb')](util['format'](_0xbd0b('0x13'),_0x3a4b28['stack']));}}function closeHandler(){logger['info'](util[_0xbd0b('0xe')](_0xbd0b('0x14'),this[_0xbd0b('0x15')],this[_0xbd0b('0x16')],this[_0xbd0b('0x17')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x2136ef){logger[_0xbd0b('0xb')](_0x2136ef[_0xbd0b('0xc')]);}}function timeoutHandler(){logger[_0xbd0b('0x18')](util[_0xbd0b('0xe')](_0xbd0b('0x19'),this['arg_1'],this[_0xbd0b('0x16')],this['callerid'],this[_0xbd0b('0x1a')],this[_0xbd0b('0x1b')]));}function hangupHandler(){logger[_0xbd0b('0x18')](util[_0xbd0b('0xe')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xbd0b('0x15')],this[_0xbd0b('0x16')],this[_0xbd0b('0x17')],this['dnid'],this[_0xbd0b('0x1b')]));this['evtHangup']=!![];}function getRoot(_0xc66b8){return parser[_0xbd0b('0x1c')](_0xc66b8,{'object':!![]})[_0xbd0b('0x1d')][_0xbd0b('0x1e')];}function addVertex(_0x297c85,_0x539359,_0x75909f){_0x539359['agicommand']=_0x75909f;if(_0x539359[_0xbd0b('0x1f')](_0xbd0b('0x20'))){_0x539359[_0xbd0b('0x21')]=parseInt(_0x539359[_0xbd0b('0x20')],0xa);}_0x297c85[_0xbd0b('0x22')](_[_0xbd0b('0x23')](_0x539359,'mxCell'));}function initGraph(_0x382f76,_0x1b46a3){var _0x33b752=new Graph();for(var _0x1b5a00 in _0x382f76){if(_0x382f76[_0xbd0b('0x1f')](_0x1b5a00)){if(_[_0xbd0b('0x24')](_0x382f76[_0x1b5a00])){for(var _0x47f6f5=0x0;_0x47f6f5<_0x382f76[_0x1b5a00][_0xbd0b('0x25')];_0x47f6f5+=0x1){addVertex(_0x33b752,_0x382f76[_0x1b5a00][_0x47f6f5],_0x1b5a00);}}else{addVertex(_0x33b752,_0x382f76[_0x1b5a00],_0x1b5a00);}}}for(var _0x28f1a7=0x0;_0x28f1a7<_0x1b46a3[_0xbd0b('0x25')];_0x28f1a7+=0x1){if(_0x1b46a3[_0x28f1a7]['source']&&_0x1b46a3[_0x28f1a7]['target']){_0x33b752[_0xbd0b('0x26')](_0x1b46a3[_0x28f1a7][_0xbd0b('0x27')],_0x1b46a3[_0x28f1a7][_0xbd0b('0x28')],_0x1b46a3[_0x28f1a7][_0xbd0b('0x29')]);}}return _0x33b752;}function getSquareProject(_0x4e2149,_0x38926f){rpc[_0xbd0b('0x2a')](_0x4e2149)['then'](function(_0x45f7d6){_0x38926f(null,_0x45f7d6);})[_0xbd0b('0x2b')](function(_0x5e1cb3){_0x38926f(null,_0x5e1cb3);});}function createSquareReport(_0x5e5e69,_0x206c6a){rpc[_0xbd0b('0x2c')](_0x5e5e69)['then'](function(_0x31bdd3){if(_0x206c6a){_0x206c6a(null,_0x31bdd3);}})[_0xbd0b('0x2b')](function(_0x431e51){if(_0x206c6a){_0x206c6a(null,_0x431e51);}});}function setChannelVariables(_0x417e25){for(var _0x3ce614 in _0x417e25){if(_0x417e25[_0xbd0b('0x1f')](_0x3ce614)){if(_0x3ce614['indexOf'](_0xbd0b('0x2d'))===0x0){_0x417e25[_0x3ce614[_0xbd0b('0x2e')](0x4)]=_0x417e25[_0x3ce614];delete _0x417e25[_0x3ce614];}}}}function getLogFromObject(_0x32572e){return util[_0xbd0b('0x2f')](_0x32572e,{'showHidden':![],'depth':null});}function agiHandler(_0x2aec53){var _0x3ced2f,_0x2c94d4,_0x1029a0,_0x10e06b,_0x3ac75f;logger[_0xbd0b('0x30')](_0xbd0b('0x31'),JSON[_0xbd0b('0x32')](_0x2aec53,null,0x2));logger[_0xbd0b('0x18')](util['format'](_0xbd0b('0x33'),_0x2aec53[_0xbd0b('0x15')],_0x2aec53['calleridname'],_0x2aec53[_0xbd0b('0x17')],_0x2aec53[_0xbd0b('0x1a')],_0x2aec53[_0xbd0b('0x1b')]));_0x2aec53['on'](_0xbd0b('0xb'),errorHandler);_0x2aec53['on'](_0xbd0b('0x34'),closeHandler);_0x2aec53['on'](_0xbd0b('0x35'),timeoutHandler);_0x2aec53['evtHangup']=![];_0x2aec53['on'](_0xbd0b('0x36'),hangupHandler);var _0x11cf5a=getSquareProject[_0xbd0b('0x37')](null,_0x2aec53[_0xbd0b('0x15')]);if(_0x11cf5a){if(_0x11cf5a[_0xbd0b('0x38')]){_0x3ced2f=getRoot(_0x11cf5a['production']);if(_0x3ced2f&&_0x3ced2f['start']){logger[_0xbd0b('0x30')](_0xbd0b('0x1e'),JSON[_0xbd0b('0x32')](_0x3ced2f,null,0x2));_0x2aec53[_0xbd0b('0x39')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c94d4=initGraph(_[_0xbd0b('0x23')](_0x3ced2f,'mxCell'),_0x3ced2f[_0xbd0b('0x3a')]);_0x1029a0=new Vertices(_0x2aec53,rpc,mailRpc);logger[_0xbd0b('0x18')](util[_0xbd0b('0xe')](_0xbd0b('0x3b'),_0x2aec53[_0xbd0b('0x15')],_0x2aec53[_0xbd0b('0x16')],_0x2aec53[_0xbd0b('0x17')],_0x2aec53[_0xbd0b('0x1a')],_0x2aec53[_0xbd0b('0x1b')]));_0x2c94d4[_0xbd0b('0x3c')](_0x3ced2f[_0xbd0b('0x3d')]['id'],function(_0x411872){try{_0x411872=_0x1029a0[_0xbd0b('0x3e')](_0x411872);logger[_0xbd0b('0x30')](_0xbd0b('0x3f'),JSON[_0xbd0b('0x32')](_0x411872,null,0x2));if(_0x411872[_0xbd0b('0x40')]===_0xbd0b('0x41')){logger['info'](_0xbd0b('0x42'));_0x2aec53[_0xbd0b('0x43')]=_0x411872[_0xbd0b('0x43')]||_0x2aec53[_0xbd0b('0x43')];_0x2aec53[_0xbd0b('0x44')]=_0x411872[_0xbd0b('0x44')];_0x2aec53[_0xbd0b('0x45')]=_0x411872[_0xbd0b('0x45')]?_0x411872[_0xbd0b('0x45')]-0x1:0x1;return null;}else if(_0x411872&&_0x1029a0[_0x411872[_0xbd0b('0x40')]]){_0x3ac75f=_0x1029a0[_0x411872[_0xbd0b('0x40')]](_0x411872);logger[_0xbd0b('0x18')]('response',JSON[_0xbd0b('0x32')](_0x3ac75f,null,0x2));if(_0x3ac75f&&_0x3ac75f['code']===AGI_CODE_SUCCESS&&_0x3ac75f['result']!==AGI_RESULT_ERROR&&!_0x2aec53[_0xbd0b('0x46')]){logger[_0xbd0b('0x30')](_0xbd0b('0x47'),getLogFromObject(_0x3ac75f));return _['isUndefined'](_0x3ac75f[_0xbd0b('0x48')])?null:_0x3ac75f[_0xbd0b('0x48')][_0xbd0b('0x49')]();}else{logger[_0xbd0b('0xb')](_0xbd0b('0x47'),getLogFromObject(_0x3ac75f));return null;}}else{logger['error'](_0xbd0b('0x4a'));return null;}}catch(_0x3619b9){logger[_0xbd0b('0xb')](_0x3619b9[_0xbd0b('0xc')]);return null;}});if(_0x3ced2f[_0xbd0b('0x4b')]){logger[_0xbd0b('0x18')](util['format'](_0xbd0b('0x4c'),_0x2aec53[_0xbd0b('0x15')],_0x2aec53[_0xbd0b('0x16')],_0x2aec53[_0xbd0b('0x17')],_0x2aec53[_0xbd0b('0x1a')],_0x2aec53[_0xbd0b('0x1b')]));_0x2c94d4[_0xbd0b('0x3c')](_0x3ced2f[_0xbd0b('0x4b')]['id'],function(_0xc8b3f){try{_0xc8b3f=_0x1029a0[_0xbd0b('0x3e')](_0xc8b3f);logger[_0xbd0b('0x30')](_0xbd0b('0x3f'),JSON[_0xbd0b('0x32')](_0xc8b3f,null,0x2));if(_0xc8b3f&&_0x1029a0[_0xc8b3f[_0xbd0b('0x40')]]){_0x3ac75f=_0x1029a0[_0xc8b3f[_0xbd0b('0x40')]](_0xc8b3f);if(_0x3ac75f){logger[_0xbd0b('0x30')](_0xbd0b('0x47'),getLogFromObject(_0x3ac75f));return _[_0xbd0b('0x4d')](_0x3ac75f[_0xbd0b('0x48')])?null:_0x3ac75f[_0xbd0b('0x48')][_0xbd0b('0x49')]();}else{logger[_0xbd0b('0xb')](_0xbd0b('0x47'),getLogFromObject(_0x3ac75f));return null;}}else{logger['error'](_0xbd0b('0x4a'));return null;}}catch(_0x1c13da){logger['error'](_0x1c13da['stack']);return null;}});}logger['info'](util[_0xbd0b('0xe')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2aec53[_0xbd0b('0x15')],_0x2aec53[_0xbd0b('0x16')],_0x2aec53[_0xbd0b('0x17')],_0x2aec53[_0xbd0b('0x1a')],_0x2aec53['uniqueid']));logger[_0xbd0b('0x18')](util['format'](_0xbd0b('0x4e'),_0x2aec53['context'],_0x2aec53['extension'],parseInt(_0x2aec53[_0xbd0b('0x45')],0xa)+0x1));_0x2aec53[_0xbd0b('0x4f')](_0x2aec53[_0xbd0b('0x43')],_0x2aec53[_0xbd0b('0x44')],parseInt(_0x2aec53[_0xbd0b('0x45')],0xa)+0x1);_0x2aec53[_0xbd0b('0x34')]();}}else{logger[_0xbd0b('0xb')](util[_0xbd0b('0xe')]('Project\x20%s\x20not\x20published',_0x2aec53['arg_1']));_0x2aec53[_0xbd0b('0x4f')](_0x2aec53[_0xbd0b('0x43')],_0x2aec53['extension'],parseInt(_0x2aec53['priority'],0xa)+0x1);_0x2aec53[_0xbd0b('0x34')]();}}else{logger[_0xbd0b('0xb')](util[_0xbd0b('0xe')](_0xbd0b('0x50'),_0x2aec53['arg_1']));_0x2aec53[_0xbd0b('0x4f')](_0x2aec53[_0xbd0b('0x43')],_0x2aec53[_0xbd0b('0x44')],parseInt(_0x2aec53[_0xbd0b('0x45')],0xa)+0x1);_0x2aec53['close']();}}function main(){var _0xa6ac89;return utilLicense[_0xbd0b('0x51')]()['then'](function(_0x122a19){if(_0x122a19){if(_0x122a19[_0xbd0b('0x52')]){if(_0x122a19[_0xbd0b('0x53')]&&_0x122a19[_0xbd0b('0x53')]>0x0){logger[_0xbd0b('0x18')](util[_0xbd0b('0xe')](_0xbd0b('0x54'),_0x122a19[_0xbd0b('0x53')]));_0xa6ac89=_0x122a19['callysquare'];}else{logger[_0xbd0b('0x18')](_0xbd0b('0x55'));}}else{logger[_0xbd0b('0x18')](_0xbd0b('0x56'));_0xa6ac89=-0x1;}}})[_0xbd0b('0x2b')](function(_0x1076dc){logger['error']('[LICENSE]',_0x1076dc[_0xbd0b('0xc')]);})[_0xbd0b('0x4b')](function(){var _0x4d23cd=require(_0xbd0b('0x57'))(config[_0xbd0b('0x5')][_0xbd0b('0xd')],config[_0xbd0b('0x5')]['ip'],_0xa6ac89);_0x4d23cd['on'](_0xbd0b('0xb'),errorHandler);_0x4d23cd['on']('listening',listeningHandler);_0x4d23cd['on'](_0xbd0b('0x58'),connectionHandler);_0x4d23cd['on'](_0xbd0b('0x34'),closeHandler);});}main();
\ No newline at end of file
+var _0xa4c1=['stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','traverseBFS','clear','vertex','gotoc','context','extension','priority','response','code','result','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\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\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','syncho','util','moment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','nextTick','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','error','message','[ERROR]\x20%s','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','agi_','substring','inspect','debug','variables'];(function(_0x36f532,_0x5c936e){var _0x24ca9f=function(_0x87811e){while(--_0x87811e){_0x36f532['push'](_0x36f532['shift']());}};_0x24ca9f(++_0x5c936e);}(_0xa4c1,0x184));var _0x1a4c=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xa4c1[_0x53e3fa];return _0xe8584a;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0x1a4c('0x0'));var util=require(_0x1a4c('0x1'));var moment=require(_0x1a4c('0x2'));var config=require('../../config/environment');var logger=require(_0x1a4c('0x3'))('agi');var utilLicense=require(_0x1a4c('0x4'));var rpc=require(_0x1a4c('0x5'));var mailRpc=require(_0x1a4c('0x6'));var Graph=require(_0x1a4c('0x7'));var Vertices=require(_0x1a4c('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1a4c('0x9')]=_[_0x1a4c('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x15e7ca){process[_0x1a4c('0xb')](function(){syncho(function(){try{setChannelVariables(_0x15e7ca);agiHandler(_0x15e7ca);}catch(_0x3cd2d6){logger['error'](_0x3cd2d6[_0x1a4c('0xc')]);}});});}function listeningHandler(){console['log'](_0x1a4c('0xd'),config[_0x1a4c('0x9')][_0x1a4c('0xe')]);logger[_0x1a4c('0xf')](util[_0x1a4c('0x10')](_0x1a4c('0x11'),config[_0x1a4c('0x9')]['ip'],config['agi'][_0x1a4c('0xe')]));}function errorHandler(_0x10f981){if(_0x10f981&&_0x10f981[_0x1a4c('0x12')]&&_0x10f981['message']){logger[_0x1a4c('0x13')](util[_0x1a4c('0x10')]('[%s]\x20%s',_0x10f981['name'],_0x10f981[_0x1a4c('0x14')]));}else{logger[_0x1a4c('0x13')](util[_0x1a4c('0x10')](_0x1a4c('0x15'),_0x10f981[_0x1a4c('0xc')]));}}function closeHandler(){logger['info'](util[_0x1a4c('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x1a4c('0x16')],this['callerid'],this[_0x1a4c('0x17')],this[_0x1a4c('0x18')]));try{createSquareReport(this);}catch(_0xbbd4bf){logger[_0x1a4c('0x13')](_0xbbd4bf[_0x1a4c('0xc')]);}}function timeoutHandler(){logger[_0x1a4c('0xf')](util[_0x1a4c('0x10')](_0x1a4c('0x19'),this[_0x1a4c('0x1a')],this[_0x1a4c('0x16')],this[_0x1a4c('0x1b')],this[_0x1a4c('0x17')],this[_0x1a4c('0x18')]));}function hangupHandler(){logger[_0x1a4c('0xf')](util['format'](_0x1a4c('0x1c'),this[_0x1a4c('0x1a')],this[_0x1a4c('0x16')],this[_0x1a4c('0x1b')],this[_0x1a4c('0x17')],this['uniqueid']));this[_0x1a4c('0x1d')]=!![];}function getRoot(_0x15c0e6){return parser[_0x1a4c('0x1e')](_0x15c0e6,{'object':!![]})[_0x1a4c('0x1f')]['root'];}function addVertex(_0x34cb68,_0x5f2afb,_0x4e464c){_0x5f2afb[_0x1a4c('0x20')]=_0x4e464c;if(_0x5f2afb[_0x1a4c('0x21')](_0x1a4c('0x22'))){_0x5f2afb[_0x1a4c('0x23')]=parseInt(_0x5f2afb[_0x1a4c('0x22')],0xa);}_0x34cb68[_0x1a4c('0x24')](_[_0x1a4c('0x25')](_0x5f2afb,'mxCell'));}function initGraph(_0x16a443,_0x50157e){var _0x2fc5eb=new Graph();for(var _0x39016c in _0x16a443){if(_0x16a443[_0x1a4c('0x21')](_0x39016c)){if(_[_0x1a4c('0x26')](_0x16a443[_0x39016c])){for(var _0x8083fc=0x0;_0x8083fc<_0x16a443[_0x39016c][_0x1a4c('0x27')];_0x8083fc+=0x1){addVertex(_0x2fc5eb,_0x16a443[_0x39016c][_0x8083fc],_0x39016c);}}else{addVertex(_0x2fc5eb,_0x16a443[_0x39016c],_0x39016c);}}}for(var _0x1ddbae=0x0;_0x1ddbae<_0x50157e[_0x1a4c('0x27')];_0x1ddbae+=0x1){if(_0x50157e[_0x1ddbae][_0x1a4c('0x28')]&&_0x50157e[_0x1ddbae][_0x1a4c('0x29')]){_0x2fc5eb[_0x1a4c('0x2a')](_0x50157e[_0x1ddbae]['source'],_0x50157e[_0x1ddbae][_0x1a4c('0x29')],_0x50157e[_0x1ddbae][_0x1a4c('0x2b')]);}}return _0x2fc5eb;}function getSquareProject(_0x340dbc,_0x59dd7d){rpc[_0x1a4c('0x2c')](_0x340dbc)[_0x1a4c('0x2d')](function(_0x255381){_0x59dd7d(null,_0x255381);})[_0x1a4c('0x2e')](function(_0x403a7f){_0x59dd7d(null,_0x403a7f);});}function createSquareReport(_0x466a6d,_0x4ec095){rpc['createSquareReport'](_0x466a6d)[_0x1a4c('0x2d')](function(_0x2b2f18){if(_0x4ec095){_0x4ec095(null,_0x2b2f18);}})[_0x1a4c('0x2e')](function(_0x325040){if(_0x4ec095){_0x4ec095(null,_0x325040);}});}function setChannelVariables(_0x30c135){for(var _0x4c5488 in _0x30c135){if(_0x30c135[_0x1a4c('0x21')](_0x4c5488)){if(_0x4c5488['indexOf'](_0x1a4c('0x2f'))===0x0){_0x30c135[_0x4c5488[_0x1a4c('0x30')](0x4)]=_0x30c135[_0x4c5488];delete _0x30c135[_0x4c5488];}}}}function getLogFromObject(_0x59e8bf){return util[_0x1a4c('0x31')](_0x59e8bf,{'showHidden':![],'depth':null});}function agiHandler(_0x5993cf){var _0x39fee2,_0x3f9e5e,_0x4cac2f,_0x59f857,_0x5dcd85;logger[_0x1a4c('0x32')](_0x1a4c('0x33'),JSON[_0x1a4c('0x34')](_0x5993cf,null,0x2));logger[_0x1a4c('0xf')](util[_0x1a4c('0x10')](_0x1a4c('0x35'),_0x5993cf[_0x1a4c('0x1a')],_0x5993cf['calleridname'],_0x5993cf[_0x1a4c('0x1b')],_0x5993cf[_0x1a4c('0x17')],_0x5993cf[_0x1a4c('0x18')]));_0x5993cf['on'](_0x1a4c('0x13'),errorHandler);_0x5993cf['on'](_0x1a4c('0x36'),closeHandler);_0x5993cf['on'](_0x1a4c('0x37'),timeoutHandler);_0x5993cf[_0x1a4c('0x1d')]=![];_0x5993cf['on'](_0x1a4c('0x38'),hangupHandler);var _0x222b20=getSquareProject['sync'](null,_0x5993cf[_0x1a4c('0x1a')]);if(_0x222b20){if(_0x222b20[_0x1a4c('0x39')]){_0x39fee2=getRoot(_0x222b20['production']);if(_0x39fee2&&_0x39fee2[_0x1a4c('0x3a')]){logger[_0x1a4c('0x32')](_0x1a4c('0x3b'),JSON[_0x1a4c('0x34')](_0x39fee2,null,0x2));_0x5993cf[_0x1a4c('0x3c')]=moment()[_0x1a4c('0x10')](_0x1a4c('0x3d'));_0x3f9e5e=initGraph(_[_0x1a4c('0x25')](_0x39fee2,'mxCell'),_0x39fee2[_0x1a4c('0x3e')]);_0x4cac2f=new Vertices(_0x5993cf,rpc,mailRpc);logger[_0x1a4c('0xf')](util[_0x1a4c('0x10')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5993cf[_0x1a4c('0x1a')],_0x5993cf[_0x1a4c('0x16')],_0x5993cf['callerid'],_0x5993cf[_0x1a4c('0x17')],_0x5993cf['uniqueid']));_0x3f9e5e[_0x1a4c('0x3f')](_0x39fee2['start']['id'],function(_0x41c358){try{_0x41c358=_0x4cac2f[_0x1a4c('0x40')](_0x41c358);logger[_0x1a4c('0x32')](_0x1a4c('0x41'),JSON[_0x1a4c('0x34')](_0x41c358,null,0x2));if(_0x41c358[_0x1a4c('0x20')]===_0x1a4c('0x42')){logger[_0x1a4c('0xf')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5993cf['context']=_0x41c358['context']||_0x5993cf[_0x1a4c('0x43')];_0x5993cf[_0x1a4c('0x44')]=_0x41c358[_0x1a4c('0x44')];_0x5993cf[_0x1a4c('0x45')]=_0x41c358[_0x1a4c('0x45')]?_0x41c358[_0x1a4c('0x45')]-0x1:0x1;return null;}else if(_0x41c358&&_0x4cac2f[_0x41c358['agicommand']]){_0x5dcd85=_0x4cac2f[_0x41c358[_0x1a4c('0x20')]](_0x41c358);logger[_0x1a4c('0xf')](_0x1a4c('0x46'),JSON['stringify'](_0x5dcd85,null,0x2));if(_0x5dcd85&&_0x5dcd85[_0x1a4c('0x47')]===AGI_CODE_SUCCESS&&_0x5dcd85[_0x1a4c('0x48')]!==AGI_RESULT_ERROR&&!_0x5993cf[_0x1a4c('0x1d')]){logger['debug']('response',getLogFromObject(_0x5dcd85));return _[_0x1a4c('0x49')](_0x5dcd85[_0x1a4c('0x48')])?null:_0x5dcd85[_0x1a4c('0x48')][_0x1a4c('0x4a')]();}else{logger['error'](_0x1a4c('0x46'),getLogFromObject(_0x5dcd85));return null;}}else{logger[_0x1a4c('0x13')]('agicommand\x20not\x20found');return null;}}catch(_0x22be5d){logger['error'](_0x22be5d['stack']);return null;}});if(_0x39fee2[_0x1a4c('0x4b')]){logger['info'](util[_0x1a4c('0x10')](_0x1a4c('0x4c'),_0x5993cf['arg_1'],_0x5993cf['calleridname'],_0x5993cf[_0x1a4c('0x1b')],_0x5993cf[_0x1a4c('0x17')],_0x5993cf[_0x1a4c('0x18')]));_0x3f9e5e[_0x1a4c('0x3f')](_0x39fee2[_0x1a4c('0x4b')]['id'],function(_0x4f3431){try{_0x4f3431=_0x4cac2f[_0x1a4c('0x40')](_0x4f3431);logger[_0x1a4c('0x32')](_0x1a4c('0x41'),JSON[_0x1a4c('0x34')](_0x4f3431,null,0x2));if(_0x4f3431&&_0x4cac2f[_0x4f3431[_0x1a4c('0x20')]]){_0x5dcd85=_0x4cac2f[_0x4f3431['agicommand']](_0x4f3431);if(_0x5dcd85){logger[_0x1a4c('0x32')](_0x1a4c('0x46'),getLogFromObject(_0x5dcd85));return _[_0x1a4c('0x49')](_0x5dcd85[_0x1a4c('0x48')])?null:_0x5dcd85[_0x1a4c('0x48')]['toString']();}else{logger[_0x1a4c('0x13')]('response',getLogFromObject(_0x5dcd85));return null;}}else{logger[_0x1a4c('0x13')]('agicommand\x20not\x20found');return null;}}catch(_0x2f1a84){logger['error'](_0x2f1a84[_0x1a4c('0xc')]);return null;}});}logger['info'](util[_0x1a4c('0x10')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5993cf[_0x1a4c('0x1a')],_0x5993cf[_0x1a4c('0x16')],_0x5993cf[_0x1a4c('0x1b')],_0x5993cf[_0x1a4c('0x17')],_0x5993cf['uniqueid']));logger[_0x1a4c('0xf')](util[_0x1a4c('0x10')](_0x1a4c('0x4d'),_0x5993cf[_0x1a4c('0x43')],_0x5993cf[_0x1a4c('0x44')],parseInt(_0x5993cf[_0x1a4c('0x45')],0xa)+0x1));_0x5993cf[_0x1a4c('0x4e')](_0x5993cf[_0x1a4c('0x43')],_0x5993cf['extension'],parseInt(_0x5993cf['priority'],0xa)+0x1);_0x5993cf[_0x1a4c('0x36')]();}}else{logger[_0x1a4c('0x13')](util[_0x1a4c('0x10')](_0x1a4c('0x4f'),_0x5993cf[_0x1a4c('0x1a')]));_0x5993cf[_0x1a4c('0x4e')](_0x5993cf[_0x1a4c('0x43')],_0x5993cf[_0x1a4c('0x44')],parseInt(_0x5993cf[_0x1a4c('0x45')],0xa)+0x1);_0x5993cf['close']();}}else{logger[_0x1a4c('0x13')](util[_0x1a4c('0x10')](_0x1a4c('0x50'),_0x5993cf[_0x1a4c('0x1a')]));_0x5993cf[_0x1a4c('0x4e')](_0x5993cf[_0x1a4c('0x43')],_0x5993cf[_0x1a4c('0x44')],parseInt(_0x5993cf['priority'],0xa)+0x1);_0x5993cf[_0x1a4c('0x36')]();}}function main(){var _0x5352e1;return utilLicense['getLicense']()['then'](function(_0x424b58){if(_0x424b58){if(_0x424b58[_0x1a4c('0x51')]){if(_0x424b58[_0x1a4c('0x52')]&&_0x424b58[_0x1a4c('0x52')]>0x0){logger['info'](util[_0x1a4c('0x10')](_0x1a4c('0x53'),_0x424b58[_0x1a4c('0x52')]));_0x5352e1=_0x424b58[_0x1a4c('0x52')];}else{logger[_0x1a4c('0xf')](_0x1a4c('0x54'));}}else{logger[_0x1a4c('0xf')](_0x1a4c('0x55'));_0x5352e1=-0x1;}}})[_0x1a4c('0x2e')](function(_0x4bb627){logger['error'](_0x1a4c('0x56'),_0x4bb627[_0x1a4c('0xc')]);})['finally'](function(){var _0x59ee7e=require(_0x1a4c('0x57'))(config['agi'][_0x1a4c('0xe')],config[_0x1a4c('0x9')]['ip'],_0x5352e1);_0x59ee7e['on']('error',errorHandler);_0x59ee7e['on']('listening',listeningHandler);_0x59ee7e['on']('connection',connectionHandler);_0x59ee7e['on']('close',closeHandler);});}main();
\ No newline at end of file