fa1f2c8b9ad8cf43a398e758ef39a92a96cc8ddd
[motion2.git] / server / services / ami / server / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x4fc2=['format','%s/%s','SIP','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','Reload','Action','then','message','action','catch','voiceQueues','hasOwnProperty','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','outbound','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami'];(function(_0x22864d,_0x5836c9){var _0x5eaa64=function(_0x41d02f){while(--_0x41d02f){_0x22864d['push'](_0x22864d['shift']());}};_0x5eaa64(++_0x5836c9);}(_0x4fc2,0x111));var _0x24fc=function(_0x23dc29,_0x4127b3){_0x23dc29=_0x23dc29-0x0;var _0x5a79bb=_0x4fc2[_0x23dc29];return _0x5a79bb;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var jayson=require(_0x24fc('0x2'));var schema=require(_0x24fc('0x3'));var moment=require('moment');var config=require(_0x24fc('0x4'));var properties=require(_0x24fc('0x5'));var ami=require(_0x24fc('0x6'));exports['listen']=function(_0x126d90,_0x3772eb,_0x58dafc){return new Promise(function(_0x26fcc6,_0x12d602){var _0x4889f4={'QueuePause':function(_0x115851){return new Promise(function(_0x22a0c8){var _0x220f9a=util[_0x24fc('0x7')](_0x24fc('0x8'),_0x24fc('0x9'),_0x115851['name']);if(_0x126d90[_0x24fc('0xa')]&&_0x126d90[_0x24fc('0xa')][_0x220f9a]&&_0x126d90[_0x24fc('0xa')][_0x220f9a][_0x24fc('0xb')]){_0x126d90[_0x24fc('0xa')][_0x220f9a][_0x24fc('0xc')]();}if(_0x126d90[_0x24fc('0xd')][_0x220f9a]){_0x126d90[_0x24fc('0xd')][_0x220f9a]['updateStatusRealtime']({'statePause':_0x115851[_0x24fc('0xe')]?!![]:![]});}_0x22a0c8({'code':0xc8,'message':_0x24fc('0xf')});});},'Reload':function(_0x5cc65e){var _0x306873=this;return new Promise(function(_0x76cb25,_0x3f6d8b){if(ami[_0x24fc('0x10')]()==![]){return _0x3f6d8b(_0x306873[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config['asterisk'][_0x24fc('0x13')],_0x24fc('0x14')][_0x24fc('0x15')]('\x20')));}_0x5cc65e=_[_0x24fc('0x16')](_0x5cc65e,_['keys'](properties[_0x24fc('0x17')]));_0x5cc65e['action']=_0x24fc('0x18');return ami[_0x24fc('0x19')](_0x5cc65e)[_0x24fc('0x1a')](function(_0x41c593){_0x76cb25({'code':0xc8,'message':_0x41c593[_0x24fc('0x1b')]});})['catch'](function(_0x23873c){_0x3f6d8b(_0x306873[_0x24fc('0x11')](0x1f5,_0x23873c[_0x24fc('0x1b')]));});});},'Command':function(_0x8ac114){var _0x4c5a43=this;return new Promise(function(_0x5eabee,_0x4073e0){if(ami[_0x24fc('0x10')]()==![]){return _0x4073e0(_0x4c5a43['error'](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}_0x8ac114=_[_0x24fc('0x16')](_0x8ac114,'command');_0x8ac114[_0x24fc('0x1c')]='Command';return ami[_0x24fc('0x19')](_0x8ac114)[_0x24fc('0x1a')](function(_0x2ffade){_0x5eabee({'code':0xc8,'message':_0x2ffade['content']});})[_0x24fc('0x1d')](function(_0x552035){_0x4073e0(_0x4c5a43[_0x24fc('0x11')](0x1f5,_0x552035[_0x24fc('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x36a9b4){var _0x34b5b2=[];for(var _0x3296fc in _0x126d90[_0x24fc('0x1e')]){if(_0x126d90[_0x24fc('0x1e')][_0x24fc('0x1f')](_0x3296fc)){var _0x168d98=_0x126d90[_0x24fc('0x1e')][_0x3296fc];var _0x568441={'id':_0x168d98['id'],'name':_0x168d98[_0x24fc('0x20')],'strategy':_0x168d98[_0x24fc('0x21')],'answered':_0x168d98[_0x24fc('0x22')],'available':_0x168d98['available'],'loggedIn':_0x168d98[_0x24fc('0x23')],'pTalking':_0x168d98[_0x24fc('0x24')],'sumBillable':_0x168d98[_0x24fc('0x25')],'sumDuration':_0x168d98[_0x24fc('0x26')],'sumHoldTime':_0x168d98[_0x24fc('0x27')]||0x0,'talking':_0x168d98[_0x24fc('0x28')],'total':_0x168d98['total'],'type':_0x168d98[_0x24fc('0x29')],'unmanaged':_0x168d98[_0x24fc('0x2a')],'abandoned':_0x168d98[_0x24fc('0x2b')],'waiting':_0x168d98[_0x24fc('0x2c')],'loggedInDb':_0x168d98[_0x24fc('0x2d')]};if(_0x168d98['type']==='outbound'){_0x568441['dialActive']=_0x168d98[_0x24fc('0x2e')];_0x568441['dialMethod']=_0x168d98[_0x24fc('0x2f')];_0x568441[_0x24fc('0x30')]=_0x168d98[_0x24fc('0x30')];_0x568441[_0x24fc('0x31')]=_0x168d98['dialOriginateCallerIdNumber'];_0x568441[_0x24fc('0x32')]=_0x168d98[_0x24fc('0x32')];_0x568441['dialPrefix']=_0x168d98[_0x24fc('0x33')];_0x568441[_0x24fc('0x34')]=_0x168d98['temp'];_0x568441['outboundAnswerAgiCallsDay']=_0x168d98[_0x24fc('0x35')];_0x568441['outboundAnswerCallsDay']=_0x168d98[_0x24fc('0x36')];_0x568441[_0x24fc('0x37')]=_0x168d98['outboundBlacklistCallsDay'];_0x568441[_0x24fc('0x38')]=_0x168d98[_0x24fc('0x38')];_0x568441[_0x24fc('0x39')]=_0x168d98[_0x24fc('0x39')];_0x568441[_0x24fc('0x3a')]=_0x168d98[_0x24fc('0x3a')];_0x568441[_0x24fc('0x3b')]=_0x168d98[_0x24fc('0x3b')];_0x568441[_0x24fc('0x3c')]=_0x168d98['outboundDropCallsDayTimeout'];_0x568441[_0x24fc('0x3d')]=_0x168d98[_0x24fc('0x3d')];_0x568441[_0x24fc('0x3e')]=_0x168d98[_0x24fc('0x3e')];_0x568441[_0x24fc('0x3f')]=_0x168d98['outboundOriginateFailureCallsDay'];_0x568441['outboundReCallsDay']=_0x168d98[_0x24fc('0x40')];_0x568441['outboundRejectCallsDay']=_0x168d98[_0x24fc('0x41')];_0x568441[_0x24fc('0x42')]=_0x168d98[_0x24fc('0x42')];_0x568441[_0x24fc('0x43')]=_0x168d98['predictiveIntervalAnsweredCalls'];_0x568441[_0x24fc('0x44')]=_0x168d98['predictiveIntervalAvgHoldtime'];_0x568441[_0x24fc('0x45')]=_0x168d98[_0x24fc('0x45')];_0x568441[_0x24fc('0x46')]=_0x168d98[_0x24fc('0x46')];_0x568441[_0x24fc('0x47')]=_0x168d98['predictiveIntervalDroppedCallsTimeout'];_0x568441[_0x24fc('0x48')]=_0x168d98[_0x24fc('0x48')];_0x568441[_0x24fc('0x49')]=_0x168d98[_0x24fc('0x49')];_0x568441['predictiveIntervalHitRate']=_0x168d98[_0x24fc('0x4a')];_0x568441[_0x24fc('0x4b')]=_0x168d98['predictiveIntervalMultiplicativeFactor'];_0x568441[_0x24fc('0x4c')]=_0x168d98['predictiveIntervalPauses'];_0x568441[_0x24fc('0x4d')]=_0x168d98[_0x24fc('0x4d')];_0x568441[_0x24fc('0x4e')]=_0x168d98[_0x24fc('0x4e')];_0x568441[_0x24fc('0x1b')]=_0x168d98[_0x24fc('0x1b')];_0x568441[_0x24fc('0x4f')]=_0x168d98[_0x24fc('0x4f')];_0x568441['erlangCalls']=_0x168d98[_0x24fc('0x50')];_0x568441[_0x24fc('0x51')]=_0x168d98[_0x24fc('0x51')];_0x568441['erlangAbandonmentRate']=_0x168d98[_0x24fc('0x52')];_0x568441[_0x24fc('0x53')]=_0x168d98['erlangBusyFactor'];_0x568441[_0x24fc('0x54')]=_0x168d98[_0x24fc('0x54')];_0x568441[_0x24fc('0x55')]=_0x168d98['startProgressive'];}if(_0x168d98[_0x24fc('0x56')]){_0x568441[_0x24fc('0x56')]={'id':_0x168d98['Trunk']['id'],'name':_0x168d98[_0x24fc('0x56')][_0x24fc('0x20')],'active':_0x168d98[_0x24fc('0x56')][_0x24fc('0x57')],'callerid':_0x168d98['Trunk'][_0x24fc('0x58')]};}if(_0x168d98[_0x24fc('0x59')]){_0x568441[_0x24fc('0x59')]={'id':_0x168d98[_0x24fc('0x59')]['id'],'name':_0x168d98[_0x24fc('0x59')]['name']};}_0x34b5b2[_0x24fc('0x5a')](_0x568441);}}_0x36a9b4({'count':_0x34b5b2[_0x24fc('0x5b')],'rows':_0x34b5b2});});},'UpdateVoiceQueue':function(_0x17f683){return new Promise(function(_0x3c6ffb,_0x5c0798){var _0x2b8a9f=_[_0x24fc('0x5c')](_0x126d90['voiceQueues'],{'id':parseInt(_0x17f683['id'])});var _0x5bbb6c=_[_0x24fc('0x5d')](_0x17f683,['id']);if(_0x2b8a9f){for(var _0x5ddde2 in _0x5bbb6c){if(typeof _0x5bbb6c[_0x5ddde2]!=='undefined'&&typeof _0x2b8a9f[_0x5ddde2]!==_0x24fc('0x5e')){_0x2b8a9f[_0x5ddde2]=_0x5bbb6c[_0x5ddde2];}}_0x3c6ffb(_0x2b8a9f);}else{_0x5c0798();}});},'VoiceChannels':function(){return new Promise(function(_0x5879c2){var _0x281194=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x60')]);_0x5879c2({'count':_0x281194['length'],'rows':_0x281194});});},'VoiceChannelMixMonitor':function(_0x1d2910){var _0x23c1d4=this;return new Promise(function(_0x1b1f1c,_0x1ad8d6){if(ami[_0x24fc('0x10')]()==![]){return _0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')]['username'],'ami\x20disconnected'][_0x24fc('0x15')]('\x20')));}var _0x2f1a99=schema(properties[_0x24fc('0x61')])['validate'](_0x1d2910);if(_0x2f1a99['length']>0x0){return _0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f4,_[_0x24fc('0x62')](_0x2f1a99,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x21f8b8=_[_0x24fc('0x5c')](_0x126d90[_0x24fc('0x60')],{'uniqueid':_0x1d2910[_0x24fc('0x63')]});if(_0x21f8b8&&_0x21f8b8[_0x24fc('0x64')]){var _0x4574d3=util[_0x24fc('0x7')](_0x24fc('0x65'),_0x1d2910['filename']||_0x1d2910[_0x24fc('0x63')],_0x1d2910[_0x24fc('0x7')]||_0x24fc('0x66'));return ami[_0x24fc('0x19')]({'action':_0x24fc('0x67'),'channel':_0x21f8b8['channel'],'file':_0x4574d3,'options':_0x24fc('0x68')})['then'](function(_0x2c8f74){var _0x2ee445=_[_0x24fc('0x5c')](_0x21f8b8[_0x24fc('0x69')],{'filename':_0x24fc('0x6a')+_0x4574d3[_0x24fc('0x6b')]()});if(_['isNil'](_0x2ee445)){_0x21f8b8[_0x24fc('0x69')][_0x24fc('0x5a')]({'filename':_0x24fc('0x6a')+_0x4574d3[_0x24fc('0x6b')](),'createdAt':moment()[_0x24fc('0x7')](_0x24fc('0x6c')),'mixmonitorid':_0x2c8f74['mixmonitorid'],'status':_0x24fc('0x6d')});}else{_0x2ee445[_0x24fc('0x6e')]=_0x2c8f74[_0x24fc('0x6e')];_0x2ee445[_0x24fc('0x6f')]=_0x24fc('0x6d');}_0x1b1f1c({'code':0xc8,'message':[_0x1d2910[_0x24fc('0x63')],_0x24fc('0x70'),_0x2c8f74['mixmonitorid']][_0x24fc('0x15')]('\x20'),'mixmonitorid':_0x2c8f74[_0x24fc('0x6e')]});})['catch'](function(_0x1368f6){_0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f5,[_0x1d2910[_0x24fc('0x63')],_0x1368f6[_0x24fc('0x1b')][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')));});}else{return _0x1ad8d6(_0x23c1d4['error'](0x1f5,_0x24fc('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x4a0524){var _0x3e9644=this;return new Promise(function(_0x8c9649,_0x50e5b0){if(ami[_0x24fc('0x10')]()==![]){return _0x50e5b0(_0x3e9644['error'](0x1f4,[config[_0x24fc('0x12')]['ip'],config['asterisk'][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}var _0x2edef7=schema(properties['voicechannel'])[_0x24fc('0x3')](_0x4a0524);if(_0x2edef7[_0x24fc('0x5b')]>0x0){return _0x50e5b0(_0x3e9644['error'](0x1f4,_[_0x24fc('0x62')](_0x2edef7,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x47179d=_[_0x24fc('0x5c')](_0x126d90['channels'],{'uniqueid':_0x4a0524[_0x24fc('0x63')]});if(_0x47179d){return Promise[_0x24fc('0x72')]()[_0x24fc('0x1a')](function(){if(_0x47179d[_0x24fc('0x64')]){return ami[_0x24fc('0x19')]({'action':'StopMixMonitor','channel':_0x47179d['channel'],'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]})[_0x24fc('0x1d')](function(){});}})['then'](function(){if(_0x47179d['destinationchannel']){return ami[_0x24fc('0x19')]({'action':_0x24fc('0x73'),'channel':_0x47179d[_0x24fc('0x74')],'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]})['catch'](function(){});}})[_0x24fc('0x1a')](function(){var _0x39f45a=_[_0x24fc('0x5c')](_0x47179d[_0x24fc('0x69')],{'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]});if(_0x39f45a){_0x39f45a[_0x24fc('0x6f')]=_0x24fc('0x75');}})[_0x24fc('0x1a')](function(){var _0xbe136e=util[_0x24fc('0x7')](_0x24fc('0x65'),_0x4a0524[_0x24fc('0x76')]||_0x4a0524[_0x24fc('0x63')],_0x4a0524[_0x24fc('0x7')]||_0x24fc('0x66'));var _0x54ead5=_[_0x24fc('0x5c')](_0x47179d[_0x24fc('0x69')],{'filename':_0x24fc('0x6a')+_0xbe136e[_0x24fc('0x6b')]()});if(_0x54ead5){_0x54ead5[_0x24fc('0x6f')]=_0x24fc('0x75');}})[_0x24fc('0x1a')](function(){_0x8c9649({'code':0xc8,'message':[_0x4a0524[_0x24fc('0x63')],'StopMixMonitor\x20Success'][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x14adcb){_0x50e5b0(_0x3e9644[_0x24fc('0x11')](0x1f5,[_0x4a0524['uniqueid'],_0x14adcb[_0x24fc('0x1b')][_0x24fc('0x6b')]()]['join']('\x20')));});}else{return _0x50e5b0(_0x3e9644['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x2ae2ac){var _0x698283=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x77')]);_0x2ae2ac({'count':_0x698283[_0x24fc('0x5b')],'rows':_0x698283});});},'VoiceQueuesChannel':function(_0x1d0f06){var _0x52e1aa=this;return new Promise(function(_0x11bafd,_0x15e8a3){var _0x5a2c09=schema(properties['voicequeuechannel'])[_0x24fc('0x3')](_0x1d0f06);if(_0x5a2c09[_0x24fc('0x5b')]>0x0){return _0x15e8a3(_0x52e1aa[_0x24fc('0x11')](0x1f4,_['map'](_0x5a2c09,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x33f04e=_['find'](_0x126d90['queueChannels'],{'uniqueid':_0x1d0f06['uniqueid']});if(_0x33f04e){_0x11bafd(_0x33f04e);}else{return _0x15e8a3(_0x52e1aa['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x10ef7c){var _0x7e93d0=this;return new Promise(function(_0x2f1a7e,_0x2a1236){if(ami['isConnected']()==![]){return _0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x24fc('0x12')]['username'],_0x24fc('0x14')][_0x24fc('0x15')]('\x20')));}var _0x1b9079=schema(properties[_0x24fc('0x78')])[_0x24fc('0x3')](_0x10ef7c);if(_0x1b9079[_0x24fc('0x5b')]>0x0){return _0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f4,_['map'](_0x1b9079,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x2de101=_['find'](_0x126d90['queueChannels'],{'uniqueid':_0x10ef7c[_0x24fc('0x63')]});if(_0x2de101&&_0x2de101[_0x24fc('0x64')]){return ami['Action']({'action':_0x24fc('0x79'),'channel':_0x2de101[_0x24fc('0x64')]})['then'](function(_0x2b51c8){_0x2f1a7e({'code':0xc8,'message':[_0x10ef7c[_0x24fc('0x63')],_0x2b51c8['message'][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x1efe4e){_0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f5,[_0x10ef7c[_0x24fc('0x63')],_0x1efe4e['message']['toLowerCase']()][_0x24fc('0x15')]('\x20')));});}else{return _0x2a1236(_0x7e93d0['error'](0x1f5,_0x24fc('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x52d54e){var _0x5233c5=this;return new Promise(function(_0x436652,_0x16c609){if(ami[_0x24fc('0x10')]()==![]){return _0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}var _0x795fff=schema(properties[_0x24fc('0x7a')])['validate'](_0x52d54e);if(_0x795fff['length']>0x0){return _0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f4,_[_0x24fc('0x62')](_0x795fff,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0xd1e6=_['find'](_0x126d90[_0x24fc('0x77')],{'uniqueid':_0x52d54e[_0x24fc('0x63')]});if(_0xd1e6&&_0xd1e6['channel']){return ami[_0x24fc('0x19')]({'action':_0x24fc('0x7b'),'channel':_0xd1e6[_0x24fc('0x64')],'exten':_0x52d54e['exten'],'context':_0x52d54e[_0x24fc('0x7c')]||_0xd1e6[_0x24fc('0x7c')],'priority':0x1})[_0x24fc('0x1a')](function(_0x2c573b){_0x436652({'code':0xc8,'message':[_0x52d54e[_0x24fc('0x63')],_0x2c573b[_0x24fc('0x1b')][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x54f379){_0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f5,[_0x52d54e[_0x24fc('0x63')],_0x54f379[_0x24fc('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x16c609(_0x5233c5['error'](0x1f5,_0x24fc('0x71')));}});},'Agents':function(_0x560c80){return new Promise(function(_0x12a6a1){var _0x44132e=_['values'](_0x126d90[_0x24fc('0xd')]);if(_0x560c80&&_0x560c80['id']){var _0x559692=_[_0x24fc('0x5c')](_0x44132e,function(_0x57e241){return _0x57e241['id']===_0x560c80['id'];});_0x12a6a1(_0x559692);}else{_0x12a6a1({'count':_0x44132e[_0x24fc('0x5b')],'rows':_0x44132e});}});},'Telephones':function(){return new Promise(function(_0x367520){var _0x1ef6f3=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7d')]);_0x367520({'count':_0x1ef6f3[_0x24fc('0x5b')],'rows':_0x1ef6f3});});},'Trunks':function(){return new Promise(function(_0x4d30ba){var _0xa769cb=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7e')]);_0x4d30ba({'count':_0xa769cb[_0x24fc('0x5b')],'rows':_0xa769cb});});},'OutboundChannels':function(){return new Promise(function(_0xc9e77c){var _0x328d4d=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7f')]);_0xc9e77c({'count':_0x328d4d[_0x24fc('0x5b')],'rows':_0x328d4d});});},'Outbound':function(){return new Promise(function(_0x5f4ec2){_0x5f4ec2(_0x126d90[_0x24fc('0x80')]);});},'Campaigns':function(){return new Promise(function(_0x211295){var _0x31b110=_[_0x24fc('0x5f')](_0x126d90['campaigns']);_0x211295({'count':_0x31b110[_0x24fc('0x5b')],'rows':_0x31b110});});},'VoiceQueuesPreview':function(_0x3287ac){var _0xc2be0f=this;return new Promise(function(_0x59411e,_0x29cbc5){_0x3772eb['run'](_0x3287ac['id'])['then'](function(_0x4e7c8b){_0x59411e({'code':0xc8,'message':_0x4e7c8b[_0x24fc('0x1b')]});})['catch'](function(_0x29f1c1){_0x29cbc5(_0xc2be0f[_0x24fc('0x11')](0x1f4,_0x29f1c1[_0x24fc('0x1b')]));});});},'EventManager':function(_0x10abf7){var _0x50d1f7=this;return new Promise(function(_0x3a65c5,_0x315ce4){if(!_0x10abf7[_0x24fc('0x81')]){return _0x315ce4(_0x50d1f7[_0x24fc('0x11')](0x1f4,_0x24fc('0x82')));}ami['emit'](_0x24fc('0x83')+_0x10abf7[_0x24fc('0x81')],_0x10abf7[_0x24fc('0x1b')]);_0x3a65c5({'code':0xc8,'message':_0x10abf7});});},'FaxAccounts':function(){return new Promise(function(_0xdc1cb7){var _0x5b5109=_['values'](_0x126d90[_0x24fc('0x84')]);_0xdc1cb7({'count':_0x5b5109[_0x24fc('0x5b')],'rows':_0x5b5109});});},'SendFax':function(_0x24e27e){var _0x188d0d=this;return new Promise(function(_0x1f263c,_0x49e6f2){_0x58dafc[_0x24fc('0x85')](_0x24e27e)[_0x24fc('0x1a')](function(_0x95ecb1){_0x1f263c({'code':0xc8,'message':_0x95ecb1['message']});})[_0x24fc('0x1d')](function(_0x69a2cd){_0x49e6f2(_0x188d0d[_0x24fc('0x11')](0x1f4,_0x69a2cd[_0x24fc('0x1b')]));});});},'CheckAfterSend':function(_0xc52004){var _0x4c10d9=this;return new Promise(function(_0x52cc49,_0x587e47){_0x58dafc[_0x24fc('0x86')](_0xc52004)[_0x24fc('0x1a')](function(_0x2b7be3){_0x52cc49({'code':0xc8,'message':_0x2b7be3[_0x24fc('0x1b')]});})[_0x24fc('0x1d')](function(_0x2ac3e8){_0x587e47(_0x4c10d9[_0x24fc('0x11')](0x1f4,_0x2ac3e8[_0x24fc('0x1b')]));});});}};var _0x382a1c=jayson[_0x24fc('0x87')](_0x4889f4)[_0x24fc('0x88')]();_0x382a1c['on'](_0x24fc('0x11'),function(_0x5d01ab){return _0x12d602(_0x5d01ab);});_0x382a1c['listen'](0x232a,_0x24fc('0x89'),function(){console['log'](_0x24fc('0x8a'),0x232a);return _0x26fcc6(_0x24fc('0x8b')+0x232a);});});};