Built motion from commit (unavailable).|2.4.11
[motion2.git] / server / services / agi / index.js
index 1298597..839d1cd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x826a=['message','[%s]\x20%s','info','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','indexOf','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','sync','production','start','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','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','vertex','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','close','Project\x20%s\x20not\x20found','getLicense','then','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','connection','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','name'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x826a,0x1aa));var _0xa826=function(_0x2eab3d,_0x48cb77){_0x2eab3d=_0x2eab3d-0x0;var _0x559a8c=_0x826a[_0x2eab3d];return _0x559a8c;};'use strict';var parser=require('xml2json');var _=require(_0xa826('0x0'));var syncho=require('syncho');var util=require(_0xa826('0x1'));var moment=require('moment');var config=require(_0xa826('0x2'));var logger=require(_0xa826('0x3'))(_0xa826('0x4'));var utilLicense=require(_0xa826('0x5'));var rpc=require('./rpc');var mailRpc=require(_0xa826('0x6'));var Graph=require(_0xa826('0x7'));var Vertices=require(_0xa826('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa826('0x4')]=_[_0xa826('0x9')](config[_0xa826('0x4')],{'ip':_0xa826('0xa'),'port':0x11dd});function connectionHandler(_0x14c2ba){process[_0xa826('0xb')](function(){syncho(function(){try{setChannelVariables(_0x14c2ba);agiHandler(_0x14c2ba);}catch(_0x428c70){logger[_0xa826('0xc')](_0x428c70[_0xa826('0xd')]);}});});}function listeningHandler(){console[_0xa826('0xe')](_0xa826('0xf'),config[_0xa826('0x4')][_0xa826('0x10')]);logger['info'](util[_0xa826('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xa826('0x4')]['ip'],config[_0xa826('0x4')][_0xa826('0x10')]));}function errorHandler(_0xa55bd7){if(_0xa55bd7&&_0xa55bd7[_0xa826('0x12')]&&_0xa55bd7[_0xa826('0x13')]){logger[_0xa826('0xc')](util['format'](_0xa826('0x14'),_0xa55bd7['name'],_0xa55bd7[_0xa826('0x13')]));}else{logger[_0xa826('0xc')](util['format']('[ERROR]\x20%s',_0xa55bd7['stack']));}}function closeHandler(){logger[_0xa826('0x15')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa826('0x16')],this[_0xa826('0x17')],this[_0xa826('0x18')],this['dnid'],this[_0xa826('0x19')]));try{createSquareReport(this);}catch(_0x312e14){logger[_0xa826('0xc')](_0x312e14[_0xa826('0xd')]);}}function timeoutHandler(){logger[_0xa826('0x15')](util['format'](_0xa826('0x1a'),this[_0xa826('0x16')],this[_0xa826('0x17')],this['callerid'],this['dnid'],this[_0xa826('0x19')]));}function hangupHandler(){logger[_0xa826('0x15')](util[_0xa826('0x11')](_0xa826('0x1b'),this[_0xa826('0x16')],this['calleridname'],this[_0xa826('0x18')],this[_0xa826('0x1c')],this[_0xa826('0x19')]));this['evtHangup']=!![];}function getRoot(_0x5ddeef){return parser[_0xa826('0x1d')](_0x5ddeef,{'object':!![]})[_0xa826('0x1e')][_0xa826('0x1f')];}function addVertex(_0x4eb4f3,_0x1d7adf,_0x26ef25){_0x1d7adf[_0xa826('0x20')]=_0x26ef25;if(_0x1d7adf[_0xa826('0x21')](_0xa826('0x22'))){_0x1d7adf['maxRetry']=parseInt(_0x1d7adf[_0xa826('0x22')],0xa);}_0x4eb4f3['addVertex'](_[_0xa826('0x23')](_0x1d7adf,_0xa826('0x24')));}function initGraph(_0x51de9a,_0xfc0448){var _0xfa4d94=new Graph();for(var _0x38c919 in _0x51de9a){if(_0x51de9a[_0xa826('0x21')](_0x38c919)){if(_[_0xa826('0x25')](_0x51de9a[_0x38c919])){for(var _0x3c6307=0x0;_0x3c6307<_0x51de9a[_0x38c919][_0xa826('0x26')];_0x3c6307+=0x1){addVertex(_0xfa4d94,_0x51de9a[_0x38c919][_0x3c6307],_0x38c919);}}else{addVertex(_0xfa4d94,_0x51de9a[_0x38c919],_0x38c919);}}}for(var _0x3b9c6d=0x0;_0x3b9c6d<_0xfc0448[_0xa826('0x26')];_0x3b9c6d+=0x1){if(_0xfc0448[_0x3b9c6d][_0xa826('0x27')]&&_0xfc0448[_0x3b9c6d][_0xa826('0x28')]){_0xfa4d94[_0xa826('0x29')](_0xfc0448[_0x3b9c6d][_0xa826('0x27')],_0xfc0448[_0x3b9c6d][_0xa826('0x28')],_0xfc0448[_0x3b9c6d][_0xa826('0x2a')]);}}return _0xfa4d94;}function getSquareProject(_0x27f8f9,_0x55886f){rpc[_0xa826('0x2b')](_0x27f8f9)['then'](function(_0x2dd810){_0x55886f(null,_0x2dd810);})[_0xa826('0x2c')](function(_0xb6171d){_0x55886f(null,_0xb6171d);});}function createSquareReport(_0x27d779,_0xddac0f){rpc['createSquareReport'](_0x27d779)['then'](function(_0x41ecbf){if(_0xddac0f){_0xddac0f(null,_0x41ecbf);}})[_0xa826('0x2c')](function(_0xd666b7){if(_0xddac0f){_0xddac0f(null,_0xd666b7);}});}function setChannelVariables(_0x45a69e){for(var _0x4cec68 in _0x45a69e){if(_0x45a69e[_0xa826('0x21')](_0x4cec68)){if(_0x4cec68[_0xa826('0x2d')]('agi_')===0x0){_0x45a69e[_0x4cec68[_0xa826('0x2e')](0x4)]=_0x45a69e[_0x4cec68];delete _0x45a69e[_0x4cec68];}}}}function getLogFromObject(_0x56ddc4){return util[_0xa826('0x2f')](_0x56ddc4,{'showHidden':![],'depth':null});}function agiHandler(_0x40093a){var _0x1b41d8,_0x16700f,_0x24efa7,_0x4c00bd,_0x16f535;logger[_0xa826('0x30')](_0xa826('0x31'),JSON[_0xa826('0x32')](_0x40093a,null,0x2));logger[_0xa826('0x15')](util[_0xa826('0x11')](_0xa826('0x33'),_0x40093a[_0xa826('0x16')],_0x40093a[_0xa826('0x17')],_0x40093a[_0xa826('0x18')],_0x40093a[_0xa826('0x1c')],_0x40093a['uniqueid']));_0x40093a['on'](_0xa826('0xc'),errorHandler);_0x40093a['on']('close',closeHandler);_0x40093a['on'](_0xa826('0x34'),timeoutHandler);_0x40093a['evtHangup']=![];_0x40093a['on'](_0xa826('0x35'),hangupHandler);var _0x2bae70=getSquareProject[_0xa826('0x36')](null,_0x40093a[_0xa826('0x16')]);if(_0x2bae70){if(_0x2bae70[_0xa826('0x37')]){_0x1b41d8=getRoot(_0x2bae70[_0xa826('0x37')]);if(_0x1b41d8&&_0x1b41d8[_0xa826('0x38')]){logger[_0xa826('0x30')](_0xa826('0x1f'),JSON[_0xa826('0x32')](_0x1b41d8,null,0x2));_0x40093a[_0xa826('0x39')]=moment()[_0xa826('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x16700f=initGraph(_[_0xa826('0x23')](_0x1b41d8,_0xa826('0x24')),_0x1b41d8[_0xa826('0x24')]);_0x24efa7=new Vertices(_0x40093a,rpc,mailRpc);logger['info'](util[_0xa826('0x11')](_0xa826('0x3a'),_0x40093a['arg_1'],_0x40093a[_0xa826('0x17')],_0x40093a['callerid'],_0x40093a['dnid'],_0x40093a[_0xa826('0x19')]));_0x16700f[_0xa826('0x3b')](_0x1b41d8[_0xa826('0x38')]['id'],function(_0x308d4){try{_0x308d4=_0x24efa7[_0xa826('0x3c')](_0x308d4);logger[_0xa826('0x30')]('vertex',JSON[_0xa826('0x32')](_0x308d4,null,0x2));if(_0x308d4[_0xa826('0x20')]===_0xa826('0x3d')){logger[_0xa826('0x15')](_0xa826('0x3e'));_0x40093a[_0xa826('0x3f')]=_0x308d4['context']||_0x40093a[_0xa826('0x3f')];_0x40093a[_0xa826('0x40')]=_0x308d4[_0xa826('0x40')];_0x40093a[_0xa826('0x41')]=_0x308d4[_0xa826('0x41')]?_0x308d4['priority']-0x1:0x1;return null;}else if(_0x308d4&&_0x24efa7[_0x308d4[_0xa826('0x20')]]){_0x16f535=_0x24efa7[_0x308d4[_0xa826('0x20')]](_0x308d4);logger[_0xa826('0x15')](_0xa826('0x42'),JSON[_0xa826('0x32')](_0x16f535,null,0x2));if(_0x16f535&&_0x16f535[_0xa826('0x43')]===AGI_CODE_SUCCESS&&_0x16f535[_0xa826('0x44')]!==AGI_RESULT_ERROR&&!_0x40093a[_0xa826('0x45')]){logger[_0xa826('0x30')](_0xa826('0x42'),getLogFromObject(_0x16f535));return _[_0xa826('0x46')](_0x16f535[_0xa826('0x44')])?null:_0x16f535['result'][_0xa826('0x47')]();}else{logger[_0xa826('0xc')](_0xa826('0x42'),getLogFromObject(_0x16f535));return null;}}else{logger['error'](_0xa826('0x48'));return null;}}catch(_0x247348){logger[_0xa826('0xc')](_0x247348[_0xa826('0xd')]);return null;}});if(_0x1b41d8[_0xa826('0x49')]){logger['info'](util[_0xa826('0x11')](_0xa826('0x4a'),_0x40093a[_0xa826('0x16')],_0x40093a[_0xa826('0x17')],_0x40093a[_0xa826('0x18')],_0x40093a[_0xa826('0x1c')],_0x40093a[_0xa826('0x19')]));_0x16700f['traverseBFS'](_0x1b41d8[_0xa826('0x49')]['id'],function(_0x4aebcd){try{_0x4aebcd=_0x24efa7['clear'](_0x4aebcd);logger['debug'](_0xa826('0x4b'),JSON[_0xa826('0x32')](_0x4aebcd,null,0x2));if(_0x4aebcd&&_0x24efa7[_0x4aebcd[_0xa826('0x20')]]){_0x16f535=_0x24efa7[_0x4aebcd[_0xa826('0x20')]](_0x4aebcd);if(_0x16f535){logger['debug'](_0xa826('0x42'),getLogFromObject(_0x16f535));return _['isUndefined'](_0x16f535['result'])?null:_0x16f535[_0xa826('0x44')][_0xa826('0x47')]();}else{logger['error'](_0xa826('0x42'),getLogFromObject(_0x16f535));return null;}}else{logger[_0xa826('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x5a87bf){logger['error'](_0x5a87bf['stack']);return null;}});}logger['info'](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x40093a[_0xa826('0x16')],_0x40093a['calleridname'],_0x40093a[_0xa826('0x18')],_0x40093a['dnid'],_0x40093a[_0xa826('0x19')]));logger[_0xa826('0x15')](util[_0xa826('0x11')](_0xa826('0x4c'),_0x40093a[_0xa826('0x3f')],_0x40093a['extension'],parseInt(_0x40093a[_0xa826('0x41')],0xa)+0x1));_0x40093a['continueAt'](_0x40093a['context'],_0x40093a[_0xa826('0x40')],parseInt(_0x40093a[_0xa826('0x41')],0xa)+0x1);_0x40093a['close']();}}else{logger[_0xa826('0xc')](util[_0xa826('0x11')](_0xa826('0x4d'),_0x40093a['arg_1']));_0x40093a[_0xa826('0x4e')](_0x40093a[_0xa826('0x3f')],_0x40093a[_0xa826('0x40')],parseInt(_0x40093a[_0xa826('0x41')],0xa)+0x1);_0x40093a[_0xa826('0x4f')]();}}else{logger[_0xa826('0xc')](util[_0xa826('0x11')](_0xa826('0x50'),_0x40093a['arg_1']));_0x40093a[_0xa826('0x4e')](_0x40093a[_0xa826('0x3f')],_0x40093a[_0xa826('0x40')],parseInt(_0x40093a[_0xa826('0x41')],0xa)+0x1);_0x40093a[_0xa826('0x4f')]();}}function main(){var _0x4a1dfe;return utilLicense[_0xa826('0x51')]()[_0xa826('0x52')](function(_0x2f2ee5){if(_0x2f2ee5){if(_0x2f2ee5['voice']){if(_0x2f2ee5[_0xa826('0x53')]&&_0x2f2ee5[_0xa826('0x53')]>0x0){logger['info'](util[_0xa826('0x11')](_0xa826('0x54'),_0x2f2ee5[_0xa826('0x53')]));_0x4a1dfe=_0x2f2ee5[_0xa826('0x53')];}else{logger[_0xa826('0x15')](_0xa826('0x55'));}}else{logger[_0xa826('0x15')](_0xa826('0x56'));_0x4a1dfe=-0x1;}}})[_0xa826('0x2c')](function(_0x2287ea){logger[_0xa826('0xc')]('[LICENSE]',_0x2287ea[_0xa826('0xd')]);})[_0xa826('0x49')](function(){var _0x32dccf=require(_0xa826('0x57'))(config[_0xa826('0x4')][_0xa826('0x10')],config[_0xa826('0x4')]['ip'],_0x4a1dfe);_0x32dccf['on'](_0xa826('0xc'),errorHandler);_0x32dccf['on']('listening',listeningHandler);_0x32dccf['on'](_0xa826('0x58'),connectionHandler);_0x32dccf['on'](_0xa826('0x4f'),closeHandler);});}main();
\ No newline at end of file
+var _0x43fd=['stringify','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','toString','agicommand\x20not\x20found','stack','finally','isUndefined','[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','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','lodash','moment','../../config/environment','agi','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%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','callerid','dnid','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','maxRetry','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','hasOwnProperty','indexOf','agi_','substring','inspect','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','debug'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x43fd,0x1ec));var _0xd43f=function(_0x51dfba,_0x41d5c5){_0x51dfba=_0x51dfba-0x0;var _0x17e689=_0x43fd[_0x51dfba];return _0x17e689;};'use strict';var parser=require('xml2json');var _=require(_0xd43f('0x0'));var syncho=require('syncho');var util=require('util');var moment=require(_0xd43f('0x1'));var config=require(_0xd43f('0x2'));var logger=require('../../config/logger')(_0xd43f('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0xd43f('0x4'));var mailRpc=require(_0xd43f('0x5'));var Graph=require(_0xd43f('0x6'));var Vertices=require(_0xd43f('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xd43f('0x8')](config[_0xd43f('0x3')],{'ip':_0xd43f('0x9'),'port':0x11dd});function connectionHandler(_0x331163){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x331163);agiHandler(_0x331163);}catch(_0x19c71d){logger[_0xd43f('0xa')](_0x19c71d['stack']);}});});}function listeningHandler(){console[_0xd43f('0xb')](_0xd43f('0xc'),config[_0xd43f('0x3')][_0xd43f('0xd')]);logger[_0xd43f('0xe')](util['format'](_0xd43f('0xf'),config[_0xd43f('0x3')]['ip'],config[_0xd43f('0x3')][_0xd43f('0xd')]));}function errorHandler(_0x430977){if(_0x430977&&_0x430977[_0xd43f('0x10')]&&_0x430977[_0xd43f('0x11')]){logger[_0xd43f('0xa')](util[_0xd43f('0x12')](_0xd43f('0x13'),_0x430977[_0xd43f('0x10')],_0x430977['message']));}else{logger[_0xd43f('0xa')](util[_0xd43f('0x12')](_0xd43f('0x14'),_0x430977['stack']));}}function closeHandler(){logger['info'](util['format'](_0xd43f('0x15'),this[_0xd43f('0x16')],this['calleridname'],this[_0xd43f('0x17')],this[_0xd43f('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5ced70){logger['error'](_0x5ced70['stack']);}}function timeoutHandler(){logger[_0xd43f('0xe')](util[_0xd43f('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd43f('0x16')],this[_0xd43f('0x19')],this[_0xd43f('0x17')],this[_0xd43f('0x18')],this['uniqueid']));}function hangupHandler(){logger[_0xd43f('0xe')](util[_0xd43f('0x12')](_0xd43f('0x1a'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xd43f('0x18')],this[_0xd43f('0x1b')]));this[_0xd43f('0x1c')]=!![];}function getRoot(_0x399cb8){return parser[_0xd43f('0x1d')](_0x399cb8,{'object':!![]})[_0xd43f('0x1e')][_0xd43f('0x1f')];}function addVertex(_0x5a5c10,_0x262023,_0x4a1d8b){_0x262023[_0xd43f('0x20')]=_0x4a1d8b;if(_0x262023['hasOwnProperty']('retry')){_0x262023[_0xd43f('0x21')]=parseInt(_0x262023[_0xd43f('0x22')],0xa);}_0x5a5c10[_0xd43f('0x23')](_[_0xd43f('0x24')](_0x262023,_0xd43f('0x25')));}function initGraph(_0xcaf5ae,_0x2563c0){var _0xc2e3da=new Graph();for(var _0x2dcbf2 in _0xcaf5ae){if(_0xcaf5ae['hasOwnProperty'](_0x2dcbf2)){if(_[_0xd43f('0x26')](_0xcaf5ae[_0x2dcbf2])){for(var _0x2d5915=0x0;_0x2d5915<_0xcaf5ae[_0x2dcbf2][_0xd43f('0x27')];_0x2d5915+=0x1){addVertex(_0xc2e3da,_0xcaf5ae[_0x2dcbf2][_0x2d5915],_0x2dcbf2);}}else{addVertex(_0xc2e3da,_0xcaf5ae[_0x2dcbf2],_0x2dcbf2);}}}for(var _0x2d54a7=0x0;_0x2d54a7<_0x2563c0[_0xd43f('0x27')];_0x2d54a7+=0x1){if(_0x2563c0[_0x2d54a7]['source']&&_0x2563c0[_0x2d54a7][_0xd43f('0x28')]){_0xc2e3da[_0xd43f('0x29')](_0x2563c0[_0x2d54a7][_0xd43f('0x2a')],_0x2563c0[_0x2d54a7][_0xd43f('0x28')],_0x2563c0[_0x2d54a7][_0xd43f('0x2b')]);}}return _0xc2e3da;}function getSquareProject(_0x5a7580,_0x481b4d){rpc[_0xd43f('0x2c')](_0x5a7580)[_0xd43f('0x2d')](function(_0x5efbbd){_0x481b4d(null,_0x5efbbd);})[_0xd43f('0x2e')](function(_0x5b1219){_0x481b4d(null,_0x5b1219);});}function createSquareReport(_0x53aae7,_0x45e84a){rpc[_0xd43f('0x2f')](_0x53aae7)[_0xd43f('0x2d')](function(_0x4d032e){if(_0x45e84a){_0x45e84a(null,_0x4d032e);}})[_0xd43f('0x2e')](function(_0x23c4f7){if(_0x45e84a){_0x45e84a(null,_0x23c4f7);}});}function setChannelVariables(_0x5bba3d){for(var _0x557a96 in _0x5bba3d){if(_0x5bba3d[_0xd43f('0x30')](_0x557a96)){if(_0x557a96[_0xd43f('0x31')](_0xd43f('0x32'))===0x0){_0x5bba3d[_0x557a96[_0xd43f('0x33')](0x4)]=_0x5bba3d[_0x557a96];delete _0x5bba3d[_0x557a96];}}}}function getLogFromObject(_0x49ff92){return util[_0xd43f('0x34')](_0x49ff92,{'showHidden':![],'depth':null});}function agiHandler(_0x24015b){var _0x134b27,_0x3920eb,_0x5a5717,_0x2461bc,_0x434b36;logger['debug'](_0xd43f('0x35'),JSON['stringify'](_0x24015b,null,0x2));logger[_0xd43f('0xe')](util[_0xd43f('0x12')](_0xd43f('0x36'),_0x24015b['arg_1'],_0x24015b[_0xd43f('0x19')],_0x24015b[_0xd43f('0x17')],_0x24015b['dnid'],_0x24015b[_0xd43f('0x1b')]));_0x24015b['on'](_0xd43f('0xa'),errorHandler);_0x24015b['on'](_0xd43f('0x37'),closeHandler);_0x24015b['on']('timeout',timeoutHandler);_0x24015b[_0xd43f('0x1c')]=![];_0x24015b['on'](_0xd43f('0x38'),hangupHandler);var _0x1c0d7f=getSquareProject[_0xd43f('0x39')](null,_0x24015b[_0xd43f('0x16')]);if(_0x1c0d7f){if(_0x1c0d7f['production']){_0x134b27=getRoot(_0x1c0d7f[_0xd43f('0x3a')]);if(_0x134b27&&_0x134b27['start']){logger[_0xd43f('0x3b')](_0xd43f('0x1f'),JSON[_0xd43f('0x3c')](_0x134b27,null,0x2));_0x24015b['joinAt']=moment()[_0xd43f('0x12')](_0xd43f('0x3d'));_0x3920eb=initGraph(_['omit'](_0x134b27,_0xd43f('0x25')),_0x134b27['mxCell']);_0x5a5717=new Vertices(_0x24015b,rpc,mailRpc);logger['info'](util[_0xd43f('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x24015b['arg_1'],_0x24015b[_0xd43f('0x19')],_0x24015b['callerid'],_0x24015b['dnid'],_0x24015b[_0xd43f('0x1b')]));_0x3920eb[_0xd43f('0x3e')](_0x134b27[_0xd43f('0x3f')]['id'],function(_0x92b404){try{_0x92b404=_0x5a5717[_0xd43f('0x40')](_0x92b404);logger['debug'](_0xd43f('0x41'),JSON[_0xd43f('0x3c')](_0x92b404,null,0x2));if(_0x92b404[_0xd43f('0x20')]===_0xd43f('0x42')){logger[_0xd43f('0xe')](_0xd43f('0x43'));_0x24015b[_0xd43f('0x44')]=_0x92b404[_0xd43f('0x44')]||_0x24015b[_0xd43f('0x44')];_0x24015b[_0xd43f('0x45')]=_0x92b404[_0xd43f('0x45')];_0x24015b['priority']=_0x92b404[_0xd43f('0x46')]?_0x92b404[_0xd43f('0x46')]-0x1:0x1;return null;}else if(_0x92b404&&_0x5a5717[_0x92b404['agicommand']]){_0x434b36=_0x5a5717[_0x92b404['agicommand']](_0x92b404);logger[_0xd43f('0xe')](_0xd43f('0x47'),JSON[_0xd43f('0x3c')](_0x434b36,null,0x2));if(_0x434b36&&_0x434b36['code']===AGI_CODE_SUCCESS&&_0x434b36[_0xd43f('0x48')]!==AGI_RESULT_ERROR&&!_0x24015b[_0xd43f('0x1c')]){logger[_0xd43f('0x3b')](_0xd43f('0x47'),getLogFromObject(_0x434b36));return _['isUndefined'](_0x434b36['result'])?null:_0x434b36[_0xd43f('0x48')][_0xd43f('0x49')]();}else{logger[_0xd43f('0xa')]('response',getLogFromObject(_0x434b36));return null;}}else{logger[_0xd43f('0xa')](_0xd43f('0x4a'));return null;}}catch(_0x2d989f){logger[_0xd43f('0xa')](_0x2d989f[_0xd43f('0x4b')]);return null;}});if(_0x134b27[_0xd43f('0x4c')]){logger[_0xd43f('0xe')](util[_0xd43f('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x24015b[_0xd43f('0x16')],_0x24015b[_0xd43f('0x19')],_0x24015b[_0xd43f('0x17')],_0x24015b[_0xd43f('0x18')],_0x24015b[_0xd43f('0x1b')]));_0x3920eb[_0xd43f('0x3e')](_0x134b27[_0xd43f('0x4c')]['id'],function(_0x30fcd9){try{_0x30fcd9=_0x5a5717[_0xd43f('0x40')](_0x30fcd9);logger[_0xd43f('0x3b')](_0xd43f('0x41'),JSON['stringify'](_0x30fcd9,null,0x2));if(_0x30fcd9&&_0x5a5717[_0x30fcd9[_0xd43f('0x20')]]){_0x434b36=_0x5a5717[_0x30fcd9[_0xd43f('0x20')]](_0x30fcd9);if(_0x434b36){logger[_0xd43f('0x3b')](_0xd43f('0x47'),getLogFromObject(_0x434b36));return _[_0xd43f('0x4d')](_0x434b36[_0xd43f('0x48')])?null:_0x434b36['result'][_0xd43f('0x49')]();}else{logger['error'](_0xd43f('0x47'),getLogFromObject(_0x434b36));return null;}}else{logger['error'](_0xd43f('0x4a'));return null;}}catch(_0x89fb8e){logger[_0xd43f('0xa')](_0x89fb8e[_0xd43f('0x4b')]);return null;}});}logger[_0xd43f('0xe')](util[_0xd43f('0x12')](_0xd43f('0x4e'),_0x24015b[_0xd43f('0x16')],_0x24015b[_0xd43f('0x19')],_0x24015b['callerid'],_0x24015b[_0xd43f('0x18')],_0x24015b[_0xd43f('0x1b')]));logger[_0xd43f('0xe')](util[_0xd43f('0x12')](_0xd43f('0x4f'),_0x24015b[_0xd43f('0x44')],_0x24015b[_0xd43f('0x45')],parseInt(_0x24015b[_0xd43f('0x46')],0xa)+0x1));_0x24015b[_0xd43f('0x50')](_0x24015b[_0xd43f('0x44')],_0x24015b[_0xd43f('0x45')],parseInt(_0x24015b['priority'],0xa)+0x1);_0x24015b['close']();}}else{logger[_0xd43f('0xa')](util[_0xd43f('0x12')](_0xd43f('0x51'),_0x24015b['arg_1']));_0x24015b['continueAt'](_0x24015b[_0xd43f('0x44')],_0x24015b[_0xd43f('0x45')],parseInt(_0x24015b[_0xd43f('0x46')],0xa)+0x1);_0x24015b[_0xd43f('0x37')]();}}else{logger[_0xd43f('0xa')](util['format'](_0xd43f('0x52'),_0x24015b[_0xd43f('0x16')]));_0x24015b[_0xd43f('0x50')](_0x24015b[_0xd43f('0x44')],_0x24015b[_0xd43f('0x45')],parseInt(_0x24015b[_0xd43f('0x46')],0xa)+0x1);_0x24015b['close']();}}function main(){var _0x2fa1dc;return utilLicense[_0xd43f('0x53')]()[_0xd43f('0x2d')](function(_0x376d02){if(_0x376d02){if(_0x376d02[_0xd43f('0x54')]){if(_0x376d02[_0xd43f('0x55')]&&_0x376d02[_0xd43f('0x55')]>0x0){logger[_0xd43f('0xe')](util['format'](_0xd43f('0x56'),_0x376d02[_0xd43f('0x55')]));_0x2fa1dc=_0x376d02[_0xd43f('0x55')];}else{logger['info'](_0xd43f('0x57'));}}else{logger[_0xd43f('0xe')](_0xd43f('0x58'));_0x2fa1dc=-0x1;}}})[_0xd43f('0x2e')](function(_0x41588b){logger[_0xd43f('0xa')](_0xd43f('0x59'),_0x41588b[_0xd43f('0x4b')]);})[_0xd43f('0x4c')](function(){var _0x418af0=require('./server')(config[_0xd43f('0x3')][_0xd43f('0xd')],config['agi']['ip'],_0x2fa1dc);_0x418af0['on'](_0xd43f('0xa'),errorHandler);_0x418af0['on'](_0xd43f('0x5a'),listeningHandler);_0x418af0['on'](_0xd43f('0x5b'),connectionHandler);_0x418af0['on']('close',closeHandler);});}main();
\ No newline at end of file