54d7d5e2ef958663d38409220a11af5a6c50243c
[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 _0xbedf=['sumHoldTime','talking','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','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','channels','voicechannel','map','find','uniqueid','channel','%s.%s','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','wav','status','values','voicequeuechannel','queueChannels','Hangup','exten','context','telephones','outboundChannels','outbound','run','event','emit','custom:','faxAccounts','checkAfterSend','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','module','Reload','Action','catch','error','message','join','command','action','Command','then','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration'];(function(_0x436bc5,_0x47b676){var _0x3795fc=function(_0x12daa5){while(--_0x12daa5){_0x436bc5['push'](_0x436bc5['shift']());}};_0x3795fc(++_0x47b676);}(_0xbedf,0xe2));var _0xfbed=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0xbedf[_0x5e7b6c];return _0x3afdbd;};'use strict';var _=require(_0xfbed('0x0'));var util=require(_0xfbed('0x1'));var jayson=require(_0xfbed('0x2'));var schema=require(_0xfbed('0x3'));var BPromise=require(_0xfbed('0x4'));var moment=require(_0xfbed('0x5'));var config=require('../../../config/environment');var properties=require(_0xfbed('0x6'));var ami=require(_0xfbed('0x7'));exports[_0xfbed('0x8')]=function(_0x531047,_0x47f7fc,_0x4c8f00){return new BPromise(function(_0x50aafc,_0x5b2b27){var _0xaef696={'QueuePause':function(_0xf45a3d){return new Promise(function(_0xc6de1,_0x52679e){var _0x2365c4=util[_0xfbed('0x9')](_0xfbed('0xa'),'SIP',_0xf45a3d[_0xfbed('0xb')]);if(_0x531047[_0xfbed('0xc')]&&_0x531047[_0xfbed('0xc')][_0x2365c4]&&_0x531047[_0xfbed('0xc')][_0x2365c4][_0xfbed('0xd')]){_0x531047[_0xfbed('0xc')][_0x2365c4][_0xfbed('0xe')]();}if(_0x531047[_0xfbed('0xf')][_0x2365c4]){_0x531047[_0xfbed('0xf')][_0x2365c4]['updateStatusRealtime']({'statePause':_0xf45a3d[_0xfbed('0x10')]?!![]:![]});}_0xc6de1({'code':0xc8,'message':_0xfbed('0x11')});});},'Reload':function(_0x2d6af8){var _0xfed5cd=this;return new Promise(function(_0x295c41,_0x255de7){if(ami[_0xfbed('0x12')]()==![]){return _0x255de7(_0xfed5cd['error'](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')][_0xfbed('0x14')],_0xfbed('0x15')]['join']('\x20')));}_0x2d6af8=_[_0xfbed('0x16')](_0x2d6af8,_[_0xfbed('0x17')](properties[_0xfbed('0x18')]));_0x2d6af8['action']=_0xfbed('0x19');return ami[_0xfbed('0x1a')](_0x2d6af8)['then'](function(_0x16565e){_0x295c41({'code':0xc8,'message':_0x16565e['message']});})[_0xfbed('0x1b')](function(_0x2cbd2d){_0x255de7(_0xfed5cd[_0xfbed('0x1c')](0x1f5,_0x2cbd2d[_0xfbed('0x1d')]));});});},'Command':function(_0x46e801){var _0x57626d=this;return new Promise(function(_0x277c09,_0x145d88){if(ami['isConnected']()==![]){return _0x145d88(_0x57626d[_0xfbed('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0xfbed('0x13')][_0xfbed('0x14')],_0xfbed('0x15')][_0xfbed('0x1e')]('\x20')));}_0x46e801=_[_0xfbed('0x16')](_0x46e801,_0xfbed('0x1f'));_0x46e801[_0xfbed('0x20')]=_0xfbed('0x21');return ami[_0xfbed('0x1a')](_0x46e801)[_0xfbed('0x22')](function(_0x2a705e){_0x277c09({'code':0xc8,'message':_0x2a705e['content']});})[_0xfbed('0x1b')](function(_0x84af64){_0x145d88(_0x57626d[_0xfbed('0x1c')](0x1f5,_0x84af64[_0xfbed('0x1d')]));});});},'VoiceQueues':function(_0xcdf046){return new Promise(function(_0x2f998f,_0x267ca0){var _0x5c9be5=[];for(var _0x53511b in _0x531047[_0xfbed('0x23')]){if(_0x531047['voiceQueues']['hasOwnProperty'](_0x53511b)){var _0x528584=_0x531047['voiceQueues'][_0x53511b];var _0xa3198c={'id':_0x528584['id'],'name':_0x528584[_0xfbed('0xb')],'strategy':_0x528584[_0xfbed('0x24')],'answered':_0x528584[_0xfbed('0x25')],'available':_0x528584[_0xfbed('0x26')],'loggedIn':_0x528584[_0xfbed('0x27')],'pTalking':_0x528584[_0xfbed('0x28')],'sumBillable':_0x528584['sumBillable'],'sumDuration':_0x528584[_0xfbed('0x29')],'sumHoldTime':_0x528584[_0xfbed('0x2a')]||0x0,'talking':_0x528584[_0xfbed('0x2b')],'total':_0x528584['total'],'type':_0x528584[_0xfbed('0x2c')],'unmanaged':_0x528584[_0xfbed('0x2d')],'abandoned':_0x528584[_0xfbed('0x2e')],'waiting':_0x528584['waiting'],'loggedInDb':_0x528584[_0xfbed('0x2f')]};if(_0x528584[_0xfbed('0x2c')]==='outbound'){_0xa3198c[_0xfbed('0x30')]=_0x528584[_0xfbed('0x30')];_0xa3198c['dialMethod']=_0x528584[_0xfbed('0x31')];_0xa3198c[_0xfbed('0x32')]=_0x528584[_0xfbed('0x32')];_0xa3198c[_0xfbed('0x33')]=_0x528584['dialOriginateCallerIdNumber'];_0xa3198c['dialOriginateTimeout']=_0x528584[_0xfbed('0x34')];_0xa3198c[_0xfbed('0x35')]=_0x528584['dialPrefix'];_0xa3198c[_0xfbed('0x36')]=_0x528584['outboundAnswerAgiCallsDay'];_0xa3198c[_0xfbed('0x37')]=_0x528584[_0xfbed('0x37')];_0xa3198c[_0xfbed('0x38')]=_0x528584['outboundBlacklistCallsDay'];_0xa3198c[_0xfbed('0x39')]=_0x528584[_0xfbed('0x39')];_0xa3198c['outboundCongestionCallsDay']=_0x528584[_0xfbed('0x3a')];_0xa3198c[_0xfbed('0x3b')]=_0x528584[_0xfbed('0x3b')];_0xa3198c[_0xfbed('0x3c')]=_0x528584['outboundDropCallsDayCallersExit'];_0xa3198c[_0xfbed('0x3d')]=_0x528584[_0xfbed('0x3d')];_0xa3198c[_0xfbed('0x3e')]=_0x528584[_0xfbed('0x3e')];_0xa3198c[_0xfbed('0x3f')]=_0x528584['outboundNoSuchCallsDay'];_0xa3198c['outboundOriginateFailureCallsDay']=_0x528584[_0xfbed('0x40')];_0xa3198c[_0xfbed('0x41')]=_0x528584['outboundReCallsDay'];_0xa3198c[_0xfbed('0x42')]=_0x528584[_0xfbed('0x42')];_0xa3198c[_0xfbed('0x43')]=_0x528584[_0xfbed('0x43')];_0xa3198c['predictiveIntervalAnsweredCalls']=_0x528584[_0xfbed('0x44')];_0xa3198c[_0xfbed('0x45')]=_0x528584['predictiveIntervalAvgHoldtime'];_0xa3198c[_0xfbed('0x46')]=_0x528584[_0xfbed('0x46')];_0xa3198c['predictiveIntervalDroppedCallsCallersExit']=_0x528584[_0xfbed('0x47')];_0xa3198c[_0xfbed('0x48')]=_0x528584[_0xfbed('0x48')];_0xa3198c[_0xfbed('0x49')]=_0x528584['predictiveIntervalErlangCalls'];_0xa3198c[_0xfbed('0x4a')]=_0x528584[_0xfbed('0x4a')];_0xa3198c[_0xfbed('0x4b')]=_0x528584[_0xfbed('0x4b')];_0xa3198c[_0xfbed('0x4c')]=_0x528584[_0xfbed('0x4c')];_0xa3198c[_0xfbed('0x4d')]=_0x528584[_0xfbed('0x4d')];_0xa3198c[_0xfbed('0x4e')]=_0x528584[_0xfbed('0x4e')];_0xa3198c[_0xfbed('0x4f')]=_0x528584['predictiveIntervalTotalCalls'];_0xa3198c[_0xfbed('0x1d')]=_0x528584[_0xfbed('0x1d')];_0xa3198c[_0xfbed('0x50')]=_0x528584[_0xfbed('0x50')];_0xa3198c['erlangCalls']=_0x528584[_0xfbed('0x51')];_0xa3198c[_0xfbed('0x52')]=_0x528584[_0xfbed('0x52')];_0xa3198c[_0xfbed('0x53')]=_0x528584[_0xfbed('0x53')];_0xa3198c[_0xfbed('0x54')]=_0x528584[_0xfbed('0x54')];_0xa3198c[_0xfbed('0x55')]=_0x528584[_0xfbed('0x55')];_0xa3198c[_0xfbed('0x56')]=_0x528584['startProgressive'];}if(_0x528584[_0xfbed('0x57')]){_0xa3198c[_0xfbed('0x57')]={'id':_0x528584[_0xfbed('0x57')]['id'],'name':_0x528584['Trunk'][_0xfbed('0xb')],'active':_0x528584[_0xfbed('0x57')][_0xfbed('0x58')],'callerid':_0x528584[_0xfbed('0x57')][_0xfbed('0x59')]};}if(_0x528584['Interval']){_0xa3198c[_0xfbed('0x5a')]={'id':_0x528584[_0xfbed('0x5a')]['id'],'name':_0x528584[_0xfbed('0x5a')][_0xfbed('0xb')]};}_0x5c9be5[_0xfbed('0x5b')](_0xa3198c);}}_0x2f998f({'count':_0x5c9be5[_0xfbed('0x5c')],'rows':_0x5c9be5});});},'VoiceChannels':function(_0x3b7799){return new Promise(function(_0x41d289,_0x3013a8){var _0x11cfcb=_['values'](_0x531047[_0xfbed('0x5d')]);_0x41d289({'count':_0x11cfcb[_0xfbed('0x5c')],'rows':_0x11cfcb});});},'VoiceChannelMixMonitor':function(_0x51a737){var _0x866040=this;return new Promise(function(_0x73bf72,_0x291ba9){if(ami[_0xfbed('0x12')]()==![]){return _0x291ba9(_0x866040[_0xfbed('0x1c')](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')]['username'],_0xfbed('0x15')][_0xfbed('0x1e')]('\x20')));}var _0xbf6025=schema(properties[_0xfbed('0x5e')])[_0xfbed('0x3')](_0x51a737);if(_0xbf6025[_0xfbed('0x5c')]>0x0){return _0x291ba9(_0x866040['error'](0x1f4,_[_0xfbed('0x5f')](_0xbf6025,_0xfbed('0x1d'))[_0xfbed('0x1e')](',\x20')));}var _0x1b55f1=_[_0xfbed('0x60')](_0x531047[_0xfbed('0x5d')],{'uniqueid':_0x51a737[_0xfbed('0x61')]});if(_0x1b55f1&&_0x1b55f1[_0xfbed('0x62')]){var _0x5aaa29=util[_0xfbed('0x9')](_0xfbed('0x63'),_0x51a737['filename']||_0x51a737['uniqueid'],_0x51a737[_0xfbed('0x9')]||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x1b55f1[_0xfbed('0x62')],'file':_0x5aaa29,'options':_0xfbed('0x64')})['then'](function(_0x38a612){var _0x1eeda4=_[_0xfbed('0x60')](_0x1b55f1[_0xfbed('0x65')],{'filename':_0xfbed('0x66')+_0x5aaa29['toLowerCase']()});if(_['isNil'](_0x1eeda4)){_0x1b55f1[_0xfbed('0x65')]['push']({'filename':_0xfbed('0x66')+_0x5aaa29['toLowerCase'](),'createdAt':moment()[_0xfbed('0x9')](_0xfbed('0x67')),'mixmonitorid':_0x38a612[_0xfbed('0x68')],'status':_0xfbed('0x69')});}else{_0x1eeda4[_0xfbed('0x68')]=_0x38a612[_0xfbed('0x68')];_0x1eeda4['status']='rec';}_0x73bf72({'code':0xc8,'message':[_0x51a737[_0xfbed('0x61')],_0xfbed('0x6a'),_0x38a612[_0xfbed('0x68')]][_0xfbed('0x1e')]('\x20'),'mixmonitorid':_0x38a612[_0xfbed('0x68')]});})['catch'](function(_0xab64f8){_0x291ba9(_0x866040[_0xfbed('0x1c')](0x1f5,[_0x51a737['uniqueid'],_0xab64f8[_0xfbed('0x1d')][_0xfbed('0x6b')]()][_0xfbed('0x1e')]('\x20')));});}else{return _0x291ba9(_0x866040[_0xfbed('0x1c')](0x1f5,_0xfbed('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x4976b0){var _0x414bf1=this;return new Promise(function(_0x28abb2,_0xe0b263){if(ami[_0xfbed('0x12')]()==![]){return _0xe0b263(_0x414bf1[_0xfbed('0x1c')](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')][_0xfbed('0x14')],'ami\x20disconnected'][_0xfbed('0x1e')]('\x20')));}var _0x284b01=schema(properties[_0xfbed('0x5e')])[_0xfbed('0x3')](_0x4976b0);if(_0x284b01['length']>0x0){return _0xe0b263(_0x414bf1[_0xfbed('0x1c')](0x1f4,_['map'](_0x284b01,'message')['join'](',\x20')));}var _0x5717c5=_[_0xfbed('0x60')](_0x531047[_0xfbed('0x5d')],{'uniqueid':_0x4976b0[_0xfbed('0x61')]});if(_0x5717c5){return BPromise[_0xfbed('0x6d')]()[_0xfbed('0x22')](function(){if(_0x5717c5[_0xfbed('0x62')]){return ami['Action']({'action':_0xfbed('0x6e'),'channel':_0x5717c5['channel'],'mixmonitorid':_0x4976b0[_0xfbed('0x68')]})[_0xfbed('0x1b')](function(_0xd37004){});}})[_0xfbed('0x22')](function(){if(_0x5717c5[_0xfbed('0x6f')]){return ami[_0xfbed('0x1a')]({'action':_0xfbed('0x6e'),'channel':_0x5717c5[_0xfbed('0x6f')],'mixmonitorid':_0x4976b0[_0xfbed('0x68')]})['catch'](function(_0xeb4ebd){});}})[_0xfbed('0x22')](function(_0x1d3c97){var _0x221cdb=_[_0xfbed('0x60')](_0x5717c5[_0xfbed('0x65')],{'mixmonitorid':_0x4976b0[_0xfbed('0x68')]});if(_0x221cdb){_0x221cdb['status']=_0xfbed('0x70');}})[_0xfbed('0x22')](function(){var _0x2a8dfc=util[_0xfbed('0x9')](_0xfbed('0x63'),_0x4976b0['filename']||_0x4976b0[_0xfbed('0x61')],_0x4976b0['format']||_0xfbed('0x71'));var _0x140683=_[_0xfbed('0x60')](_0x5717c5[_0xfbed('0x65')],{'filename':_0xfbed('0x66')+_0x2a8dfc['toLowerCase']()});if(_0x140683){_0x140683[_0xfbed('0x72')]=_0xfbed('0x70');}})[_0xfbed('0x22')](function(){_0x28abb2({'code':0xc8,'message':[_0x4976b0[_0xfbed('0x61')],'StopMixMonitor\x20Success'][_0xfbed('0x1e')]('\x20')});})[_0xfbed('0x1b')](function(_0x2000fc){_0xe0b263(_0x414bf1[_0xfbed('0x1c')](0x1f5,[_0x4976b0[_0xfbed('0x61')],_0x2000fc['message']['toLowerCase']()][_0xfbed('0x1e')]('\x20')));});}else{return _0xe0b263(_0x414bf1[_0xfbed('0x1c')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x27992e){return new Promise(function(_0x467173,_0x56801b){var _0x18c7d7=_[_0xfbed('0x73')](_0x531047['queueChannels']);_0x467173({'count':_0x18c7d7['length'],'rows':_0x18c7d7});});},'VoiceQueuesChannel':function(_0x464e1f){var _0x2bb80f=this;return new Promise(function(_0x3e3968,_0x57adaf){var _0x517797=schema(properties[_0xfbed('0x74')])[_0xfbed('0x3')](_0x464e1f);if(_0x517797[_0xfbed('0x5c')]>0x0){return _0x57adaf(_0x2bb80f[_0xfbed('0x1c')](0x1f4,_[_0xfbed('0x5f')](_0x517797,_0xfbed('0x1d'))[_0xfbed('0x1e')](',\x20')));}var _0x58b172=_[_0xfbed('0x60')](_0x531047[_0xfbed('0x75')],{'uniqueid':_0x464e1f['uniqueid']});if(_0x58b172){_0x3e3968(_0x58b172);}else{return _0x57adaf(_0x2bb80f['error'](0x1f5,_0xfbed('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x2844ac){var _0x507bab=this;return new Promise(function(_0x50037e,_0x296e91){if(ami[_0xfbed('0x12')]()==![]){return _0x296e91(_0x507bab['error'](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')]['username'],_0xfbed('0x15')][_0xfbed('0x1e')]('\x20')));}var _0x1c0c2e=schema(properties['voicequeuechannelhangup'])[_0xfbed('0x3')](_0x2844ac);if(_0x1c0c2e[_0xfbed('0x5c')]>0x0){return _0x296e91(_0x507bab[_0xfbed('0x1c')](0x1f4,_[_0xfbed('0x5f')](_0x1c0c2e,_0xfbed('0x1d'))[_0xfbed('0x1e')](',\x20')));}var _0xb9de82=_['find'](_0x531047['queueChannels'],{'uniqueid':_0x2844ac[_0xfbed('0x61')]});if(_0xb9de82&&_0xb9de82[_0xfbed('0x62')]){return ami[_0xfbed('0x1a')]({'action':_0xfbed('0x76'),'channel':_0xb9de82[_0xfbed('0x62')]})[_0xfbed('0x22')](function(_0x726684){_0x50037e({'code':0xc8,'message':[_0x2844ac['uniqueid'],_0x726684[_0xfbed('0x1d')][_0xfbed('0x6b')]()][_0xfbed('0x1e')]('\x20')});})[_0xfbed('0x1b')](function(_0x4ae882){_0x296e91(_0x507bab['error'](0x1f5,[_0x2844ac[_0xfbed('0x61')],_0x4ae882[_0xfbed('0x1d')]['toLowerCase']()][_0xfbed('0x1e')]('\x20')));});}else{return _0x296e91(_0x507bab[_0xfbed('0x1c')](0x1f5,_0xfbed('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0xc5705){var _0x2a16e9=this;return new Promise(function(_0x2a5d84,_0x3e1c16){if(ami[_0xfbed('0x12')]()==![]){return _0x3e1c16(_0x2a16e9[_0xfbed('0x1c')](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')][_0xfbed('0x14')],_0xfbed('0x15')]['join']('\x20')));}var _0xe431c2=schema(properties['voicequeuechannelredirect'])[_0xfbed('0x3')](_0xc5705);if(_0xe431c2[_0xfbed('0x5c')]>0x0){return _0x3e1c16(_0x2a16e9['error'](0x1f4,_[_0xfbed('0x5f')](_0xe431c2,_0xfbed('0x1d'))[_0xfbed('0x1e')](',\x20')));}var _0x403d3b=_[_0xfbed('0x60')](_0x531047[_0xfbed('0x75')],{'uniqueid':_0xc5705[_0xfbed('0x61')]});if(_0x403d3b&&_0x403d3b[_0xfbed('0x62')]){return ami[_0xfbed('0x1a')]({'action':'Redirect','channel':_0x403d3b[_0xfbed('0x62')],'exten':_0xc5705[_0xfbed('0x77')],'context':_0xc5705[_0xfbed('0x78')]||_0x403d3b['context'],'priority':0x1})['then'](function(_0x5b2ade){_0x2a5d84({'code':0xc8,'message':[_0xc5705['uniqueid'],_0x5b2ade[_0xfbed('0x1d')][_0xfbed('0x6b')]()][_0xfbed('0x1e')]('\x20')});})['catch'](function(_0x413c2b){_0x3e1c16(_0x2a16e9[_0xfbed('0x1c')](0x1f5,[_0xc5705['uniqueid'],_0x413c2b[_0xfbed('0x1d')][_0xfbed('0x6b')]()][_0xfbed('0x1e')]('\x20')));});}else{return _0x3e1c16(_0x2a16e9[_0xfbed('0x1c')](0x1f5,_0xfbed('0x6c')));}});},'Agents':function(_0x21c383){return new Promise(function(_0x50cc62,_0x322520){var _0x425677=_[_0xfbed('0x73')](_0x531047['agents']);_0x50cc62({'count':_0x425677[_0xfbed('0x5c')],'rows':_0x425677});});},'Telephones':function(_0x3508c7){return new Promise(function(_0xd1c996,_0x50e5a5){var _0x195aa7=_[_0xfbed('0x73')](_0x531047[_0xfbed('0x79')]);_0xd1c996({'count':_0x195aa7['length'],'rows':_0x195aa7});});},'Trunks':function(_0x3bf4b7){return new Promise(function(_0x4016c2,_0x4e8c08){var _0x593cae=_[_0xfbed('0x73')](_0x531047['trunks']);_0x4016c2({'count':_0x593cae[_0xfbed('0x5c')],'rows':_0x593cae});});},'OutboundChannels':function(_0x557dc9){return new Promise(function(_0x4d1393,_0x262b32){var _0x39518e=_['values'](_0x531047[_0xfbed('0x7a')]);_0x4d1393({'count':_0x39518e[_0xfbed('0x5c')],'rows':_0x39518e});});},'Outbound':function(_0x121e6b){return new Promise(function(_0x2649f3,_0x13dcfa){_0x2649f3(_0x531047[_0xfbed('0x7b')]);});},'Campaigns':function(_0x37785d){return new Promise(function(_0x3a8f5a,_0x4e5460){var _0x32297e=_['values'](_0x531047['campaigns']);_0x3a8f5a({'count':_0x32297e[_0xfbed('0x5c')],'rows':_0x32297e});});},'VoiceQueuesPreview':function(_0x972ab5){var _0x5936dc=this;return new Promise(function(_0x5b92a2,_0x4366b3){_0x47f7fc[_0xfbed('0x7c')](_0x972ab5['id'])[_0xfbed('0x22')](function(_0x5ea745){_0x5b92a2({'code':0xc8,'message':_0x5ea745[_0xfbed('0x1d')]});})[_0xfbed('0x1b')](function(_0x3a7d92){_0x4366b3(_0x5936dc[_0xfbed('0x1c')](0x1f4,_0x3a7d92[_0xfbed('0x1d')]));});});},'EventManager':function(_0x360dfe){var _0x1c0d22=this;return new Promise(function(_0x492645,_0x2b27f2){if(!_0x360dfe[_0xfbed('0x7d')]){return _0x2b27f2(_0x1c0d22['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xfbed('0x7e')](_0xfbed('0x7f')+_0x360dfe[_0xfbed('0x7d')],_0x360dfe[_0xfbed('0x1d')]);_0x492645({'code':0xc8,'message':_0x360dfe});});},'FaxAccounts':function(_0x1543d0){return new Promise(function(_0x351272,_0x2bef07){var _0x1bd80b=_[_0xfbed('0x73')](_0x531047[_0xfbed('0x80')]);_0x351272({'count':_0x1bd80b['length'],'rows':_0x1bd80b});});},'SendFax':function(_0x57f026){var _0x3cf1f1=this;return new Promise(function(_0x58a1ee,_0x3b0a65){_0x4c8f00['send'](_0x57f026)[_0xfbed('0x22')](function(_0x361061){_0x58a1ee({'code':0xc8,'message':_0x361061[_0xfbed('0x1d')]});})[_0xfbed('0x1b')](function(_0xe9e357){_0x3b0a65(_0x3cf1f1['error'](0x1f4,_0xe9e357[_0xfbed('0x1d')]));});});},'CheckAfterSend':function(_0x132675){var _0x3713cf=this;return new Promise(function(_0x2ec38f,_0x28d93b){_0x4c8f00[_0xfbed('0x81')](_0x132675)[_0xfbed('0x22')](function(_0x5a3269){_0x2ec38f({'code':0xc8,'message':_0x5a3269[_0xfbed('0x1d')]});})[_0xfbed('0x1b')](function(_0x2ed40c){_0x28d93b(_0x3713cf['error'](0x1f4,_0x2ed40c['message']));});});}};var _0x2c4970=jayson['server'](_0xaef696)[_0xfbed('0x82')]();_0x2c4970['on'](_0xfbed('0x1c'),function(_0x53824c){return _0x5b2b27(_0x53824c);});_0x2c4970['listen'](0x232a,_0xfbed('0x83'),function(){console[_0xfbed('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x50aafc(_0xfbed('0x85')+0x232a);});});};