Built motion from commit 709aa6fb5ed03aa61bc373fcdbf622215d37d30b. Version 3.0.0...
[motion-next.git] / server / services / agi / index.js
index fe24981..9597235 100644 (file)
@@ -1 +1 @@
-const a1029_0x176d=['sync','toJson','result','dnid','isUndefined','log','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','response','traverseBFS','gotoc\x20block\x20stop\x20traverse\x20BFS','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','extension','../../config/environment','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand','indexOf','createSquareReport','127.0.0.1','uniqueid','mxCell','defaults','mxGraphModel','start','[ERROR]\x20%s','calleridname','addEdge','moment','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','isArray','substring','error','continueAt','../../globals','Project\x20%s\x20not\x20found','[LICENSE]\x20CHANNELS:\x20%s','resolve','source','info','Project\x20%s\x20not\x20published','maxRetry','inspect','then','voice','agicommand\x20not\x20found','./vertices','vertex','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','gotoc','[LICENSE]\x20CHANNELS:\x20UNLIMITED','omit','hangup','priority','lodash','arg_1','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','util','toString','callerid','undefined','[LICENSE]\x20VOICE\x20IS\x20DISABLED','production','agi','./mailRpc','debug','timeout','agi_','joinAt','target','format','../../config/logger','stringify','port','clear','YYYY-MM-DD\x20HH:mm:ss','callysquare','retry','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','message','close','length','catch','[%s]\x20%s','finally','context','value','name','evtHangup','./server','stack'];(function(_0x2bb233,_0x176d5b){const _0x565737=function(_0x4e15df){while(--_0x4e15df){_0x2bb233['push'](_0x2bb233['shift']());}};_0x565737(++_0x176d5b);}(a1029_0x176d,0x14b));const a1029_0x5657=function(_0x2bb233,_0x176d5b){_0x2bb233=_0x2bb233-0x0;let _0x565737=a1029_0x176d[_0x2bb233];return _0x565737;};const _0x2d5dc3=a1029_0x5657;'use strict';require(_0x2d5dc3('0x3d'));const parser=require('xml2json'),_=require(_0x2d5dc3('0x51')),util=require(_0x2d5dc3('0x55')),moment=require(_0x2d5dc3('0x37')),config=require(_0x2d5dc3('0x29')),logger=require(_0x2d5dc3('0x9'))(_0x2d5dc3('0x1')),utilLicense=require('../../config/license/util'),rpc=require('./rpc'),mailRpc=require(_0x2d5dc3('0x2')),Graph=require('./graph'),Vertices=require(_0x2d5dc3('0x49')),AGI_CODE_SUCCESS=0xc8,AGI_RESULT_ERROR=-0x1;config[_0x2d5dc3('0x1')]=_[_0x2d5dc3('0x31')](config[_0x2d5dc3('0x1')],{'ip':_0x2d5dc3('0x2e'),'port':0x11dd});async function connectionHandler(_0x4e15df){try{await setChannelVariables(_0x4e15df),await agiHandler(_0x4e15df);}catch(_0xbab027){logger['error'](_0xbab027['stack']);}}function listeningHandler(){const _0x15c3ce=_0x2d5dc3;console[_0x15c3ce('0x22')](_0x15c3ce('0x10'),config[_0x15c3ce('0x1')][_0x15c3ce('0xb')]),logger['info'](util['format'](_0x15c3ce('0x4b'),config[_0x15c3ce('0x1')]['ip'],config[_0x15c3ce('0x1')][_0x15c3ce('0xb')]));}function errorHandler(_0x500d88){const _0x1ac31b=_0x2d5dc3;_0x500d88&&_0x500d88[_0x1ac31b('0x19')]&&_0x500d88[_0x1ac31b('0x11')]?logger['error'](util[_0x1ac31b('0x8')](_0x1ac31b('0x15'),_0x500d88[_0x1ac31b('0x19')],_0x500d88[_0x1ac31b('0x11')])):logger[_0x1ac31b('0x3b')](util[_0x1ac31b('0x8')](_0x1ac31b('0x34'),_0x500d88[_0x1ac31b('0x1c')]));}function closeHandler(){const _0x58576c=_0x2d5dc3;logger[_0x58576c('0x42')](util[_0x58576c('0x8')](_0x58576c('0x27'),this[_0x58576c('0x52')],this['calleridname'],this[_0x58576c('0x57')],this[_0x58576c('0x20')],this[_0x58576c('0x2f')]));try{createSquareReport(this);}catch(_0x2f3d93){logger[_0x58576c('0x3b')](_0x2f3d93['stack']);}}function timeoutHandler(){const _0x27bb4f=_0x2d5dc3;logger[_0x27bb4f('0x42')](util['format'](_0x27bb4f('0x54'),this[_0x27bb4f('0x52')],this[_0x27bb4f('0x35')],this[_0x27bb4f('0x57')],this[_0x27bb4f('0x20')],this[_0x27bb4f('0x2f')]));}function hangupHandler(){const _0x2e26ee=_0x2d5dc3;logger[_0x2e26ee('0x42')](util['format'](_0x2e26ee('0x23'),this[_0x2e26ee('0x52')],this[_0x2e26ee('0x35')],this[_0x2e26ee('0x57')],this['dnid'],this[_0x2e26ee('0x2f')])),this[_0x2e26ee('0x1a')]=!![];}function getRoot(_0x485045){const _0x3a60f3=_0x2d5dc3;return parser[_0x3a60f3('0x1e')](_0x485045,{'object':!![]})[_0x3a60f3('0x32')]['root'];}function addVertex(_0x3e24f4,_0x416d68,_0x85c668){const _0x4f2f8f=_0x2d5dc3;_0x416d68[_0x4f2f8f('0x2b')]=_0x85c668,typeof _0x416d68['retry']!==_0x4f2f8f('0x58')&&(_0x416d68[_0x4f2f8f('0x44')]=parseInt(_0x416d68[_0x4f2f8f('0xf')],0xa)),_0x3e24f4['addVertex'](_[_0x4f2f8f('0x4e')](_0x416d68,_0x4f2f8f('0x30')));}function initGraph(_0x320481,_0x517ffd){const _0x1aeeec=_0x2d5dc3,_0x284db4=new Graph();for(const _0x36b1ca in _0x320481){if(typeof _0x320481[_0x36b1ca]!==_0x1aeeec('0x58')){if(_[_0x1aeeec('0x39')](_0x320481[_0x36b1ca]))for(let _0x24935a=0x0;_0x24935a<_0x320481[_0x36b1ca][_0x1aeeec('0x13')];_0x24935a+=0x1){addVertex(_0x284db4,_0x320481[_0x36b1ca][_0x24935a],_0x36b1ca);}else addVertex(_0x284db4,_0x320481[_0x36b1ca],_0x36b1ca);}}for(let _0x153a73=0x0;_0x153a73<_0x517ffd[_0x1aeeec('0x13')];_0x153a73+=0x1){_0x517ffd[_0x153a73][_0x1aeeec('0x41')]&&_0x517ffd[_0x153a73][_0x1aeeec('0x7')]&&_0x284db4[_0x1aeeec('0x36')](_0x517ffd[_0x153a73][_0x1aeeec('0x41')],_0x517ffd[_0x153a73][_0x1aeeec('0x7')],_0x517ffd[_0x153a73][_0x1aeeec('0x18')]);}return _0x284db4;}function getSquareProject(_0x5d8652,_0x70c81f){const _0x284694=_0x2d5dc3;rpc['getSquareProject'](_0x5d8652)[_0x284694('0x46')](function(_0x1b8dd3){_0x70c81f(null,_0x1b8dd3);})[_0x284694('0x14')](function(_0x11af75){_0x70c81f(null,_0x11af75);});}function createSquareReport(_0x32b507,_0x2f5f4e){const _0x1d13a8=_0x2d5dc3;rpc[_0x1d13a8('0x2d')](_0x32b507)[_0x1d13a8('0x46')](function(_0x8e8901){_0x2f5f4e&&_0x2f5f4e(null,_0x8e8901);})['catch'](function(_0x8a95ec){_0x2f5f4e&&_0x2f5f4e(null,_0x8a95ec);});}async function setChannelVariables(_0x473404){const _0x210769=_0x2d5dc3;for(const _0x2a815b in _0x473404){typeof _0x473404[_0x2a815b]!==_0x210769('0x58')&&(_0x2a815b[_0x210769('0x2c')](_0x210769('0x5'))===0x0&&(_0x473404[_0x2a815b[_0x210769('0x3a')](0x4)]=_0x473404[_0x2a815b],delete _0x473404[_0x2a815b]));}return Promise['resolve'](_0x473404);}function getLogFromObject(_0x381451){const _0x2809c6=_0x2d5dc3;return util[_0x2809c6('0x45')](_0x381451,{'showHidden':![],'depth':null});}async function agiHandler(_0x2f0aa7){const _0x2a0aa7=_0x2d5dc3;let _0x326e87,_0x30c30e,_0x2083ca,_0x492811;logger[_0x2a0aa7('0x3')]('variables',JSON[_0x2a0aa7('0xa')](_0x2f0aa7,null,0x2)),logger[_0x2a0aa7('0x42')](util[_0x2a0aa7('0x8')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2f0aa7[_0x2a0aa7('0x52')],_0x2f0aa7[_0x2a0aa7('0x35')],_0x2f0aa7['callerid'],_0x2f0aa7[_0x2a0aa7('0x20')],_0x2f0aa7[_0x2a0aa7('0x2f')])),_0x2f0aa7['on'](_0x2a0aa7('0x3b'),errorHandler),_0x2f0aa7['on'](_0x2a0aa7('0x12'),closeHandler),_0x2f0aa7['on'](_0x2a0aa7('0x4'),timeoutHandler),_0x2f0aa7[_0x2a0aa7('0x1a')]=![],_0x2f0aa7['on'](_0x2a0aa7('0x4f'),hangupHandler);const _0xb38f4=getSquareProject[_0x2a0aa7('0x1d')](null,_0x2f0aa7[_0x2a0aa7('0x52')]);return _0xb38f4?_0xb38f4[_0x2a0aa7('0x0')]?(_0x326e87=getRoot(_0xb38f4[_0x2a0aa7('0x0')]),_0x326e87&&_0x326e87[_0x2a0aa7('0x33')]&&(logger['debug']('root',JSON['stringify'](_0x326e87,null,0x2)),_0x2f0aa7[_0x2a0aa7('0x6')]=moment()['format'](_0x2a0aa7('0xd')),_0x30c30e=initGraph(_['omit'](_0x326e87,'mxCell'),_0x326e87[_0x2a0aa7('0x30')]),_0x2083ca=new Vertices(_0x2f0aa7,rpc,mailRpc),logger[_0x2a0aa7('0x42')](util[_0x2a0aa7('0x8')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2f0aa7['arg_1'],_0x2f0aa7[_0x2a0aa7('0x35')],_0x2f0aa7[_0x2a0aa7('0x57')],_0x2f0aa7[_0x2a0aa7('0x20')],_0x2f0aa7[_0x2a0aa7('0x2f')])),_0x30c30e[_0x2a0aa7('0x25')](_0x326e87[_0x2a0aa7('0x33')]['id'],function(_0x57727e){const _0x269138=_0x2a0aa7;try{_0x57727e=_0x2083ca[_0x269138('0xc')](_0x57727e),logger[_0x269138('0x3')]('vertex',JSON[_0x269138('0xa')](_0x57727e,null,0x2));if(_0x57727e['agicommand']===_0x269138('0x4c'))return logger[_0x269138('0x42')](_0x269138('0x26')),_0x2f0aa7[_0x269138('0x17')]=_0x57727e['context']||_0x2f0aa7[_0x269138('0x17')],_0x2f0aa7[_0x269138('0x28')]=_0x57727e[_0x269138('0x28')],_0x2f0aa7['priority']=_0x57727e[_0x269138('0x50')]?_0x57727e[_0x269138('0x50')]-0x1:0x1,null;else return _0x57727e&&_0x2083ca[_0x57727e['agicommand']]?(_0x492811=_0x2083ca[_0x57727e[_0x269138('0x2b')]](_0x57727e),logger[_0x269138('0x42')](_0x269138('0x24'),JSON[_0x269138('0xa')](_0x492811,null,0x2)),_0x492811&&_0x492811['code']===AGI_CODE_SUCCESS&&_0x492811[_0x269138('0x1f')]!==AGI_RESULT_ERROR&&!_0x2f0aa7[_0x269138('0x1a')]?(logger[_0x269138('0x3')]('response',getLogFromObject(_0x492811)),_['isUndefined'](_0x492811[_0x269138('0x1f')])?null:_0x492811[_0x269138('0x1f')][_0x269138('0x56')]()):(logger['error'](_0x269138('0x24'),getLogFromObject(_0x492811)),null)):(logger['error'](_0x269138('0x48')),null);}catch(_0xde89f2){return logger[_0x269138('0x3b')](_0xde89f2[_0x269138('0x1c')]),null;}}),_0x326e87['finally']&&(logger['info'](util[_0x2a0aa7('0x8')](_0x2a0aa7('0x2a'),_0x2f0aa7['arg_1'],_0x2f0aa7[_0x2a0aa7('0x35')],_0x2f0aa7[_0x2a0aa7('0x57')],_0x2f0aa7[_0x2a0aa7('0x20')],_0x2f0aa7[_0x2a0aa7('0x2f')])),_0x30c30e[_0x2a0aa7('0x25')](_0x326e87[_0x2a0aa7('0x16')]['id'],function(_0x4229c7){const _0x333348=_0x2a0aa7;try{return _0x4229c7=_0x2083ca['clear'](_0x4229c7),logger[_0x333348('0x3')](_0x333348('0x4a'),JSON[_0x333348('0xa')](_0x4229c7,null,0x2)),_0x4229c7&&_0x2083ca[_0x4229c7[_0x333348('0x2b')]]?(_0x492811=_0x2083ca[_0x4229c7['agicommand']](_0x4229c7),_0x492811?(logger[_0x333348('0x3')](_0x333348('0x24'),getLogFromObject(_0x492811)),_[_0x333348('0x21')](_0x492811[_0x333348('0x1f')])?null:_0x492811[_0x333348('0x1f')][_0x333348('0x56')]()):(logger[_0x333348('0x3b')]('response',getLogFromObject(_0x492811)),null)):(logger[_0x333348('0x3b')](_0x333348('0x48')),null);}catch(_0x3cfd21){return logger[_0x333348('0x3b')](_0x3cfd21[_0x333348('0x1c')]),null;}})),logger['info'](util[_0x2a0aa7('0x8')](_0x2a0aa7('0x53'),_0x2f0aa7[_0x2a0aa7('0x52')],_0x2f0aa7[_0x2a0aa7('0x35')],_0x2f0aa7[_0x2a0aa7('0x57')],_0x2f0aa7[_0x2a0aa7('0x20')],_0x2f0aa7[_0x2a0aa7('0x2f')])),logger[_0x2a0aa7('0x42')](util[_0x2a0aa7('0x8')](_0x2a0aa7('0x38'),_0x2f0aa7[_0x2a0aa7('0x17')],_0x2f0aa7[_0x2a0aa7('0x28')],parseInt(_0x2f0aa7[_0x2a0aa7('0x50')],0xa)+0x1)),_0x2f0aa7[_0x2a0aa7('0x3c')](_0x2f0aa7[_0x2a0aa7('0x17')],_0x2f0aa7[_0x2a0aa7('0x28')],parseInt(_0x2f0aa7['priority'],0xa)+0x1),_0x2f0aa7[_0x2a0aa7('0x12')]())):(logger[_0x2a0aa7('0x3b')](util[_0x2a0aa7('0x8')](_0x2a0aa7('0x43'),_0x2f0aa7[_0x2a0aa7('0x52')])),_0x2f0aa7[_0x2a0aa7('0x3c')](_0x2f0aa7[_0x2a0aa7('0x17')],_0x2f0aa7[_0x2a0aa7('0x28')],parseInt(_0x2f0aa7[_0x2a0aa7('0x50')],0xa)+0x1),_0x2f0aa7[_0x2a0aa7('0x12')]()):(logger['error'](util[_0x2a0aa7('0x8')](_0x2a0aa7('0x3e'),_0x2f0aa7[_0x2a0aa7('0x52')])),_0x2f0aa7['continueAt'](_0x2f0aa7[_0x2a0aa7('0x17')],_0x2f0aa7['extension'],parseInt(_0x2f0aa7[_0x2a0aa7('0x50')],0xa)+0x1),_0x2f0aa7[_0x2a0aa7('0x12')]()),Promise[_0x2a0aa7('0x40')]();}function main(){const _0x2290a6=_0x2d5dc3;let _0x1caebd;return utilLicense['getLicense']()['then'](function(_0xf55e76){const _0x38fb3c=a1029_0x5657;_0xf55e76&&(_0xf55e76[_0x38fb3c('0x47')]?_0xf55e76[_0x38fb3c('0xe')]&&_0xf55e76[_0x38fb3c('0xe')]>0x0?(logger[_0x38fb3c('0x42')](util[_0x38fb3c('0x8')](_0x38fb3c('0x3f'),_0xf55e76[_0x38fb3c('0xe')])),_0x1caebd=_0xf55e76['callysquare']):logger[_0x38fb3c('0x42')](_0x38fb3c('0x4d')):(logger[_0x38fb3c('0x42')](_0x38fb3c('0x59')),_0x1caebd=-0x1));})[_0x2290a6('0x14')](function(_0x301d5e){const _0x19cd5e=_0x2290a6;logger[_0x19cd5e('0x3b')]('[LICENSE]',_0x301d5e[_0x19cd5e('0x1c')]);})['finally'](function(){const _0x35c34d=_0x2290a6,_0xa9a2dd=require(_0x35c34d('0x1b'))(config[_0x35c34d('0x1')][_0x35c34d('0xb')],config[_0x35c34d('0x1')]['ip'],_0x1caebd);_0xa9a2dd['on'](_0x35c34d('0x3b'),errorHandler),_0xa9a2dd['on']('listening',listeningHandler),_0xa9a2dd['on']('connection',connectionHandler),_0xa9a2dd['on']('close',closeHandler);});}main();
\ No newline at end of file
+const a1029_0x132b=['result','evtHangup','connection','agicommand\x20not\x20found','createSquareReport','code','toString','finally','hangup','Project\x20%s\x20not\x20found','lodash','uniqueid','root','extension','127.0.0.1','calleridname','value','agicommand','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','../../globals','voice','defaults','timeout','traverseBFS','getLicense','response','Project\x20%s\x20not\x20published','maxRetry','gotoc','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','port','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','xml2json','format','omit','toJson','dnid','callysquare','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','YYYY-MM-DD\x20HH:mm:ss','context','./rpc','[%s]\x20%s','name','resolve','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','mxCell','addEdge','arg_1','agi','variables','continueAt','vertex','[LICENSE]\x20VOICE\x20IS\x20DISABLED','substring','../../config/environment','util','../../config/logger','mxGraphModel','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','start','stack','[LICENSE]\x20CHANNELS:\x20%s','catch','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','source','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','listening','gotoc\x20block\x20stop\x20traverse\x20BFS','inspect','message','addVertex','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[ERROR]\x20%s','target','stringify','clear','./mailRpc','./graph','production','undefined','moment','../../config/license/util','then','error','./vertices','debug','retry','priority','joinAt','length','[LICENSE]','close'];(function(_0x9da406,_0x132bac){const _0x422418=function(_0x15c99e){while(--_0x15c99e){_0x9da406['push'](_0x9da406['shift']());}};_0x422418(++_0x132bac);}(a1029_0x132b,0xfa));const a1029_0x4224=function(_0x9da406,_0x132bac){_0x9da406=_0x9da406-0x0;let _0x422418=a1029_0x132b[_0x9da406];return _0x422418;};const _0x4a3a54=a1029_0x4224;'use strict';require(_0x4a3a54('0x3c'));const parser=require(_0x4a3a54('0x4a')),_=require(_0x4a3a54('0x33')),util=require(_0x4a3a54('0x3')),moment=require(_0x4a3a54('0x1d')),config=require(_0x4a3a54('0x2')),logger=require(_0x4a3a54('0x4'))(_0x4a3a54('0x5d')),utilLicense=require(_0x4a3a54('0x1e')),rpc=require(_0x4a3a54('0x53')),mailRpc=require(_0x4a3a54('0x19')),Graph=require(_0x4a3a54('0x1a')),Vertices=require(_0x4a3a54('0x21')),AGI_CODE_SUCCESS=0xc8,AGI_RESULT_ERROR=-0x1;config[_0x4a3a54('0x5d')]=_[_0x4a3a54('0x3e')](config[_0x4a3a54('0x5d')],{'ip':_0x4a3a54('0x37'),'port':0x11dd});async function connectionHandler(_0x15c99e){const _0x535087=_0x4a3a54;try{await setChannelVariables(_0x15c99e),await agiHandler(_0x15c99e);}catch(_0x41d094){logger[_0x535087('0x20')](_0x41d094[_0x535087('0x8')]);}}function listeningHandler(){const _0x3f3c59=_0x4a3a54;console['log'](_0x3f3c59('0x58'),config[_0x3f3c59('0x5d')][_0x3f3c59('0x47')]),logger[_0x3f3c59('0x59')](util['format'](_0x3f3c59('0x57'),config[_0x3f3c59('0x5d')]['ip'],config[_0x3f3c59('0x5d')][_0x3f3c59('0x47')]));}function errorHandler(_0xc34926){const _0x2bc886=_0x4a3a54;_0xc34926&&_0xc34926[_0x2bc886('0x55')]&&_0xc34926[_0x2bc886('0x11')]?logger[_0x2bc886('0x20')](util[_0x2bc886('0x4b')](_0x2bc886('0x54'),_0xc34926[_0x2bc886('0x55')],_0xc34926['message'])):logger[_0x2bc886('0x20')](util[_0x2bc886('0x4b')](_0x2bc886('0x15'),_0xc34926[_0x2bc886('0x8')]));}function closeHandler(){const _0x485f13=_0x4a3a54;logger[_0x485f13('0x59')](util[_0x485f13('0x4b')](_0x485f13('0x6'),this[_0x485f13('0x5c')],this[_0x485f13('0x38')],this[_0x485f13('0x13')],this[_0x485f13('0x4e')],this[_0x485f13('0x34')]));try{createSquareReport(this);}catch(_0x1d3293){logger[_0x485f13('0x20')](_0x1d3293['stack']);}}function timeoutHandler(){const _0x60ebdc=_0x4a3a54;logger[_0x60ebdc('0x59')](util[_0x60ebdc('0x4b')](_0x60ebdc('0x46'),this['arg_1'],this[_0x60ebdc('0x38')],this[_0x60ebdc('0x13')],this[_0x60ebdc('0x4e')],this['uniqueid']));}function hangupHandler(){const _0x45c6ee=_0x4a3a54;logger[_0x45c6ee('0x59')](util[_0x45c6ee('0x4b')](_0x45c6ee('0x14'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x45c6ee('0x4e')],this[_0x45c6ee('0x34')])),this[_0x45c6ee('0x2a')]=!![];}function getRoot(_0x4a22c6){const _0x97f82=_0x4a3a54;return parser[_0x97f82('0x4d')](_0x4a22c6,{'object':!![]})[_0x97f82('0x5')][_0x97f82('0x35')];}function addVertex(_0x412b75,_0x5def41,_0x58c24d){const _0x362588=_0x4a3a54;_0x5def41['agicommand']=_0x58c24d,typeof _0x5def41[_0x362588('0x23')]!==_0x362588('0x1c')&&(_0x5def41[_0x362588('0x44')]=parseInt(_0x5def41[_0x362588('0x23')],0xa)),_0x412b75[_0x362588('0x12')](_[_0x362588('0x4c')](_0x5def41,_0x362588('0x5a')));}function initGraph(_0x5826df,_0xa0a671){const _0x2e8d69=_0x4a3a54,_0xa0526b=new Graph();for(const _0x32061a in _0x5826df){if(typeof _0x5826df[_0x32061a]!==_0x2e8d69('0x1c')){if(_['isArray'](_0x5826df[_0x32061a]))for(let _0x5c21d5=0x0;_0x5c21d5<_0x5826df[_0x32061a][_0x2e8d69('0x26')];_0x5c21d5+=0x1){addVertex(_0xa0526b,_0x5826df[_0x32061a][_0x5c21d5],_0x32061a);}else addVertex(_0xa0526b,_0x5826df[_0x32061a],_0x32061a);}}for(let _0x11b678=0x0;_0x11b678<_0xa0a671[_0x2e8d69('0x26')];_0x11b678+=0x1){_0xa0a671[_0x11b678][_0x2e8d69('0xc')]&&_0xa0a671[_0x11b678]['target']&&_0xa0526b[_0x2e8d69('0x5b')](_0xa0a671[_0x11b678][_0x2e8d69('0xc')],_0xa0a671[_0x11b678][_0x2e8d69('0x16')],_0xa0a671[_0x11b678][_0x2e8d69('0x39')]);}return _0xa0526b;}function getSquareProject(_0x2d4364,_0x1b83f8){const _0x1902d4=_0x4a3a54;rpc['getSquareProject'](_0x2d4364)[_0x1902d4('0x1f')](function(_0x34a4ff){_0x1b83f8(null,_0x34a4ff);})[_0x1902d4('0xa')](function(_0x4c149c){_0x1b83f8(null,_0x4c149c);});}function createSquareReport(_0x286b24,_0x37d068){const _0xfc16ae=_0x4a3a54;rpc[_0xfc16ae('0x2d')](_0x286b24)[_0xfc16ae('0x1f')](function(_0x5bbaef){_0x37d068&&_0x37d068(null,_0x5bbaef);})[_0xfc16ae('0xa')](function(_0xec08f4){_0x37d068&&_0x37d068(null,_0xec08f4);});}async function setChannelVariables(_0x9f1424){const _0x443522=_0x4a3a54;for(const _0x18e3e8 in _0x9f1424){typeof _0x9f1424[_0x18e3e8]!=='undefined'&&(_0x18e3e8['indexOf']('agi_')===0x0&&(_0x9f1424[_0x18e3e8[_0x443522('0x1')](0x4)]=_0x9f1424[_0x18e3e8],delete _0x9f1424[_0x18e3e8]));}return Promise[_0x443522('0x56')](_0x9f1424);}function getLogFromObject(_0x411b10){const _0x2e9f45=_0x4a3a54;return util[_0x2e9f45('0x10')](_0x411b10,{'showHidden':![],'depth':null});}async function agiHandler(_0xf728f){const _0x2e66d5=_0x4a3a54;let _0x35530b,_0x4f525e,_0x41073c,_0x3e0b10;logger[_0x2e66d5('0x22')](_0x2e66d5('0x5e'),JSON[_0x2e66d5('0x17')](_0xf728f,null,0x2)),logger[_0x2e66d5('0x59')](util['format'](_0x2e66d5('0x3b'),_0xf728f[_0x2e66d5('0x5c')],_0xf728f[_0x2e66d5('0x38')],_0xf728f['callerid'],_0xf728f[_0x2e66d5('0x4e')],_0xf728f['uniqueid'])),_0xf728f['on'](_0x2e66d5('0x20'),errorHandler),_0xf728f['on']('close',closeHandler),_0xf728f['on'](_0x2e66d5('0x3f'),timeoutHandler),_0xf728f[_0x2e66d5('0x2a')]=![],_0xf728f['on'](_0x2e66d5('0x31'),hangupHandler);const _0xbf5abc=getSquareProject['sync'](null,_0xf728f['arg_1']);return _0xbf5abc?_0xbf5abc[_0x2e66d5('0x1b')]?(_0x35530b=getRoot(_0xbf5abc[_0x2e66d5('0x1b')]),_0x35530b&&_0x35530b[_0x2e66d5('0x7')]&&(logger[_0x2e66d5('0x22')]('root',JSON[_0x2e66d5('0x17')](_0x35530b,null,0x2)),_0xf728f[_0x2e66d5('0x25')]=moment()[_0x2e66d5('0x4b')](_0x2e66d5('0x51')),_0x4f525e=initGraph(_['omit'](_0x35530b,'mxCell'),_0x35530b[_0x2e66d5('0x5a')]),_0x41073c=new Vertices(_0xf728f,rpc,mailRpc),logger['info'](util[_0x2e66d5('0x4b')](_0x2e66d5('0x50'),_0xf728f[_0x2e66d5('0x5c')],_0xf728f[_0x2e66d5('0x38')],_0xf728f[_0x2e66d5('0x13')],_0xf728f[_0x2e66d5('0x4e')],_0xf728f[_0x2e66d5('0x34')])),_0x4f525e[_0x2e66d5('0x40')](_0x35530b[_0x2e66d5('0x7')]['id'],function(_0x4e9271){const _0x1283f1=_0x2e66d5;try{_0x4e9271=_0x41073c['clear'](_0x4e9271),logger[_0x1283f1('0x22')](_0x1283f1('0x60'),JSON['stringify'](_0x4e9271,null,0x2));if(_0x4e9271[_0x1283f1('0x3a')]===_0x1283f1('0x45'))return logger[_0x1283f1('0x59')](_0x1283f1('0xf')),_0xf728f['context']=_0x4e9271[_0x1283f1('0x52')]||_0xf728f[_0x1283f1('0x52')],_0xf728f['extension']=_0x4e9271[_0x1283f1('0x36')],_0xf728f['priority']=_0x4e9271[_0x1283f1('0x24')]?_0x4e9271[_0x1283f1('0x24')]-0x1:0x1,null;else return _0x4e9271&&_0x41073c[_0x4e9271['agicommand']]?(_0x3e0b10=_0x41073c[_0x4e9271[_0x1283f1('0x3a')]](_0x4e9271),logger[_0x1283f1('0x59')](_0x1283f1('0x42'),JSON[_0x1283f1('0x17')](_0x3e0b10,null,0x2)),_0x3e0b10&&_0x3e0b10[_0x1283f1('0x2e')]===AGI_CODE_SUCCESS&&_0x3e0b10[_0x1283f1('0x29')]!==AGI_RESULT_ERROR&&!_0xf728f[_0x1283f1('0x2a')]?(logger[_0x1283f1('0x22')](_0x1283f1('0x42'),getLogFromObject(_0x3e0b10)),_['isUndefined'](_0x3e0b10[_0x1283f1('0x29')])?null:_0x3e0b10[_0x1283f1('0x29')][_0x1283f1('0x2f')]()):(logger['error']('response',getLogFromObject(_0x3e0b10)),null)):(logger[_0x1283f1('0x20')](_0x1283f1('0x2c')),null);}catch(_0x525dad){return logger[_0x1283f1('0x20')](_0x525dad[_0x1283f1('0x8')]),null;}}),_0x35530b[_0x2e66d5('0x30')]&&(logger[_0x2e66d5('0x59')](util[_0x2e66d5('0x4b')](_0x2e66d5('0xd'),_0xf728f['arg_1'],_0xf728f[_0x2e66d5('0x38')],_0xf728f['callerid'],_0xf728f[_0x2e66d5('0x4e')],_0xf728f[_0x2e66d5('0x34')])),_0x4f525e['traverseBFS'](_0x35530b[_0x2e66d5('0x30')]['id'],function(_0x251b84){const _0x15bf8c=_0x2e66d5;try{return _0x251b84=_0x41073c[_0x15bf8c('0x18')](_0x251b84),logger['debug'](_0x15bf8c('0x60'),JSON[_0x15bf8c('0x17')](_0x251b84,null,0x2)),_0x251b84&&_0x41073c[_0x251b84[_0x15bf8c('0x3a')]]?(_0x3e0b10=_0x41073c[_0x251b84[_0x15bf8c('0x3a')]](_0x251b84),_0x3e0b10?(logger['debug'](_0x15bf8c('0x42'),getLogFromObject(_0x3e0b10)),_['isUndefined'](_0x3e0b10[_0x15bf8c('0x29')])?null:_0x3e0b10[_0x15bf8c('0x29')]['toString']()):(logger['error'](_0x15bf8c('0x42'),getLogFromObject(_0x3e0b10)),null)):(logger[_0x15bf8c('0x20')](_0x15bf8c('0x2c')),null);}catch(_0x2f7f10){return logger['error'](_0x2f7f10[_0x15bf8c('0x8')]),null;}})),logger[_0x2e66d5('0x59')](util[_0x2e66d5('0x4b')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xf728f[_0x2e66d5('0x5c')],_0xf728f[_0x2e66d5('0x38')],_0xf728f[_0x2e66d5('0x13')],_0xf728f['dnid'],_0xf728f[_0x2e66d5('0x34')])),logger[_0x2e66d5('0x59')](util[_0x2e66d5('0x4b')](_0x2e66d5('0xb'),_0xf728f['context'],_0xf728f[_0x2e66d5('0x36')],parseInt(_0xf728f[_0x2e66d5('0x24')],0xa)+0x1)),_0xf728f[_0x2e66d5('0x5f')](_0xf728f[_0x2e66d5('0x52')],_0xf728f[_0x2e66d5('0x36')],parseInt(_0xf728f['priority'],0xa)+0x1),_0xf728f[_0x2e66d5('0x28')]())):(logger[_0x2e66d5('0x20')](util[_0x2e66d5('0x4b')](_0x2e66d5('0x43'),_0xf728f['arg_1'])),_0xf728f[_0x2e66d5('0x5f')](_0xf728f['context'],_0xf728f['extension'],parseInt(_0xf728f['priority'],0xa)+0x1),_0xf728f[_0x2e66d5('0x28')]()):(logger[_0x2e66d5('0x20')](util[_0x2e66d5('0x4b')](_0x2e66d5('0x32'),_0xf728f[_0x2e66d5('0x5c')])),_0xf728f[_0x2e66d5('0x5f')](_0xf728f['context'],_0xf728f[_0x2e66d5('0x36')],parseInt(_0xf728f[_0x2e66d5('0x24')],0xa)+0x1),_0xf728f[_0x2e66d5('0x28')]()),Promise[_0x2e66d5('0x56')]();}function main(){const _0x5e2cbc=_0x4a3a54;let _0x2a1465;return utilLicense[_0x5e2cbc('0x41')]()[_0x5e2cbc('0x1f')](function(_0x1caeb8){const _0xb83d2b=_0x5e2cbc;_0x1caeb8&&(_0x1caeb8[_0xb83d2b('0x3d')]?_0x1caeb8[_0xb83d2b('0x4f')]&&_0x1caeb8[_0xb83d2b('0x4f')]>0x0?(logger[_0xb83d2b('0x59')](util['format'](_0xb83d2b('0x9'),_0x1caeb8[_0xb83d2b('0x4f')])),_0x2a1465=_0x1caeb8['callysquare']):logger['info'](_0xb83d2b('0x48')):(logger['info'](_0xb83d2b('0x0')),_0x2a1465=-0x1));})[_0x5e2cbc('0xa')](function(_0x7fa775){const _0x738bc9=_0x5e2cbc;logger[_0x738bc9('0x20')](_0x738bc9('0x27'),_0x7fa775[_0x738bc9('0x8')]);})[_0x5e2cbc('0x30')](function(){const _0x408f4c=_0x5e2cbc,_0x524516=require(_0x408f4c('0x49'))(config[_0x408f4c('0x5d')][_0x408f4c('0x47')],config[_0x408f4c('0x5d')]['ip'],_0x2a1465);_0x524516['on']('error',errorHandler),_0x524516['on'](_0x408f4c('0xe'),listeningHandler),_0x524516['on'](_0x408f4c('0x2b'),connectionHandler),_0x524516['on'](_0x408f4c('0x28'),closeHandler);});}main();
\ No newline at end of file