Built motion from commit (unavailable).|2.5.30
[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 _0xe931=['available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','values','channels','join','voicechannel','validate','map','uniqueid','format','%s.%s','filename','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','wav','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','SIP','name','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','module','Action','then','catch','error','command','action','Command','content','message','voiceQueues','hasOwnProperty','strategy','answered'];(function(_0x540765,_0x1a3617){var _0xb44158=function(_0x54aedf){while(--_0x54aedf){_0x540765['push'](_0x540765['shift']());}};_0xb44158(++_0x1a3617);}(_0xe931,0x177));var _0x1e93=function(_0x29ec87,_0x70160a){_0x29ec87=_0x29ec87-0x0;var _0x34ba0a=_0xe931[_0x29ec87];return _0x34ba0a;};'use strict';var _=require(_0x1e93('0x0'));var util=require(_0x1e93('0x1'));var jayson=require(_0x1e93('0x2'));var schema=require('validate');var BPromise=require(_0x1e93('0x3'));var moment=require(_0x1e93('0x4'));var config=require(_0x1e93('0x5'));var properties=require(_0x1e93('0x6'));var ami=require(_0x1e93('0x7'));exports[_0x1e93('0x8')]=function(_0x320666,_0x204ee0,_0x25be9f){return new BPromise(function(_0x15cabb,_0x1c15a4){var _0x734380={'QueuePause':function(_0x11bbf9){return new Promise(function(_0x4fea7b,_0xbad6e2){var _0x1c8169=util['format']('%s/%s',_0x1e93('0x9'),_0x11bbf9[_0x1e93('0xa')]);if(_0x320666['timers']&&_0x320666[_0x1e93('0xb')][_0x1c8169]&&_0x320666[_0x1e93('0xb')][_0x1c8169]['timer']){_0x320666[_0x1e93('0xb')][_0x1c8169]['updateAcw']();}if(_0x320666['agents'][_0x1c8169]){_0x320666[_0x1e93('0xc')][_0x1c8169][_0x1e93('0xd')]({'statePause':_0x11bbf9[_0x1e93('0xe')]?!![]:![]});}_0x4fea7b({'code':0xc8,'message':_0x1e93('0xf')});});},'Reload':function(_0x3cc45a){var _0x557cfd=this;return new Promise(function(_0x48a4f7,_0x3825c8){if(ami[_0x1e93('0x10')]()==![]){return _0x3825c8(_0x557cfd['error'](0x1f4,[config[_0x1e93('0x11')]['ip'],config[_0x1e93('0x11')][_0x1e93('0x12')],_0x1e93('0x13')]['join']('\x20')));}_0x3cc45a=_[_0x1e93('0x14')](_0x3cc45a,_[_0x1e93('0x15')](properties[_0x1e93('0x16')]));_0x3cc45a['action']='Reload';return ami[_0x1e93('0x17')](_0x3cc45a)[_0x1e93('0x18')](function(_0x49a27a){_0x48a4f7({'code':0xc8,'message':_0x49a27a['message']});})[_0x1e93('0x19')](function(_0xc44f4c){_0x3825c8(_0x557cfd[_0x1e93('0x1a')](0x1f5,_0xc44f4c['message']));});});},'Command':function(_0x1581ce){var _0x3be7cc=this;return new Promise(function(_0x393f8c,_0x2062e8){if(ami['isConnected']()==![]){return _0x2062e8(_0x3be7cc[_0x1e93('0x1a')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected']['join']('\x20')));}_0x1581ce=_['pick'](_0x1581ce,_0x1e93('0x1b'));_0x1581ce[_0x1e93('0x1c')]=_0x1e93('0x1d');return ami[_0x1e93('0x17')](_0x1581ce)[_0x1e93('0x18')](function(_0x3929a1){_0x393f8c({'code':0xc8,'message':_0x3929a1[_0x1e93('0x1e')]});})[_0x1e93('0x19')](function(_0x48f096){_0x2062e8(_0x3be7cc[_0x1e93('0x1a')](0x1f5,_0x48f096[_0x1e93('0x1f')]));});});},'VoiceQueues':function(_0x5b42ac){return new Promise(function(_0x47cb82,_0x2a396a){var _0x2a3dc3=[];for(var _0x38aa73 in _0x320666[_0x1e93('0x20')]){if(_0x320666['voiceQueues'][_0x1e93('0x21')](_0x38aa73)){var _0x5d7606=_0x320666[_0x1e93('0x20')][_0x38aa73];var _0x22110c={'id':_0x5d7606['id'],'name':_0x5d7606['name'],'strategy':_0x5d7606[_0x1e93('0x22')],'answered':_0x5d7606[_0x1e93('0x23')],'available':_0x5d7606[_0x1e93('0x24')],'loggedIn':_0x5d7606[_0x1e93('0x25')],'pTalking':_0x5d7606[_0x1e93('0x26')],'sumBillable':_0x5d7606[_0x1e93('0x27')],'sumDuration':_0x5d7606[_0x1e93('0x28')],'sumHoldTime':_0x5d7606[_0x1e93('0x29')]||0x0,'talking':_0x5d7606['talking'],'total':_0x5d7606['total'],'type':_0x5d7606[_0x1e93('0x2a')],'unmanaged':_0x5d7606['unmanaged'],'abandoned':_0x5d7606[_0x1e93('0x2b')],'waiting':_0x5d7606[_0x1e93('0x2c')],'loggedInDb':_0x5d7606[_0x1e93('0x2d')]};if(_0x5d7606[_0x1e93('0x2a')]===_0x1e93('0x2e')){_0x22110c[_0x1e93('0x2f')]=_0x5d7606[_0x1e93('0x2f')];_0x22110c['dialMethod']=_0x5d7606[_0x1e93('0x30')];_0x22110c[_0x1e93('0x31')]=_0x5d7606[_0x1e93('0x31')];_0x22110c[_0x1e93('0x32')]=_0x5d7606[_0x1e93('0x32')];_0x22110c['dialOriginateTimeout']=_0x5d7606[_0x1e93('0x33')];_0x22110c[_0x1e93('0x34')]=_0x5d7606[_0x1e93('0x34')];_0x22110c[_0x1e93('0x35')]=_0x5d7606[_0x1e93('0x35')];_0x22110c[_0x1e93('0x36')]=_0x5d7606[_0x1e93('0x36')];_0x22110c['outboundAnswerCallsDay']=_0x5d7606['outboundAnswerCallsDay'];_0x22110c['outboundBlacklistCallsDay']=_0x5d7606[_0x1e93('0x37')];_0x22110c[_0x1e93('0x38')]=_0x5d7606['outboundBusyCallsDay'];_0x22110c[_0x1e93('0x39')]=_0x5d7606[_0x1e93('0x39')];_0x22110c[_0x1e93('0x3a')]=_0x5d7606[_0x1e93('0x3a')];_0x22110c[_0x1e93('0x3b')]=_0x5d7606[_0x1e93('0x3b')];_0x22110c[_0x1e93('0x3c')]=_0x5d7606['outboundDropCallsDayTimeout'];_0x22110c['outboundNoAnswerCallsDay']=_0x5d7606['outboundNoAnswerCallsDay'];_0x22110c[_0x1e93('0x3d')]=_0x5d7606[_0x1e93('0x3d')];_0x22110c[_0x1e93('0x3e')]=_0x5d7606[_0x1e93('0x3e')];_0x22110c[_0x1e93('0x3f')]=_0x5d7606['outboundReCallsDay'];_0x22110c['outboundRejectCallsDay']=_0x5d7606['outboundRejectCallsDay'];_0x22110c['outboundUnknownCallsDay']=_0x5d7606[_0x1e93('0x40')];_0x22110c['predictiveIntervalAnsweredCalls']=_0x5d7606[_0x1e93('0x41')];_0x22110c['predictiveIntervalAvgHoldtime']=_0x5d7606[_0x1e93('0x42')];_0x22110c[_0x1e93('0x43')]=_0x5d7606[_0x1e93('0x43')];_0x22110c[_0x1e93('0x44')]=_0x5d7606['predictiveIntervalDroppedCallsCallersExit'];_0x22110c[_0x1e93('0x45')]=_0x5d7606[_0x1e93('0x45')];_0x22110c[_0x1e93('0x46')]=_0x5d7606[_0x1e93('0x46')];_0x22110c[_0x1e93('0x47')]=_0x5d7606[_0x1e93('0x47')];_0x22110c[_0x1e93('0x48')]=_0x5d7606['predictiveIntervalHitRate'];_0x22110c['predictiveIntervalMultiplicativeFactor']=_0x5d7606['predictiveIntervalMultiplicativeFactor'];_0x22110c[_0x1e93('0x49')]=_0x5d7606[_0x1e93('0x49')];_0x22110c[_0x1e93('0x4a')]=_0x5d7606['predictiveIntervalAvailable'];_0x22110c['predictiveIntervalTotalCalls']=_0x5d7606[_0x1e93('0x4b')];_0x22110c['message']=_0x5d7606[_0x1e93('0x1f')];_0x22110c[_0x1e93('0x4c')]=_0x5d7606[_0x1e93('0x4c')];_0x22110c[_0x1e93('0x4d')]=_0x5d7606[_0x1e93('0x4d')];_0x22110c['erlangCallToSecond']=_0x5d7606[_0x1e93('0x4e')];_0x22110c[_0x1e93('0x4f')]=_0x5d7606[_0x1e93('0x4f')];_0x22110c['erlangBusyFactor']=_0x5d7606[_0x1e93('0x50')];_0x22110c[_0x1e93('0x51')]=_0x5d7606['startPredictive'];_0x22110c[_0x1e93('0x52')]=_0x5d7606[_0x1e93('0x52')];}if(_0x5d7606[_0x1e93('0x53')]){_0x22110c[_0x1e93('0x53')]={'id':_0x5d7606[_0x1e93('0x53')]['id'],'name':_0x5d7606[_0x1e93('0x53')]['name'],'active':_0x5d7606['Trunk'][_0x1e93('0x54')],'callerid':_0x5d7606['Trunk'][_0x1e93('0x55')]};}if(_0x5d7606['Interval']){_0x22110c[_0x1e93('0x56')]={'id':_0x5d7606[_0x1e93('0x56')]['id'],'name':_0x5d7606[_0x1e93('0x56')][_0x1e93('0xa')]};}_0x2a3dc3[_0x1e93('0x57')](_0x22110c);}}_0x47cb82({'count':_0x2a3dc3[_0x1e93('0x58')],'rows':_0x2a3dc3});});},'UpdateVoiceQueue':function(_0x3966b5){return new Promise(function(_0x127471,_0x40c334){var _0x4d4f51=_[_0x1e93('0x59')](_0x320666[_0x1e93('0x20')],{'id':parseInt(_0x3966b5['id'])});var _0xe52f50=_[_0x1e93('0x5a')](_0x3966b5,['id']);if(_0x4d4f51){for(var _0xf0cef0 in _0xe52f50){if(typeof _0xe52f50[_0xf0cef0]!=='undefined'&&typeof _0x4d4f51[_0xf0cef0]!=='undefined'){_0x4d4f51[_0xf0cef0]=_0xe52f50[_0xf0cef0];}}_0x127471(_0x4d4f51);}else{_0x40c334();}});},'VoiceChannels':function(_0x5b7fdf){return new Promise(function(_0x2f501d,_0x2b7c2e){var _0xa14e49=_[_0x1e93('0x5b')](_0x320666[_0x1e93('0x5c')]);_0x2f501d({'count':_0xa14e49[_0x1e93('0x58')],'rows':_0xa14e49});});},'VoiceChannelMixMonitor':function(_0x3e44db){var _0x29924a=this;return new Promise(function(_0x442f93,_0x2d870b){if(ami[_0x1e93('0x10')]()==![]){return _0x2d870b(_0x29924a[_0x1e93('0x1a')](0x1f4,[config[_0x1e93('0x11')]['ip'],config[_0x1e93('0x11')][_0x1e93('0x12')],_0x1e93('0x13')][_0x1e93('0x5d')]('\x20')));}var _0x242da5=schema(properties[_0x1e93('0x5e')])[_0x1e93('0x5f')](_0x3e44db);if(_0x242da5[_0x1e93('0x58')]>0x0){return _0x2d870b(_0x29924a[_0x1e93('0x1a')](0x1f4,_[_0x1e93('0x60')](_0x242da5,_0x1e93('0x1f'))[_0x1e93('0x5d')](',\x20')));}var _0x39e5ef=_[_0x1e93('0x59')](_0x320666[_0x1e93('0x5c')],{'uniqueid':_0x3e44db[_0x1e93('0x61')]});if(_0x39e5ef&&_0x39e5ef['channel']){var _0xab58fa=util[_0x1e93('0x62')](_0x1e93('0x63'),_0x3e44db[_0x1e93('0x64')]||_0x3e44db[_0x1e93('0x61')],_0x3e44db[_0x1e93('0x62')]||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x39e5ef[_0x1e93('0x65')],'file':_0xab58fa,'options':_0x1e93('0x66')})[_0x1e93('0x18')](function(_0x5f483c){var _0x4aa3f8=_[_0x1e93('0x59')](_0x39e5ef[_0x1e93('0x67')],{'filename':_0x1e93('0x68')+_0xab58fa[_0x1e93('0x69')]()});if(_[_0x1e93('0x6a')](_0x4aa3f8)){_0x39e5ef['monitors'][_0x1e93('0x57')]({'filename':_0x1e93('0x68')+_0xab58fa['toLowerCase'](),'createdAt':moment()[_0x1e93('0x62')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5f483c[_0x1e93('0x6b')],'status':'rec'});}else{_0x4aa3f8[_0x1e93('0x6b')]=_0x5f483c['mixmonitorid'];_0x4aa3f8[_0x1e93('0x6c')]=_0x1e93('0x6d');}_0x442f93({'code':0xc8,'message':[_0x3e44db[_0x1e93('0x61')],_0x1e93('0x6e'),_0x5f483c['mixmonitorid']][_0x1e93('0x5d')]('\x20'),'mixmonitorid':_0x5f483c[_0x1e93('0x6b')]});})['catch'](function(_0x49874c){_0x2d870b(_0x29924a[_0x1e93('0x1a')](0x1f5,[_0x3e44db[_0x1e93('0x61')],_0x49874c[_0x1e93('0x1f')][_0x1e93('0x69')]()][_0x1e93('0x5d')]('\x20')));});}else{return _0x2d870b(_0x29924a[_0x1e93('0x1a')](0x1f5,_0x1e93('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x1271b9){var _0x279bf4=this;return new Promise(function(_0x4fd952,_0x5958eb){if(ami['isConnected']()==![]){return _0x5958eb(_0x279bf4[_0x1e93('0x1a')](0x1f4,[config[_0x1e93('0x11')]['ip'],config[_0x1e93('0x11')][_0x1e93('0x12')],'ami\x20disconnected'][_0x1e93('0x5d')]('\x20')));}var _0x43a701=schema(properties[_0x1e93('0x5e')])[_0x1e93('0x5f')](_0x1271b9);if(_0x43a701['length']>0x0){return _0x5958eb(_0x279bf4['error'](0x1f4,_[_0x1e93('0x60')](_0x43a701,_0x1e93('0x1f'))['join'](',\x20')));}var _0x5ab6cc=_['find'](_0x320666['channels'],{'uniqueid':_0x1271b9[_0x1e93('0x61')]});if(_0x5ab6cc){return BPromise[_0x1e93('0x70')]()[_0x1e93('0x18')](function(){if(_0x5ab6cc[_0x1e93('0x65')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x5ab6cc[_0x1e93('0x65')],'mixmonitorid':_0x1271b9[_0x1e93('0x6b')]})[_0x1e93('0x19')](function(_0x22a44a){});}})[_0x1e93('0x18')](function(){if(_0x5ab6cc[_0x1e93('0x71')]){return ami[_0x1e93('0x17')]({'action':_0x1e93('0x72'),'channel':_0x5ab6cc[_0x1e93('0x71')],'mixmonitorid':_0x1271b9[_0x1e93('0x6b')]})[_0x1e93('0x19')](function(_0x466d3f){});}})[_0x1e93('0x18')](function(_0x4f549c){var _0x57cee4=_[_0x1e93('0x59')](_0x5ab6cc[_0x1e93('0x67')],{'mixmonitorid':_0x1271b9[_0x1e93('0x6b')]});if(_0x57cee4){_0x57cee4[_0x1e93('0x6c')]=_0x1e93('0x73');}})['then'](function(){var _0xd1f73e=util[_0x1e93('0x62')]('%s.%s',_0x1271b9[_0x1e93('0x64')]||_0x1271b9[_0x1e93('0x61')],_0x1271b9['format']||_0x1e93('0x74'));var _0x507c56=_[_0x1e93('0x59')](_0x5ab6cc[_0x1e93('0x67')],{'filename':_0x1e93('0x68')+_0xd1f73e[_0x1e93('0x69')]()});if(_0x507c56){_0x507c56['status']='stop';}})[_0x1e93('0x18')](function(){_0x4fd952({'code':0xc8,'message':[_0x1271b9[_0x1e93('0x61')],'StopMixMonitor\x20Success'][_0x1e93('0x5d')]('\x20')});})[_0x1e93('0x19')](function(_0x4ffb71){_0x5958eb(_0x279bf4[_0x1e93('0x1a')](0x1f5,[_0x1271b9[_0x1e93('0x61')],_0x4ffb71[_0x1e93('0x1f')][_0x1e93('0x69')]()][_0x1e93('0x5d')]('\x20')));});}else{return _0x5958eb(_0x279bf4['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4fe662){return new Promise(function(_0x30c250,_0x341bea){var _0x5aa160=_[_0x1e93('0x5b')](_0x320666[_0x1e93('0x75')]);_0x30c250({'count':_0x5aa160[_0x1e93('0x58')],'rows':_0x5aa160});});},'VoiceQueuesChannel':function(_0x51954f){var _0x11cec0=this;return new Promise(function(_0x790ec2,_0x31b7ac){var _0x94804b=schema(properties['voicequeuechannel'])[_0x1e93('0x5f')](_0x51954f);if(_0x94804b[_0x1e93('0x58')]>0x0){return _0x31b7ac(_0x11cec0[_0x1e93('0x1a')](0x1f4,_['map'](_0x94804b,'message')[_0x1e93('0x5d')](',\x20')));}var _0x4ae789=_[_0x1e93('0x59')](_0x320666[_0x1e93('0x75')],{'uniqueid':_0x51954f[_0x1e93('0x61')]});if(_0x4ae789){_0x790ec2(_0x4ae789);}else{return _0x31b7ac(_0x11cec0['error'](0x1f5,_0x1e93('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x21f3fa){var _0xd8f1fd=this;return new Promise(function(_0x1b9b67,_0xadf3f){if(ami['isConnected']()==![]){return _0xadf3f(_0xd8f1fd[_0x1e93('0x1a')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x1e93('0x12')],_0x1e93('0x13')][_0x1e93('0x5d')]('\x20')));}var _0x4661bb=schema(properties[_0x1e93('0x76')])[_0x1e93('0x5f')](_0x21f3fa);if(_0x4661bb[_0x1e93('0x58')]>0x0){return _0xadf3f(_0xd8f1fd[_0x1e93('0x1a')](0x1f4,_[_0x1e93('0x60')](_0x4661bb,_0x1e93('0x1f'))[_0x1e93('0x5d')](',\x20')));}var _0x70f4af=_[_0x1e93('0x59')](_0x320666[_0x1e93('0x75')],{'uniqueid':_0x21f3fa['uniqueid']});if(_0x70f4af&&_0x70f4af['channel']){return ami[_0x1e93('0x17')]({'action':'Hangup','channel':_0x70f4af['channel']})[_0x1e93('0x18')](function(_0x48ef73){_0x1b9b67({'code':0xc8,'message':[_0x21f3fa[_0x1e93('0x61')],_0x48ef73[_0x1e93('0x1f')][_0x1e93('0x69')]()]['join']('\x20')});})['catch'](function(_0x33e3b2){_0xadf3f(_0xd8f1fd[_0x1e93('0x1a')](0x1f5,[_0x21f3fa['uniqueid'],_0x33e3b2['message'][_0x1e93('0x69')]()][_0x1e93('0x5d')]('\x20')));});}else{return _0xadf3f(_0xd8f1fd[_0x1e93('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0xe3faef){var _0xb98450=this;return new Promise(function(_0x2f4082,_0x3e7b47){if(ami[_0x1e93('0x10')]()==![]){return _0x3e7b47(_0xb98450[_0x1e93('0x1a')](0x1f4,[config[_0x1e93('0x11')]['ip'],config[_0x1e93('0x11')][_0x1e93('0x12')],_0x1e93('0x13')]['join']('\x20')));}var _0x5f0352=schema(properties[_0x1e93('0x77')])['validate'](_0xe3faef);if(_0x5f0352[_0x1e93('0x58')]>0x0){return _0x3e7b47(_0xb98450[_0x1e93('0x1a')](0x1f4,_[_0x1e93('0x60')](_0x5f0352,_0x1e93('0x1f'))['join'](',\x20')));}var _0x3d3401=_['find'](_0x320666[_0x1e93('0x75')],{'uniqueid':_0xe3faef[_0x1e93('0x61')]});if(_0x3d3401&&_0x3d3401[_0x1e93('0x65')]){return ami[_0x1e93('0x17')]({'action':_0x1e93('0x78'),'channel':_0x3d3401[_0x1e93('0x65')],'exten':_0xe3faef[_0x1e93('0x79')],'context':_0xe3faef['context']||_0x3d3401[_0x1e93('0x7a')],'priority':0x1})['then'](function(_0x2a203c){_0x2f4082({'code':0xc8,'message':[_0xe3faef['uniqueid'],_0x2a203c[_0x1e93('0x1f')]['toLowerCase']()][_0x1e93('0x5d')]('\x20')});})[_0x1e93('0x19')](function(_0x3ace9d){_0x3e7b47(_0xb98450['error'](0x1f5,[_0xe3faef[_0x1e93('0x61')],_0x3ace9d[_0x1e93('0x1f')][_0x1e93('0x69')]()]['join']('\x20')));});}else{return _0x3e7b47(_0xb98450[_0x1e93('0x1a')](0x1f5,_0x1e93('0x6f')));}});},'Agents':function(_0x2ce087){return new Promise(function(_0x500f70,_0x13f88d){var _0x5c44d7=_[_0x1e93('0x5b')](_0x320666[_0x1e93('0xc')]);_0x500f70({'count':_0x5c44d7[_0x1e93('0x58')],'rows':_0x5c44d7});});},'Telephones':function(_0x11a235){return new Promise(function(_0x33a126,_0x2f7829){var _0x739d29=_[_0x1e93('0x5b')](_0x320666[_0x1e93('0x7b')]);_0x33a126({'count':_0x739d29['length'],'rows':_0x739d29});});},'Trunks':function(_0x5558f6){return new Promise(function(_0x1381b5,_0x1212c0){var _0x2bdcee=_[_0x1e93('0x5b')](_0x320666[_0x1e93('0x7c')]);_0x1381b5({'count':_0x2bdcee[_0x1e93('0x58')],'rows':_0x2bdcee});});},'OutboundChannels':function(_0x472580){return new Promise(function(_0x5eb722,_0x4efe45){var _0x1e9c77=_['values'](_0x320666['outboundChannels']);_0x5eb722({'count':_0x1e9c77[_0x1e93('0x58')],'rows':_0x1e9c77});});},'Outbound':function(_0x3a24d){return new Promise(function(_0x4b8737,_0x5144bf){_0x4b8737(_0x320666[_0x1e93('0x2e')]);});},'Campaigns':function(_0x356eaa){return new Promise(function(_0x5ac65f,_0x11523e){var _0x51d37b=_[_0x1e93('0x5b')](_0x320666[_0x1e93('0x7d')]);_0x5ac65f({'count':_0x51d37b['length'],'rows':_0x51d37b});});},'VoiceQueuesPreview':function(_0x11bf6a){var _0x557901=this;return new Promise(function(_0x530251,_0x1ed81e){_0x204ee0[_0x1e93('0x7e')](_0x11bf6a['id'])[_0x1e93('0x18')](function(_0x485886){_0x530251({'code':0xc8,'message':_0x485886[_0x1e93('0x1f')]});})['catch'](function(_0x30434a){_0x1ed81e(_0x557901[_0x1e93('0x1a')](0x1f4,_0x30434a[_0x1e93('0x1f')]));});});},'EventManager':function(_0x197b8a){var _0x131742=this;return new Promise(function(_0x4723e1,_0x577357){if(!_0x197b8a['event']){return _0x577357(_0x131742[_0x1e93('0x1a')](0x1f4,_0x1e93('0x7f')));}ami[_0x1e93('0x80')](_0x1e93('0x81')+_0x197b8a['event'],_0x197b8a[_0x1e93('0x1f')]);_0x4723e1({'code':0xc8,'message':_0x197b8a});});},'FaxAccounts':function(_0x52edd2){return new Promise(function(_0x228b01,_0xba2941){var _0x518720=_[_0x1e93('0x5b')](_0x320666[_0x1e93('0x82')]);_0x228b01({'count':_0x518720[_0x1e93('0x58')],'rows':_0x518720});});},'SendFax':function(_0x29e76e){var _0x1988f7=this;return new Promise(function(_0x417a39,_0x1c5407){_0x25be9f[_0x1e93('0x83')](_0x29e76e)['then'](function(_0x3332f8){_0x417a39({'code':0xc8,'message':_0x3332f8[_0x1e93('0x1f')]});})[_0x1e93('0x19')](function(_0x2389f2){_0x1c5407(_0x1988f7[_0x1e93('0x1a')](0x1f4,_0x2389f2[_0x1e93('0x1f')]));});});},'CheckAfterSend':function(_0x33fc3b){var _0x2a9dd9=this;return new Promise(function(_0x5bddf2,_0x5bc8f7){_0x25be9f[_0x1e93('0x84')](_0x33fc3b)[_0x1e93('0x18')](function(_0x4cfd66){_0x5bddf2({'code':0xc8,'message':_0x4cfd66['message']});})['catch'](function(_0x328b5e){_0x5bc8f7(_0x2a9dd9[_0x1e93('0x1a')](0x1f4,_0x328b5e[_0x1e93('0x1f')]));});});}};var _0x58600d=jayson[_0x1e93('0x85')](_0x734380)[_0x1e93('0x86')]();_0x58600d['on'](_0x1e93('0x1a'),function(_0x16fd51){return _0x1c15a4(_0x16fd51);});_0x58600d[_0x1e93('0x8')](0x232a,'127.0.0.1',function(){console[_0x1e93('0x87')](_0x1e93('0x88'),0x232a);return _0x15cabb('RPC\x20listening\x20on\x20port:'+0x232a);});});};