Built motion from commit (unavailable).|2.4.8
[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 _0x674b=['strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','waiting','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','length','values','channels','voicechannel','validate','map','find','uniqueid','channel','%s.%s','filename','wav','monitors','/var/spool/asterisk/monitor/','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','toLowerCase','resolve','StopMixMonitor','destinationchannel','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','telephones','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','Action','then','catch','message','command','Command','content','voiceQueues','hasOwnProperty'];(function(_0x2133a6,_0x114585){var _0x574008=function(_0x3d0a14){while(--_0x3d0a14){_0x2133a6['push'](_0x2133a6['shift']());}};_0x574008(++_0x114585);}(_0x674b,0x167));var _0xb674=function(_0x1c72b8,_0x104b7e){_0x1c72b8=_0x1c72b8-0x0;var _0x191114=_0x674b[_0x1c72b8];return _0x191114;};'use strict';var _=require('lodash');var util=require(_0xb674('0x0'));var jayson=require(_0xb674('0x1'));var schema=require('validate');var BPromise=require(_0xb674('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require('../properties');var ami=require('../ami');exports[_0xb674('0x3')]=function(_0x1372e9,_0x2f1269,_0x3d53e0){return new BPromise(function(_0x483fa5,_0x5b4f06){var _0x35272a={'QueuePause':function(_0x9b33ff){return new Promise(function(_0x2c8598,_0x1f5cab){var _0x5a0e5b=util[_0xb674('0x4')](_0xb674('0x5'),_0xb674('0x6'),_0x9b33ff[_0xb674('0x7')]);if(_0x1372e9[_0xb674('0x8')]&&_0x1372e9[_0xb674('0x8')][_0x5a0e5b]&&_0x1372e9['timers'][_0x5a0e5b][_0xb674('0x9')]){_0x1372e9[_0xb674('0x8')][_0x5a0e5b][_0xb674('0xa')]();}if(_0x1372e9['agents'][_0x5a0e5b]){_0x1372e9[_0xb674('0xb')][_0x5a0e5b][_0xb674('0xc')]({'statePause':_0x9b33ff[_0xb674('0xd')]?!![]:![]});}_0x2c8598({'code':0xc8,'message':_0xb674('0xe')});});},'Reload':function(_0x36c1b1){var _0x19b048=this;return new Promise(function(_0x2a0b99,_0x1b014e){if(ami[_0xb674('0xf')]()==![]){return _0x1b014e(_0x19b048[_0xb674('0x10')](0x1f4,[config[_0xb674('0x11')]['ip'],config['asterisk'][_0xb674('0x12')],_0xb674('0x13')][_0xb674('0x14')]('\x20')));}_0x36c1b1=_['pick'](_0x36c1b1,_[_0xb674('0x15')](properties[_0xb674('0x16')]));_0x36c1b1[_0xb674('0x17')]=_0xb674('0x18');return ami[_0xb674('0x19')](_0x36c1b1)[_0xb674('0x1a')](function(_0x2696e7){_0x2a0b99({'code':0xc8,'message':_0x2696e7['message']});})[_0xb674('0x1b')](function(_0x5f3d8d){_0x1b014e(_0x19b048[_0xb674('0x10')](0x1f5,_0x5f3d8d[_0xb674('0x1c')]));});});},'Command':function(_0x4fbca3){var _0x365d3b=this;return new Promise(function(_0x33359b,_0x35e49e){if(ami[_0xb674('0xf')]()==![]){return _0x35e49e(_0x365d3b[_0xb674('0x10')](0x1f4,[config[_0xb674('0x11')]['ip'],config['asterisk'][_0xb674('0x12')],'ami\x20disconnected']['join']('\x20')));}_0x4fbca3=_['pick'](_0x4fbca3,_0xb674('0x1d'));_0x4fbca3[_0xb674('0x17')]=_0xb674('0x1e');return ami[_0xb674('0x19')](_0x4fbca3)[_0xb674('0x1a')](function(_0x562e4b){_0x33359b({'code':0xc8,'message':_0x562e4b[_0xb674('0x1f')]});})['catch'](function(_0x1f5232){_0x35e49e(_0x365d3b[_0xb674('0x10')](0x1f5,_0x1f5232[_0xb674('0x1c')]));});});},'VoiceQueues':function(_0x2aadbc){return new Promise(function(_0x35db10,_0x432b85){var _0x3708aa=[];for(var _0x168517 in _0x1372e9[_0xb674('0x20')]){if(_0x1372e9[_0xb674('0x20')][_0xb674('0x21')](_0x168517)){var _0xe577ac=_0x1372e9[_0xb674('0x20')][_0x168517];var _0x1b739a={'id':_0xe577ac['id'],'name':_0xe577ac[_0xb674('0x7')],'strategy':_0xe577ac[_0xb674('0x22')],'answered':_0xe577ac[_0xb674('0x23')],'available':_0xe577ac[_0xb674('0x24')],'loggedIn':_0xe577ac[_0xb674('0x25')],'pTalking':_0xe577ac[_0xb674('0x26')],'sumBillable':_0xe577ac[_0xb674('0x27')],'sumDuration':_0xe577ac[_0xb674('0x28')],'sumHoldTime':_0xe577ac['sumHoldTime']||0x0,'talking':_0xe577ac[_0xb674('0x29')],'total':_0xe577ac['total'],'type':_0xe577ac['type'],'unmanaged':_0xe577ac[_0xb674('0x2a')],'abandoned':_0xe577ac[_0xb674('0x2b')],'waiting':_0xe577ac[_0xb674('0x2c')],'loggedInDb':_0xe577ac['loggedInDb']};if(_0xe577ac[_0xb674('0x2d')]===_0xb674('0x2e')){_0x1b739a[_0xb674('0x2f')]=_0xe577ac['dialActive'];_0x1b739a['dialMethod']=_0xe577ac[_0xb674('0x30')];_0x1b739a[_0xb674('0x31')]=_0xe577ac[_0xb674('0x31')];_0x1b739a['dialOriginateCallerIdNumber']=_0xe577ac[_0xb674('0x32')];_0x1b739a[_0xb674('0x33')]=_0xe577ac['dialOriginateTimeout'];_0x1b739a[_0xb674('0x34')]=_0xe577ac[_0xb674('0x34')];_0x1b739a['outboundAnswerAgiCallsDay']=_0xe577ac['outboundAnswerAgiCallsDay'];_0x1b739a[_0xb674('0x35')]=_0xe577ac[_0xb674('0x35')];_0x1b739a[_0xb674('0x36')]=_0xe577ac['outboundBlacklistCallsDay'];_0x1b739a[_0xb674('0x37')]=_0xe577ac[_0xb674('0x37')];_0x1b739a[_0xb674('0x38')]=_0xe577ac[_0xb674('0x38')];_0x1b739a[_0xb674('0x39')]=_0xe577ac[_0xb674('0x39')];_0x1b739a[_0xb674('0x3a')]=_0xe577ac[_0xb674('0x3a')];_0x1b739a['outboundDropCallsDayTimeout']=_0xe577ac[_0xb674('0x3b')];_0x1b739a[_0xb674('0x3c')]=_0xe577ac[_0xb674('0x3c')];_0x1b739a['outboundNoSuchCallsDay']=_0xe577ac[_0xb674('0x3d')];_0x1b739a['outboundOriginateFailureCallsDay']=_0xe577ac[_0xb674('0x3e')];_0x1b739a[_0xb674('0x3f')]=_0xe577ac[_0xb674('0x3f')];_0x1b739a[_0xb674('0x40')]=_0xe577ac[_0xb674('0x40')];_0x1b739a['outboundUnknownCallsDay']=_0xe577ac[_0xb674('0x41')];_0x1b739a[_0xb674('0x42')]=_0xe577ac[_0xb674('0x42')];_0x1b739a[_0xb674('0x43')]=_0xe577ac[_0xb674('0x43')];_0x1b739a[_0xb674('0x44')]=_0xe577ac[_0xb674('0x44')];_0x1b739a[_0xb674('0x45')]=_0xe577ac[_0xb674('0x45')];_0x1b739a['predictiveIntervalDroppedCallsTimeout']=_0xe577ac[_0xb674('0x46')];_0x1b739a[_0xb674('0x47')]=_0xe577ac['predictiveIntervalErlangCalls'];_0x1b739a['predictiveIntervalErlangCallsDroppedCalls']=_0xe577ac['predictiveIntervalErlangCallsDroppedCalls'];_0x1b739a[_0xb674('0x48')]=_0xe577ac[_0xb674('0x48')];_0x1b739a[_0xb674('0x49')]=_0xe577ac[_0xb674('0x49')];_0x1b739a[_0xb674('0x4a')]=_0xe577ac[_0xb674('0x4a')];_0x1b739a['predictiveIntervalAvailable']=_0xe577ac[_0xb674('0x4b')];_0x1b739a[_0xb674('0x4c')]=_0xe577ac['predictiveIntervalTotalCalls'];_0x1b739a[_0xb674('0x1c')]=_0xe577ac[_0xb674('0x1c')];_0x1b739a[_0xb674('0x4d')]=_0xe577ac[_0xb674('0x4d')];_0x1b739a[_0xb674('0x4e')]=_0xe577ac[_0xb674('0x4e')];_0x1b739a[_0xb674('0x4f')]=_0xe577ac[_0xb674('0x4f')];_0x1b739a[_0xb674('0x50')]=_0xe577ac[_0xb674('0x50')];_0x1b739a[_0xb674('0x51')]=_0xe577ac['erlangBusyFactor'];_0x1b739a[_0xb674('0x52')]=_0xe577ac[_0xb674('0x52')];_0x1b739a[_0xb674('0x53')]=_0xe577ac[_0xb674('0x53')];}if(_0xe577ac['Trunk']){_0x1b739a[_0xb674('0x54')]={'id':_0xe577ac[_0xb674('0x54')]['id'],'name':_0xe577ac[_0xb674('0x54')][_0xb674('0x7')],'active':_0xe577ac[_0xb674('0x54')]['active'],'callerid':_0xe577ac['Trunk']['callerid']};}if(_0xe577ac[_0xb674('0x55')]){_0x1b739a['Interval']={'id':_0xe577ac[_0xb674('0x55')]['id'],'name':_0xe577ac[_0xb674('0x55')][_0xb674('0x7')]};}_0x3708aa[_0xb674('0x56')](_0x1b739a);}}_0x35db10({'count':_0x3708aa[_0xb674('0x57')],'rows':_0x3708aa});});},'VoiceChannels':function(_0x35b79f){return new Promise(function(_0x59b3fd,_0x10d336){var _0x4ed073=_[_0xb674('0x58')](_0x1372e9[_0xb674('0x59')]);_0x59b3fd({'count':_0x4ed073[_0xb674('0x57')],'rows':_0x4ed073});});},'VoiceChannelMixMonitor':function(_0x45fb3b){var _0x5e3474=this;return new Promise(function(_0xe763a6,_0x421442){if(ami['isConnected']()==![]){return _0x421442(_0x5e3474[_0xb674('0x10')](0x1f4,[config[_0xb674('0x11')]['ip'],config['asterisk'][_0xb674('0x12')],'ami\x20disconnected'][_0xb674('0x14')]('\x20')));}var _0x13336f=schema(properties[_0xb674('0x5a')])[_0xb674('0x5b')](_0x45fb3b);if(_0x13336f['length']>0x0){return _0x421442(_0x5e3474[_0xb674('0x10')](0x1f4,_[_0xb674('0x5c')](_0x13336f,_0xb674('0x1c'))[_0xb674('0x14')](',\x20')));}var _0x34aa03=_[_0xb674('0x5d')](_0x1372e9[_0xb674('0x59')],{'uniqueid':_0x45fb3b[_0xb674('0x5e')]});if(_0x34aa03&&_0x34aa03[_0xb674('0x5f')]){var _0x2f49b2=util['format'](_0xb674('0x60'),_0x45fb3b[_0xb674('0x61')]||_0x45fb3b[_0xb674('0x5e')],_0x45fb3b[_0xb674('0x4')]||_0xb674('0x62'));return ami[_0xb674('0x19')]({'action':'MixMonitor','channel':_0x34aa03[_0xb674('0x5f')],'file':_0x2f49b2,'options':'ai(mixmonitorid)'})[_0xb674('0x1a')](function(_0x4c36a5){var _0x44f816=_[_0xb674('0x5d')](_0x34aa03[_0xb674('0x63')],{'filename':_0xb674('0x64')+_0x2f49b2['toLowerCase']()});if(_[_0xb674('0x65')](_0x44f816)){_0x34aa03[_0xb674('0x63')][_0xb674('0x56')]({'filename':_0xb674('0x64')+_0x2f49b2['toLowerCase'](),'createdAt':moment()['format'](_0xb674('0x66')),'mixmonitorid':_0x4c36a5[_0xb674('0x67')],'status':_0xb674('0x68')});}else{_0x44f816[_0xb674('0x67')]=_0x4c36a5[_0xb674('0x67')];_0x44f816[_0xb674('0x69')]=_0xb674('0x68');}_0xe763a6({'code':0xc8,'message':[_0x45fb3b[_0xb674('0x5e')],_0xb674('0x6a'),_0x4c36a5['mixmonitorid']][_0xb674('0x14')]('\x20'),'mixmonitorid':_0x4c36a5[_0xb674('0x67')]});})[_0xb674('0x1b')](function(_0x57e4b4){_0x421442(_0x5e3474[_0xb674('0x10')](0x1f5,[_0x45fb3b['uniqueid'],_0x57e4b4[_0xb674('0x1c')][_0xb674('0x6b')]()][_0xb674('0x14')]('\x20')));});}else{return _0x421442(_0x5e3474[_0xb674('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x292baf){var _0x16320e=this;return new Promise(function(_0x101bb4,_0x3643c8){if(ami[_0xb674('0xf')]()==![]){return _0x3643c8(_0x16320e[_0xb674('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xb674('0x11')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x27abc8=schema(properties['voicechannel'])[_0xb674('0x5b')](_0x292baf);if(_0x27abc8[_0xb674('0x57')]>0x0){return _0x3643c8(_0x16320e['error'](0x1f4,_['map'](_0x27abc8,_0xb674('0x1c'))[_0xb674('0x14')](',\x20')));}var _0x5381f6=_[_0xb674('0x5d')](_0x1372e9[_0xb674('0x59')],{'uniqueid':_0x292baf[_0xb674('0x5e')]});if(_0x5381f6){return BPromise[_0xb674('0x6c')]()[_0xb674('0x1a')](function(){if(_0x5381f6['channel']){return ami[_0xb674('0x19')]({'action':_0xb674('0x6d'),'channel':_0x5381f6['channel'],'mixmonitorid':_0x292baf[_0xb674('0x67')]})[_0xb674('0x1b')](function(_0x2a31af){});}})[_0xb674('0x1a')](function(){if(_0x5381f6[_0xb674('0x6e')]){return ami[_0xb674('0x19')]({'action':'StopMixMonitor','channel':_0x5381f6[_0xb674('0x6e')],'mixmonitorid':_0x292baf[_0xb674('0x67')]})['catch'](function(_0x1248c1){});}})['then'](function(_0x3b5647){var _0x1f4309=_[_0xb674('0x5d')](_0x5381f6[_0xb674('0x63')],{'mixmonitorid':_0x292baf['mixmonitorid']});if(_0x1f4309){_0x1f4309['status']='stop';}})['then'](function(){var _0x3efbcb=util[_0xb674('0x4')](_0xb674('0x60'),_0x292baf['filename']||_0x292baf[_0xb674('0x5e')],_0x292baf['format']||'wav');var _0x5d7c23=_[_0xb674('0x5d')](_0x5381f6[_0xb674('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x3efbcb['toLowerCase']()});if(_0x5d7c23){_0x5d7c23[_0xb674('0x69')]='stop';}})[_0xb674('0x1a')](function(){_0x101bb4({'code':0xc8,'message':[_0x292baf['uniqueid'],'StopMixMonitor\x20Success'][_0xb674('0x14')]('\x20')});})[_0xb674('0x1b')](function(_0x3d3bdd){_0x3643c8(_0x16320e[_0xb674('0x10')](0x1f5,[_0x292baf[_0xb674('0x5e')],_0x3d3bdd[_0xb674('0x1c')][_0xb674('0x6b')]()]['join']('\x20')));});}else{return _0x3643c8(_0x16320e['error'](0x1f5,_0xb674('0x6f')));}});},'VoiceQueuesChannels':function(_0x3d9dce){return new Promise(function(_0x367d95,_0x5abdee){var _0x3a55fc=_[_0xb674('0x58')](_0x1372e9[_0xb674('0x70')]);_0x367d95({'count':_0x3a55fc[_0xb674('0x57')],'rows':_0x3a55fc});});},'VoiceQueuesChannel':function(_0x484fd1){var _0x30f069=this;return new Promise(function(_0x463979,_0x5a37bf){var _0x11cbde=schema(properties[_0xb674('0x71')])[_0xb674('0x5b')](_0x484fd1);if(_0x11cbde['length']>0x0){return _0x5a37bf(_0x30f069[_0xb674('0x10')](0x1f4,_[_0xb674('0x5c')](_0x11cbde,'message')[_0xb674('0x14')](',\x20')));}var _0x1d0441=_[_0xb674('0x5d')](_0x1372e9['queueChannels'],{'uniqueid':_0x484fd1[_0xb674('0x5e')]});if(_0x1d0441){_0x463979(_0x1d0441);}else{return _0x5a37bf(_0x30f069[_0xb674('0x10')](0x1f5,_0xb674('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x3f17aa){var _0x17461a=this;return new Promise(function(_0x46ff08,_0x265952){if(ami[_0xb674('0xf')]()==![]){return _0x265952(_0x17461a[_0xb674('0x10')](0x1f4,[config[_0xb674('0x11')]['ip'],config['asterisk'][_0xb674('0x12')],_0xb674('0x13')]['join']('\x20')));}var _0x3cb2d5=schema(properties[_0xb674('0x72')])[_0xb674('0x5b')](_0x3f17aa);if(_0x3cb2d5[_0xb674('0x57')]>0x0){return _0x265952(_0x17461a[_0xb674('0x10')](0x1f4,_[_0xb674('0x5c')](_0x3cb2d5,'message')[_0xb674('0x14')](',\x20')));}var _0x321736=_[_0xb674('0x5d')](_0x1372e9[_0xb674('0x70')],{'uniqueid':_0x3f17aa[_0xb674('0x5e')]});if(_0x321736&&_0x321736[_0xb674('0x5f')]){return ami['Action']({'action':'Hangup','channel':_0x321736[_0xb674('0x5f')]})[_0xb674('0x1a')](function(_0x650d40){_0x46ff08({'code':0xc8,'message':[_0x3f17aa[_0xb674('0x5e')],_0x650d40[_0xb674('0x1c')][_0xb674('0x6b')]()][_0xb674('0x14')]('\x20')});})[_0xb674('0x1b')](function(_0x1e1df8){_0x265952(_0x17461a[_0xb674('0x10')](0x1f5,[_0x3f17aa[_0xb674('0x5e')],_0x1e1df8[_0xb674('0x1c')][_0xb674('0x6b')]()][_0xb674('0x14')]('\x20')));});}else{return _0x265952(_0x17461a[_0xb674('0x10')](0x1f5,_0xb674('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x435cd1){var _0x437fcf=this;return new Promise(function(_0x2c2a4f,_0xd57a46){if(ami[_0xb674('0xf')]()==![]){return _0xd57a46(_0x437fcf[_0xb674('0x10')](0x1f4,[config[_0xb674('0x11')]['ip'],config[_0xb674('0x11')][_0xb674('0x12')],_0xb674('0x13')][_0xb674('0x14')]('\x20')));}var _0x498c52=schema(properties[_0xb674('0x73')])[_0xb674('0x5b')](_0x435cd1);if(_0x498c52[_0xb674('0x57')]>0x0){return _0xd57a46(_0x437fcf[_0xb674('0x10')](0x1f4,_['map'](_0x498c52,_0xb674('0x1c'))[_0xb674('0x14')](',\x20')));}var _0x1dd62c=_[_0xb674('0x5d')](_0x1372e9['queueChannels'],{'uniqueid':_0x435cd1['uniqueid']});if(_0x1dd62c&&_0x1dd62c[_0xb674('0x5f')]){return ami[_0xb674('0x19')]({'action':'Redirect','channel':_0x1dd62c['channel'],'exten':_0x435cd1[_0xb674('0x74')],'context':_0x435cd1[_0xb674('0x75')]||_0x1dd62c[_0xb674('0x75')],'priority':0x1})[_0xb674('0x1a')](function(_0x25e196){_0x2c2a4f({'code':0xc8,'message':[_0x435cd1[_0xb674('0x5e')],_0x25e196['message'][_0xb674('0x6b')]()][_0xb674('0x14')]('\x20')});})[_0xb674('0x1b')](function(_0x5309b4){_0xd57a46(_0x437fcf[_0xb674('0x10')](0x1f5,[_0x435cd1[_0xb674('0x5e')],_0x5309b4['message'][_0xb674('0x6b')]()]['join']('\x20')));});}else{return _0xd57a46(_0x437fcf['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x5163e4){return new Promise(function(_0x2229e0,_0x4bdec6){var _0x3cb997=_[_0xb674('0x58')](_0x1372e9[_0xb674('0xb')]);_0x2229e0({'count':_0x3cb997['length'],'rows':_0x3cb997});});},'Telephones':function(_0x3deee9){return new Promise(function(_0xa810a0,_0x49ec3c){var _0x44c117=_[_0xb674('0x58')](_0x1372e9[_0xb674('0x76')]);_0xa810a0({'count':_0x44c117[_0xb674('0x57')],'rows':_0x44c117});});},'Trunks':function(_0xd23f63){return new Promise(function(_0x548425,_0x358cd3){var _0x4b649e=_[_0xb674('0x58')](_0x1372e9['trunks']);_0x548425({'count':_0x4b649e[_0xb674('0x57')],'rows':_0x4b649e});});},'OutboundChannels':function(_0xa6ac9b){return new Promise(function(_0x4b50fa,_0x391c6e){var _0x4996b0=_[_0xb674('0x58')](_0x1372e9['outboundChannels']);_0x4b50fa({'count':_0x4996b0[_0xb674('0x57')],'rows':_0x4996b0});});},'Outbound':function(_0x312ac4){return new Promise(function(_0x32f1ef,_0x135f75){_0x32f1ef(_0x1372e9['outbound']);});},'Campaigns':function(_0x258dad){return new Promise(function(_0x1c7c3f,_0x26cff8){var _0x485877=_[_0xb674('0x58')](_0x1372e9['campaigns']);_0x1c7c3f({'count':_0x485877[_0xb674('0x57')],'rows':_0x485877});});},'VoiceQueuesPreview':function(_0x2b107a){var _0x185aa1=this;return new Promise(function(_0x2f0fc3,_0x5d0318){_0x2f1269[_0xb674('0x77')](_0x2b107a['id'])[_0xb674('0x1a')](function(_0x40097a){_0x2f0fc3({'code':0xc8,'message':_0x40097a[_0xb674('0x1c')]});})['catch'](function(_0x3e0567){_0x5d0318(_0x185aa1[_0xb674('0x10')](0x1f4,_0x3e0567[_0xb674('0x1c')]));});});},'EventManager':function(_0x51eaaf){var _0x1b8e7c=this;return new Promise(function(_0x1b67a4,_0x275a0b){if(!_0x51eaaf['event']){return _0x275a0b(_0x1b8e7c[_0xb674('0x10')](0x1f4,_0xb674('0x78')));}ami[_0xb674('0x79')](_0xb674('0x7a')+_0x51eaaf[_0xb674('0x7b')],_0x51eaaf[_0xb674('0x1c')]);_0x1b67a4({'code':0xc8,'message':_0x51eaaf});});},'FaxAccounts':function(_0x130d3d){return new Promise(function(_0xcbf292,_0x41c2e7){var _0x8ebf25=_[_0xb674('0x58')](_0x1372e9[_0xb674('0x7c')]);_0xcbf292({'count':_0x8ebf25['length'],'rows':_0x8ebf25});});},'SendFax':function(_0xddc72){var _0x4bf2fb=this;return new Promise(function(_0x22a780,_0x802a29){_0x3d53e0[_0xb674('0x7d')](_0xddc72)[_0xb674('0x1a')](function(_0x5793e1){_0x22a780({'code':0xc8,'message':_0x5793e1[_0xb674('0x1c')]});})[_0xb674('0x1b')](function(_0x8bb606){_0x802a29(_0x4bf2fb[_0xb674('0x10')](0x1f4,_0x8bb606[_0xb674('0x1c')]));});});},'CheckAfterSend':function(_0xe3f08e){var _0x2375c7=this;return new Promise(function(_0x549c35,_0x511a7){_0x3d53e0[_0xb674('0x7e')](_0xe3f08e)[_0xb674('0x1a')](function(_0x138222){_0x549c35({'code':0xc8,'message':_0x138222[_0xb674('0x1c')]});})[_0xb674('0x1b')](function(_0x12fb82){_0x511a7(_0x2375c7[_0xb674('0x10')](0x1f4,_0x12fb82['message']));});});}};var _0x5432a8=jayson['server'](_0x35272a)[_0xb674('0x7f')]();_0x5432a8['on'](_0xb674('0x10'),function(_0x501f3a){return _0x5b4f06(_0x501f3a);});_0x5432a8['listen'](0x232a,_0xb674('0x80'),function(){console[_0xb674('0x81')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x483fa5(_0xb674('0x82')+0x232a);});});};