Built motion from commit (unavailable).|2.2.0
[motion2.git] / server / services / agi / index.js
index 4c66d85..1099d5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7e6=['root','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','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','vertex','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','stack','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','arg_1','dnid','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','target','addEdge','source','value','createSquareReport','then','catch','indexOf','agi_','substring','debug','variables','stringify','timeout','production','start'];(function(_0x27715a,_0x3c8283){var _0x30be34=function(_0x3b2dc1){while(--_0x3b2dc1){_0x27715a['push'](_0x27715a['shift']());}};_0x30be34(++_0x3c8283);}(_0xa7e6,0x74));var _0x6a7e=function(_0x3c9f45,_0x80b642){_0x3c9f45=_0x3c9f45-0x0;var _0x4b6e1a=_0xa7e6[_0x3c9f45];return _0x4b6e1a;};'use strict';var parser=require(_0x6a7e('0x0'));var _=require(_0x6a7e('0x1'));var syncho=require(_0x6a7e('0x2'));var util=require(_0x6a7e('0x3'));var moment=require(_0x6a7e('0x4'));var config=require(_0x6a7e('0x5'));var logger=require('../../config/logger')(_0x6a7e('0x6'));var utilLicense=require(_0x6a7e('0x7'));var rpc=require(_0x6a7e('0x8'));var mailRpc=require(_0x6a7e('0x9'));var Graph=require(_0x6a7e('0xa'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6a7e('0x6')]=_[_0x6a7e('0xb')](config[_0x6a7e('0x6')],{'ip':_0x6a7e('0xc'),'port':0x11dd});function connectionHandler(_0x45e92e){process[_0x6a7e('0xd')](function(){syncho(function(){try{setChannelVariables(_0x45e92e);agiHandler(_0x45e92e);}catch(_0x23b5d6){logger[_0x6a7e('0xe')](_0x23b5d6[_0x6a7e('0xf')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')](_0x6a7e('0x12'),config[_0x6a7e('0x6')]['ip'],config[_0x6a7e('0x6')]['port']));}function errorHandler(_0x3ded6f){if(_0x3ded6f&&_0x3ded6f[_0x6a7e('0x13')]&&_0x3ded6f['message']){logger['error'](util[_0x6a7e('0x11')](_0x6a7e('0x14'),_0x3ded6f[_0x6a7e('0x13')],_0x3ded6f[_0x6a7e('0x15')]));}else{logger['error'](util[_0x6a7e('0x11')](_0x6a7e('0x16'),_0x3ded6f[_0x6a7e('0xf')]));}}function closeHandler(){logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6a7e('0x17')],this['calleridname'],this['callerid'],this[_0x6a7e('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1d2abb){logger[_0x6a7e('0xe')](_0x1d2abb[_0x6a7e('0xf')]);}}function timeoutHandler(){logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x6a7e('0x19')],this[_0x6a7e('0x18')],this[_0x6a7e('0x1a')]));}function hangupHandler(){logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')](_0x6a7e('0x1b'),this[_0x6a7e('0x17')],this[_0x6a7e('0x1c')],this['callerid'],this[_0x6a7e('0x18')],this[_0x6a7e('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x3e1e64){return parser[_0x6a7e('0x1d')](_0x3e1e64,{'object':!![]})[_0x6a7e('0x1e')]['root'];}function addVertex(_0x40c7f6,_0xd045ca,_0x4ee914){_0xd045ca[_0x6a7e('0x1f')]=_0x4ee914;if(_0xd045ca['hasOwnProperty'](_0x6a7e('0x20'))){_0xd045ca[_0x6a7e('0x21')]=parseInt(_0xd045ca['retry'],0xa);}_0x40c7f6[_0x6a7e('0x22')](_[_0x6a7e('0x23')](_0xd045ca,_0x6a7e('0x24')));}function initGraph(_0x438c77,_0x3498c5){var _0x380f2f=new Graph();for(var _0x573bdc in _0x438c77){if(_0x438c77[_0x6a7e('0x25')](_0x573bdc)){if(_[_0x6a7e('0x26')](_0x438c77[_0x573bdc])){for(var _0x43b214=0x0;_0x43b214<_0x438c77[_0x573bdc][_0x6a7e('0x27')];_0x43b214+=0x1){addVertex(_0x380f2f,_0x438c77[_0x573bdc][_0x43b214],_0x573bdc);}}else{addVertex(_0x380f2f,_0x438c77[_0x573bdc],_0x573bdc);}}}for(var _0x149fe8=0x0;_0x149fe8<_0x3498c5['length'];_0x149fe8+=0x1){if(_0x3498c5[_0x149fe8]['source']&&_0x3498c5[_0x149fe8][_0x6a7e('0x28')]){_0x380f2f[_0x6a7e('0x29')](_0x3498c5[_0x149fe8][_0x6a7e('0x2a')],_0x3498c5[_0x149fe8]['target'],_0x3498c5[_0x149fe8][_0x6a7e('0x2b')]);}}return _0x380f2f;}function getSquareProject(_0x57e642,_0x1d1e3b){rpc['getSquareProject'](_0x57e642)['then'](function(_0x15c2b8){_0x1d1e3b(null,_0x15c2b8);})['catch'](function(_0x15cc6a){_0x1d1e3b(null,_0x15cc6a);});}function createSquareReport(_0x4a18c7,_0x5665df){rpc[_0x6a7e('0x2c')](_0x4a18c7)[_0x6a7e('0x2d')](function(_0x450a86){if(_0x5665df){_0x5665df(null,_0x450a86);}})[_0x6a7e('0x2e')](function(_0x2b1788){if(_0x5665df){_0x5665df(null,_0x2b1788);}});}function setChannelVariables(_0x2f5deb){for(var _0x10625d in _0x2f5deb){if(_0x2f5deb[_0x6a7e('0x25')](_0x10625d)){if(_0x10625d[_0x6a7e('0x2f')](_0x6a7e('0x30'))===0x0){_0x2f5deb[_0x10625d[_0x6a7e('0x31')](0x4)]=_0x2f5deb[_0x10625d];delete _0x2f5deb[_0x10625d];}}}}function getLogFromObject(_0x231cad){return util['inspect'](_0x231cad,{'showHidden':![],'depth':null});}function agiHandler(_0x1d5bc1){var _0x3f4764,_0x366236,_0x510c50,_0x328f9b,_0x3b7678;logger[_0x6a7e('0x32')](_0x6a7e('0x33'),JSON[_0x6a7e('0x34')](_0x1d5bc1,null,0x2));logger[_0x6a7e('0x10')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d5bc1[_0x6a7e('0x17')],_0x1d5bc1['calleridname'],_0x1d5bc1[_0x6a7e('0x19')],_0x1d5bc1[_0x6a7e('0x18')],_0x1d5bc1['uniqueid']));_0x1d5bc1['on']('error',errorHandler);_0x1d5bc1['on']('close',closeHandler);_0x1d5bc1['on'](_0x6a7e('0x35'),timeoutHandler);_0x1d5bc1['evtHangup']=![];_0x1d5bc1['on']('hangup',hangupHandler);var _0x512430=getSquareProject['sync'](null,_0x1d5bc1[_0x6a7e('0x17')]);if(_0x512430){if(_0x512430['production']){_0x3f4764=getRoot(_0x512430[_0x6a7e('0x36')]);if(_0x3f4764&&_0x3f4764[_0x6a7e('0x37')]){logger[_0x6a7e('0x32')](_0x6a7e('0x38'),JSON[_0x6a7e('0x34')](_0x3f4764,null,0x2));_0x1d5bc1['joinAt']=moment()[_0x6a7e('0x11')](_0x6a7e('0x39'));_0x366236=initGraph(_['omit'](_0x3f4764,_0x6a7e('0x24')),_0x3f4764[_0x6a7e('0x24')]);_0x510c50=new Vertices(_0x1d5bc1,rpc,mailRpc);logger['info'](util[_0x6a7e('0x11')](_0x6a7e('0x3a'),_0x1d5bc1[_0x6a7e('0x17')],_0x1d5bc1[_0x6a7e('0x1c')],_0x1d5bc1[_0x6a7e('0x19')],_0x1d5bc1[_0x6a7e('0x18')],_0x1d5bc1[_0x6a7e('0x1a')]));_0x366236[_0x6a7e('0x3b')](_0x3f4764[_0x6a7e('0x37')]['id'],function(_0x27434a){try{_0x27434a=_0x510c50[_0x6a7e('0x3c')](_0x27434a);logger['debug']('vertex',JSON[_0x6a7e('0x34')](_0x27434a,null,0x2));if(_0x27434a[_0x6a7e('0x1f')]==='gotoc'){logger[_0x6a7e('0x10')](_0x6a7e('0x3d'));_0x1d5bc1[_0x6a7e('0x3e')]=_0x27434a[_0x6a7e('0x3e')]||_0x1d5bc1[_0x6a7e('0x3e')];_0x1d5bc1[_0x6a7e('0x3f')]=_0x27434a[_0x6a7e('0x3f')];_0x1d5bc1[_0x6a7e('0x40')]=_0x27434a[_0x6a7e('0x40')]?_0x27434a[_0x6a7e('0x40')]-0x1:0x1;return null;}else if(_0x27434a&&_0x510c50[_0x27434a[_0x6a7e('0x1f')]]){_0x3b7678=_0x510c50[_0x27434a[_0x6a7e('0x1f')]](_0x27434a);logger[_0x6a7e('0x10')](_0x6a7e('0x41'),JSON['stringify'](_0x3b7678,null,0x2));if(_0x3b7678&&_0x3b7678['code']===AGI_CODE_SUCCESS&&_0x3b7678[_0x6a7e('0x42')]!==AGI_RESULT_ERROR&&!_0x1d5bc1[_0x6a7e('0x43')]){logger[_0x6a7e('0x32')](_0x6a7e('0x41'),getLogFromObject(_0x3b7678));return _[_0x6a7e('0x44')](_0x3b7678[_0x6a7e('0x42')])?null:_0x3b7678[_0x6a7e('0x42')][_0x6a7e('0x45')]();}else{logger['error'](_0x6a7e('0x41'),getLogFromObject(_0x3b7678));return null;}}else{logger['error'](_0x6a7e('0x46'));return null;}}catch(_0x2f87ea){logger[_0x6a7e('0xe')](_0x2f87ea[_0x6a7e('0xf')]);return null;}});if(_0x3f4764['finally']){logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')](_0x6a7e('0x47'),_0x1d5bc1['arg_1'],_0x1d5bc1[_0x6a7e('0x1c')],_0x1d5bc1['callerid'],_0x1d5bc1[_0x6a7e('0x18')],_0x1d5bc1[_0x6a7e('0x1a')]));_0x366236[_0x6a7e('0x3b')](_0x3f4764[_0x6a7e('0x48')]['id'],function(_0x4cb7ef){try{_0x4cb7ef=_0x510c50[_0x6a7e('0x3c')](_0x4cb7ef);logger[_0x6a7e('0x32')](_0x6a7e('0x49'),JSON[_0x6a7e('0x34')](_0x4cb7ef,null,0x2));if(_0x4cb7ef&&_0x510c50[_0x4cb7ef['agicommand']]){_0x3b7678=_0x510c50[_0x4cb7ef[_0x6a7e('0x1f')]](_0x4cb7ef);if(_0x3b7678){logger['debug'](_0x6a7e('0x41'),getLogFromObject(_0x3b7678));return _[_0x6a7e('0x44')](_0x3b7678[_0x6a7e('0x42')])?null:_0x3b7678['result'][_0x6a7e('0x45')]();}else{logger['error'](_0x6a7e('0x41'),getLogFromObject(_0x3b7678));return null;}}else{logger['error'](_0x6a7e('0x46'));return null;}}catch(_0x22e4f7){logger[_0x6a7e('0xe')](_0x22e4f7[_0x6a7e('0xf')]);return null;}});}logger[_0x6a7e('0x10')](util[_0x6a7e('0x11')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d5bc1[_0x6a7e('0x17')],_0x1d5bc1[_0x6a7e('0x1c')],_0x1d5bc1[_0x6a7e('0x19')],_0x1d5bc1[_0x6a7e('0x18')],_0x1d5bc1['uniqueid']));logger['info'](util[_0x6a7e('0x11')](_0x6a7e('0x4a'),_0x1d5bc1[_0x6a7e('0x3e')],_0x1d5bc1[_0x6a7e('0x3f')],parseInt(_0x1d5bc1[_0x6a7e('0x40')],0xa)+0x1));_0x1d5bc1['continueAt'](_0x1d5bc1[_0x6a7e('0x3e')],_0x1d5bc1[_0x6a7e('0x3f')],parseInt(_0x1d5bc1[_0x6a7e('0x40')],0xa)+0x1);_0x1d5bc1[_0x6a7e('0x4b')]();}}else{logger['error'](util['format'](_0x6a7e('0x4c'),_0x1d5bc1[_0x6a7e('0x17')]));_0x1d5bc1['continueAt'](_0x1d5bc1[_0x6a7e('0x3e')],_0x1d5bc1[_0x6a7e('0x3f')],parseInt(_0x1d5bc1[_0x6a7e('0x40')],0xa)+0x1);_0x1d5bc1[_0x6a7e('0x4b')]();}}else{logger[_0x6a7e('0xe')](util[_0x6a7e('0x11')](_0x6a7e('0x4d'),_0x1d5bc1[_0x6a7e('0x17')]));_0x1d5bc1['continueAt'](_0x1d5bc1[_0x6a7e('0x3e')],_0x1d5bc1[_0x6a7e('0x3f')],parseInt(_0x1d5bc1[_0x6a7e('0x40')],0xa)+0x1);_0x1d5bc1[_0x6a7e('0x4b')]();}}function main(){var _0xb16534;return utilLicense['getLicense']()[_0x6a7e('0x2d')](function(_0xee25e0){if(_0xee25e0){if(_0xee25e0[_0x6a7e('0x4e')]){if(_0xee25e0[_0x6a7e('0x4f')]&&_0xee25e0[_0x6a7e('0x4f')]>0x0){logger['info'](util[_0x6a7e('0x11')](_0x6a7e('0x50'),_0xee25e0[_0x6a7e('0x4f')]));_0xb16534=_0xee25e0[_0x6a7e('0x4f')];}else{logger['info'](_0x6a7e('0x51'));}}else{logger[_0x6a7e('0x10')](_0x6a7e('0x52'));_0xb16534=-0x1;}}})[_0x6a7e('0x2e')](function(_0x3e2cb8){logger[_0x6a7e('0xe')]('[LICENSE]',_0x3e2cb8[_0x6a7e('0xf')]);})[_0x6a7e('0x48')](function(){var _0x25a4ff=require(_0x6a7e('0x53'))(config[_0x6a7e('0x6')]['port'],config[_0x6a7e('0x6')]['ip'],_0xb16534);_0x25a4ff['on'](_0x6a7e('0xe'),errorHandler);_0x25a4ff['on'](_0x6a7e('0x54'),listeningHandler);_0x25a4ff['on'](_0x6a7e('0x55'),connectionHandler);_0x25a4ff['on']('close',closeHandler);});}main();
\ No newline at end of file
+var _0x9335=['./graph','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','name','[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','uniqueid','callerid','agicommand','maxRetry','retry','addVertex','mxCell','hasOwnProperty','length','target','addEdge','source','value','getSquareProject','createSquareReport','then','catch','agi_','substring','inspect','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','hangup','sync','production','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','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','vertex','[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','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc'];(function(_0x79ec4,_0xa61837){var _0x585295=function(_0x2f42eb){while(--_0x2f42eb){_0x79ec4['push'](_0x79ec4['shift']());}};_0x585295(++_0xa61837);}(_0x9335,0xab));var _0x5933=function(_0x37b3a6,_0x30ec5e){_0x37b3a6=_0x37b3a6-0x0;var _0x20b84a=_0x9335[_0x37b3a6];return _0x20b84a;};'use strict';var parser=require(_0x5933('0x0'));var _=require(_0x5933('0x1'));var syncho=require('syncho');var util=require(_0x5933('0x2'));var moment=require(_0x5933('0x3'));var config=require(_0x5933('0x4'));var logger=require(_0x5933('0x5'))(_0x5933('0x6'));var utilLicense=require(_0x5933('0x7'));var rpc=require(_0x5933('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x5933('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x5933('0xa')](config[_0x5933('0x6')],{'ip':_0x5933('0xb'),'port':0x11dd});function connectionHandler(_0x59c5cb){process[_0x5933('0xc')](function(){syncho(function(){try{setChannelVariables(_0x59c5cb);agiHandler(_0x59c5cb);}catch(_0x953859){logger[_0x5933('0xd')](_0x953859[_0x5933('0xe')]);}});});}function listeningHandler(){console[_0x5933('0xf')](_0x5933('0x10'),config[_0x5933('0x6')][_0x5933('0x11')]);logger[_0x5933('0x12')](util[_0x5933('0x13')](_0x5933('0x14'),config[_0x5933('0x6')]['ip'],config[_0x5933('0x6')]['port']));}function errorHandler(_0x1e698e){if(_0x1e698e&&_0x1e698e['name']&&_0x1e698e[_0x5933('0x15')]){logger[_0x5933('0xd')](util[_0x5933('0x13')]('[%s]\x20%s',_0x1e698e[_0x5933('0x16')],_0x1e698e['message']));}else{logger[_0x5933('0xd')](util['format'](_0x5933('0x17'),_0x1e698e['stack']));}}function closeHandler(){logger[_0x5933('0x12')](util['format'](_0x5933('0x18'),this[_0x5933('0x19')],this[_0x5933('0x1a')],this['callerid'],this['dnid'],this[_0x5933('0x1b')]));try{createSquareReport(this);}catch(_0x2a2532){logger[_0x5933('0xd')](_0x2a2532['stack']);}}function timeoutHandler(){logger['info'](util[_0x5933('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5933('0x19')],this[_0x5933('0x1a')],this[_0x5933('0x1c')],this['dnid'],this[_0x5933('0x1b')]));}function hangupHandler(){logger[_0x5933('0x12')](util[_0x5933('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5933('0x19')],this['calleridname'],this[_0x5933('0x1c')],this['dnid'],this[_0x5933('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x2d0fb7){return parser['toJson'](_0x2d0fb7,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x4a1901,_0x3d70ef,_0x5639c7){_0x3d70ef[_0x5933('0x1d')]=_0x5639c7;if(_0x3d70ef['hasOwnProperty']('retry')){_0x3d70ef[_0x5933('0x1e')]=parseInt(_0x3d70ef[_0x5933('0x1f')],0xa);}_0x4a1901[_0x5933('0x20')](_['omit'](_0x3d70ef,_0x5933('0x21')));}function initGraph(_0x101a7b,_0x2348bc){var _0x5a0de4=new Graph();for(var _0x1e24f6 in _0x101a7b){if(_0x101a7b[_0x5933('0x22')](_0x1e24f6)){if(_['isArray'](_0x101a7b[_0x1e24f6])){for(var _0x107d87=0x0;_0x107d87<_0x101a7b[_0x1e24f6][_0x5933('0x23')];_0x107d87+=0x1){addVertex(_0x5a0de4,_0x101a7b[_0x1e24f6][_0x107d87],_0x1e24f6);}}else{addVertex(_0x5a0de4,_0x101a7b[_0x1e24f6],_0x1e24f6);}}}for(var _0x5bbeea=0x0;_0x5bbeea<_0x2348bc[_0x5933('0x23')];_0x5bbeea+=0x1){if(_0x2348bc[_0x5bbeea]['source']&&_0x2348bc[_0x5bbeea][_0x5933('0x24')]){_0x5a0de4[_0x5933('0x25')](_0x2348bc[_0x5bbeea][_0x5933('0x26')],_0x2348bc[_0x5bbeea]['target'],_0x2348bc[_0x5bbeea][_0x5933('0x27')]);}}return _0x5a0de4;}function getSquareProject(_0x51e2d6,_0x3a602c){rpc[_0x5933('0x28')](_0x51e2d6)['then'](function(_0x4fc086){_0x3a602c(null,_0x4fc086);})['catch'](function(_0x3eb646){_0x3a602c(null,_0x3eb646);});}function createSquareReport(_0x1a5f25,_0x4bcd5f){rpc[_0x5933('0x29')](_0x1a5f25)[_0x5933('0x2a')](function(_0x22ef10){if(_0x4bcd5f){_0x4bcd5f(null,_0x22ef10);}})[_0x5933('0x2b')](function(_0x56256e){if(_0x4bcd5f){_0x4bcd5f(null,_0x56256e);}});}function setChannelVariables(_0x37f6b3){for(var _0x4f109b in _0x37f6b3){if(_0x37f6b3[_0x5933('0x22')](_0x4f109b)){if(_0x4f109b['indexOf'](_0x5933('0x2c'))===0x0){_0x37f6b3[_0x4f109b[_0x5933('0x2d')](0x4)]=_0x37f6b3[_0x4f109b];delete _0x37f6b3[_0x4f109b];}}}}function getLogFromObject(_0x3f1cec){return util[_0x5933('0x2e')](_0x3f1cec,{'showHidden':![],'depth':null});}function agiHandler(_0x4e5dc2){var _0x308251,_0x13e18f,_0x5b0c9e,_0x486edd,_0x147ccf;logger['debug']('variables',JSON[_0x5933('0x2f')](_0x4e5dc2,null,0x2));logger[_0x5933('0x12')](util[_0x5933('0x13')](_0x5933('0x30'),_0x4e5dc2['arg_1'],_0x4e5dc2['calleridname'],_0x4e5dc2['callerid'],_0x4e5dc2['dnid'],_0x4e5dc2[_0x5933('0x1b')]));_0x4e5dc2['on']('error',errorHandler);_0x4e5dc2['on']('close',closeHandler);_0x4e5dc2['on']('timeout',timeoutHandler);_0x4e5dc2[_0x5933('0x31')]=![];_0x4e5dc2['on'](_0x5933('0x32'),hangupHandler);var _0x2054dd=getSquareProject[_0x5933('0x33')](null,_0x4e5dc2[_0x5933('0x19')]);if(_0x2054dd){if(_0x2054dd[_0x5933('0x34')]){_0x308251=getRoot(_0x2054dd[_0x5933('0x34')]);if(_0x308251&&_0x308251[_0x5933('0x35')]){logger[_0x5933('0x36')](_0x5933('0x37'),JSON['stringify'](_0x308251,null,0x2));_0x4e5dc2[_0x5933('0x38')]=moment()[_0x5933('0x13')](_0x5933('0x39'));_0x13e18f=initGraph(_[_0x5933('0x3a')](_0x308251,_0x5933('0x21')),_0x308251[_0x5933('0x21')]);_0x5b0c9e=new Vertices(_0x4e5dc2,rpc,mailRpc);logger[_0x5933('0x12')](util[_0x5933('0x13')](_0x5933('0x3b'),_0x4e5dc2[_0x5933('0x19')],_0x4e5dc2['calleridname'],_0x4e5dc2['callerid'],_0x4e5dc2[_0x5933('0x3c')],_0x4e5dc2[_0x5933('0x1b')]));_0x13e18f[_0x5933('0x3d')](_0x308251['start']['id'],function(_0x5d07da){try{_0x5d07da=_0x5b0c9e[_0x5933('0x3e')](_0x5d07da);logger[_0x5933('0x36')]('vertex',JSON[_0x5933('0x2f')](_0x5d07da,null,0x2));if(_0x5d07da[_0x5933('0x1d')]===_0x5933('0x3f')){logger[_0x5933('0x12')](_0x5933('0x40'));_0x4e5dc2[_0x5933('0x41')]=_0x5d07da['context']||_0x4e5dc2['context'];_0x4e5dc2[_0x5933('0x42')]=_0x5d07da[_0x5933('0x42')];_0x4e5dc2[_0x5933('0x43')]=_0x5d07da[_0x5933('0x43')]?_0x5d07da[_0x5933('0x43')]-0x1:0x1;return null;}else if(_0x5d07da&&_0x5b0c9e[_0x5d07da[_0x5933('0x1d')]]){_0x147ccf=_0x5b0c9e[_0x5d07da['agicommand']](_0x5d07da);logger[_0x5933('0x12')](_0x5933('0x44'),JSON[_0x5933('0x2f')](_0x147ccf,null,0x2));if(_0x147ccf&&_0x147ccf['code']===AGI_CODE_SUCCESS&&_0x147ccf[_0x5933('0x45')]!==AGI_RESULT_ERROR&&!_0x4e5dc2[_0x5933('0x31')]){logger[_0x5933('0x36')](_0x5933('0x44'),getLogFromObject(_0x147ccf));return _[_0x5933('0x46')](_0x147ccf[_0x5933('0x45')])?null:_0x147ccf[_0x5933('0x45')][_0x5933('0x47')]();}else{logger[_0x5933('0xd')](_0x5933('0x44'),getLogFromObject(_0x147ccf));return null;}}else{logger['error'](_0x5933('0x48'));return null;}}catch(_0x54d38d){logger['error'](_0x54d38d['stack']);return null;}});if(_0x308251[_0x5933('0x49')]){logger['info'](util['format'](_0x5933('0x4a'),_0x4e5dc2[_0x5933('0x19')],_0x4e5dc2['calleridname'],_0x4e5dc2[_0x5933('0x1c')],_0x4e5dc2['dnid'],_0x4e5dc2[_0x5933('0x1b')]));_0x13e18f[_0x5933('0x3d')](_0x308251['finally']['id'],function(_0x4ab791){try{_0x4ab791=_0x5b0c9e[_0x5933('0x3e')](_0x4ab791);logger[_0x5933('0x36')](_0x5933('0x4b'),JSON[_0x5933('0x2f')](_0x4ab791,null,0x2));if(_0x4ab791&&_0x5b0c9e[_0x4ab791[_0x5933('0x1d')]]){_0x147ccf=_0x5b0c9e[_0x4ab791['agicommand']](_0x4ab791);if(_0x147ccf){logger[_0x5933('0x36')](_0x5933('0x44'),getLogFromObject(_0x147ccf));return _[_0x5933('0x46')](_0x147ccf['result'])?null:_0x147ccf[_0x5933('0x45')][_0x5933('0x47')]();}else{logger[_0x5933('0xd')](_0x5933('0x44'),getLogFromObject(_0x147ccf));return null;}}else{logger['error'](_0x5933('0x48'));return null;}}catch(_0x28d43c){logger[_0x5933('0xd')](_0x28d43c[_0x5933('0xe')]);return null;}});}logger['info'](util[_0x5933('0x13')](_0x5933('0x4c'),_0x4e5dc2[_0x5933('0x19')],_0x4e5dc2[_0x5933('0x1a')],_0x4e5dc2[_0x5933('0x1c')],_0x4e5dc2[_0x5933('0x3c')],_0x4e5dc2[_0x5933('0x1b')]));logger[_0x5933('0x12')](util[_0x5933('0x13')](_0x5933('0x4d'),_0x4e5dc2['context'],_0x4e5dc2[_0x5933('0x42')],parseInt(_0x4e5dc2['priority'],0xa)+0x1));_0x4e5dc2[_0x5933('0x4e')](_0x4e5dc2['context'],_0x4e5dc2[_0x5933('0x42')],parseInt(_0x4e5dc2['priority'],0xa)+0x1);_0x4e5dc2[_0x5933('0x4f')]();}}else{logger[_0x5933('0xd')](util['format'](_0x5933('0x50'),_0x4e5dc2['arg_1']));_0x4e5dc2[_0x5933('0x4e')](_0x4e5dc2[_0x5933('0x41')],_0x4e5dc2[_0x5933('0x42')],parseInt(_0x4e5dc2[_0x5933('0x43')],0xa)+0x1);_0x4e5dc2[_0x5933('0x4f')]();}}else{logger[_0x5933('0xd')](util['format'](_0x5933('0x51'),_0x4e5dc2[_0x5933('0x19')]));_0x4e5dc2[_0x5933('0x4e')](_0x4e5dc2['context'],_0x4e5dc2[_0x5933('0x42')],parseInt(_0x4e5dc2['priority'],0xa)+0x1);_0x4e5dc2[_0x5933('0x4f')]();}}function main(){var _0x575ffb;return utilLicense[_0x5933('0x52')]()[_0x5933('0x2a')](function(_0x39136e){if(_0x39136e){if(_0x39136e[_0x5933('0x53')]){if(_0x39136e['callysquare']&&_0x39136e['callysquare']>0x0){logger['info'](util[_0x5933('0x13')](_0x5933('0x54'),_0x39136e[_0x5933('0x55')]));_0x575ffb=_0x39136e[_0x5933('0x55')];}else{logger[_0x5933('0x12')](_0x5933('0x56'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x575ffb=-0x1;}}})[_0x5933('0x2b')](function(_0x11fc26){logger[_0x5933('0xd')]('[LICENSE]',_0x11fc26[_0x5933('0xe')]);})[_0x5933('0x49')](function(){var _0x13f3af=require(_0x5933('0x57'))(config[_0x5933('0x6')][_0x5933('0x11')],config[_0x5933('0x6')]['ip'],_0x575ffb);_0x13f3af['on'](_0x5933('0xd'),errorHandler);_0x13f3af['on'](_0x5933('0x58'),listeningHandler);_0x13f3af['on'](_0x5933('0x59'),connectionHandler);_0x13f3af['on'](_0x5933('0x4f'),closeHandler);});}main();
\ No newline at end of file