Built motion from commit (unavailable).|2.5.17
[motion2.git] / server / services / ami / report / voiceCallReport.js
index 8e7b2cc..04d0300 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf6b3=['milliseconds','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','error','syncNewChannel','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','context','from-sip','split','exten','user:%s','name','user:agentconnect','[syncNewChannel][VoiceCallReport]','application','applicationdata','appdata','duration','subtract','includes','lastdata','startsWith','match','inspect','answered','answertime','holdtime','diff','seconds','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','.WAV','monitors','rec','variable','value','callerid','type','xmd-queue','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','sipcallid','sipcalluniqueid','mixmonitor_filename','parse','syncMixMonitorFilename','sipcalllinkedid','endtime','billableseconds','omit','destconnectedlinenum','user:agentcomplete','accountcode','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','transferconnectedlinenum','origtransfereruniqueid','transfereecalleridnum','extension','syncHangup','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime'];(function(_0x596480,_0x36c9c2){var _0x37094a=function(_0x337604){while(--_0x337604){_0x596480['push'](_0x596480['shift']());}};_0x37094a(++_0x36c9c2);}(_0xf6b3,0x97));var _0x3f6b=function(_0x4ab846,_0x1079ba){_0x4ab846=_0x4ab846-0x0;var _0x2f5a1f=_0xf6b3[_0x4ab846];return _0x2f5a1f;};'use strict';var BPromise=require(_0x3f6b('0x0'));var _=require('lodash');var moment=require(_0x3f6b('0x1'));var util=require(_0x3f6b('0x2'));var path=require(_0x3f6b('0x3'));var Redis=require(_0x3f6b('0x4'));var config=require(_0x3f6b('0x5'));var logger=require(_0x3f6b('0x6'))('ami');var ami=require(_0x3f6b('0x7'));var Channel=require(_0x3f6b('0x8'));var statusDesc=['unknown',_0x3f6b('0x9'),_0x3f6b('0xa'),'busy',_0x3f6b('0xb'),_0x3f6b('0xc'),_0x3f6b('0xd'),_0x3f6b('0xe'),'onhold'];var applications=[_0x3f6b('0xf'),_0x3f6b('0x10'),_0x3f6b('0x11'),_0x3f6b('0x12'),'playback',_0x3f6b('0x13')];var dispositions=[_0x3f6b('0x14'),_0x3f6b('0x15'),_0x3f6b('0x15'),_0x3f6b('0x14'),_0x3f6b('0x14'),_0x3f6b('0x14'),_0x3f6b('0x16'),_0x3f6b('0x17'),_0x3f6b('0x15'),_0x3f6b('0x15'),_0x3f6b('0x15')];var actions={};config['redis']=_['defaults'](config[_0x3f6b('0x18')],{'host':_0x3f6b('0x19'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f6b('0x18')]));function VoiceCallReport(_0x1564a2){this['channels']=_0x1564a2[_0x3f6b('0x1a')];this[_0x3f6b('0x1b')]=_0x1564a2['agents'];ami['on'](_0x3f6b('0x1c'),this[_0x3f6b('0x1d')][_0x3f6b('0x1e')](this));ami['on'](_0x3f6b('0x1f'),this[_0x3f6b('0x1d')][_0x3f6b('0x1e')](this));ami['on'](_0x3f6b('0x20'),this['syncNewChannel'][_0x3f6b('0x1e')](this));ami['on'](_0x3f6b('0x21'),this[_0x3f6b('0x22')][_0x3f6b('0x1e')](this));ami['on']('varset',this[_0x3f6b('0x23')][_0x3f6b('0x1e')](this));ami['on'](_0x3f6b('0x24'),this['syncHangup'][_0x3f6b('0x1e')](this));ami['on'](_0x3f6b('0x25'),this[_0x3f6b('0x26')]['bind'](this));ami['on'](_0x3f6b('0x27'),this[_0x3f6b('0x28')][_0x3f6b('0x1e')](this));ami['on']('blindtransfer',this[_0x3f6b('0x29')][_0x3f6b('0x1e')](this));ami['on'](_0x3f6b('0x2a'),this[_0x3f6b('0x2b')][_0x3f6b('0x1e')](this));ami['on'](_0x3f6b('0x2c'),this[_0x3f6b('0x2d')]['bind'](this));return BPromise[_0x3f6b('0x2e')]()[_0x3f6b('0x2f')](ami[_0x3f6b('0x30')]())['catch'](function(_0x28eefc){console[_0x3f6b('0x31')](_0x28eefc);});}VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x33')]=function(_0x33d442){return _0x33d442!==null&&!_[_0x3f6b('0x34')](_0x33d442);};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x35')]=function(_0x5a23eb,_0x21bb26,_0x1385e6){io['to'](_0x5a23eb)[_0x3f6b('0x35')](_0x21bb26,_0x1385e6);};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x26')]=function(_0x419626){try{if(this[_0x3f6b('0x33')](_0x419626)){if(_0x419626[_0x3f6b('0x36')]===_0x419626[_0x3f6b('0x37')]){if(!_[_0x3f6b('0x34')](this['channels'][_0x419626[_0x3f6b('0x36')]])){_[_0x3f6b('0x38')](this[_0x3f6b('0x1a')][_0x419626[_0x3f6b('0x36')]],_[_0x3f6b('0x39')](_0x419626,_['keys'](this[_0x3f6b('0x1a')][_0x419626[_0x3f6b('0x36')]])));}}}}catch(_0x4f3c54){logger[_0x3f6b('0x3a')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x4f3c54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x3b')]=function(_0x9500){try{if(this[_0x3f6b('0x33')](_0x9500)){if(_0x9500['uniqueid']===_0x9500['linkedid']&&_0x9500[_0x3f6b('0x3c')]!=_0x3f6b('0x3d')){if(_[_0x3f6b('0x34')](this[_0x3f6b('0x1a')][_0x9500['uniqueid']])){this[_0x3f6b('0x1a')][_0x9500[_0x3f6b('0x36')]]=new Channel();this[_0x3f6b('0x1a')][_0x9500[_0x3f6b('0x36')]][_0x3f6b('0x3e')]=moment()[_0x3f6b('0x3f')](_0x3f6b('0x40'));this[_0x3f6b('0x1a')][_0x9500[_0x3f6b('0x36')]][_0x3f6b('0x41')]=dispositions[_[_0x3f6b('0x42')](_0x9500[_0x3f6b('0x43')])];_[_0x3f6b('0x38')](this[_0x3f6b('0x1a')][_0x9500[_0x3f6b('0x36')]],_[_0x3f6b('0x39')](_0x9500,_[_0x3f6b('0x44')](this[_0x3f6b('0x1a')][_0x9500[_0x3f6b('0x36')]])));if(_0x9500[_0x3f6b('0x45')]===_0x3f6b('0x46')){if(this[_0x3f6b('0x1b')][_0x9500[_0x3f6b('0x3c')][_0x3f6b('0x47')]('-')[0x0]]){this['agents'][_0x9500['channel'][_0x3f6b('0x47')]('-')[0x0]]['destconnectedlinenum']=_0x9500[_0x3f6b('0x48')];this[_0x3f6b('0x35')](util[_0x3f6b('0x3f')](_0x3f6b('0x49'),this['agents'][_0x9500[_0x3f6b('0x3c')]['split']('-')[0x0]][_0x3f6b('0x4a')]),_0x3f6b('0x4b'),{'destaccountcode':this[_0x3f6b('0x1b')][_0x9500['channel'][_0x3f6b('0x47')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x9500[_0x3f6b('0x48')]});}}}}}}catch(_0xcd3599){logger[_0x3f6b('0x3a')](_0x3f6b('0x4c'),util['inspect'](_0xcd3599,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x1d')]=function(_0x2708df){try{if(this[_0x3f6b('0x33')](_0x2708df)){if(_0x2708df['uniqueid']===_0x2708df[_0x3f6b('0x37')]&&_0x2708df[_0x3f6b('0x48')]!='h'&&_0x2708df[_0x3f6b('0x3c')]!=_0x3f6b('0x3d')){_0x2708df[_0x3f6b('0x4d')]=_0x2708df[_0x3f6b('0x4d')]['toLowerCase']();_0x2708df[_0x3f6b('0x4e')]=(_0x2708df[_0x3f6b('0x4f')]||_0x2708df[_0x3f6b('0x4e')])['toLowerCase']();if(_[_0x3f6b('0x34')](this[_0x3f6b('0x1a')][_0x2708df['uniqueid']])){this[_0x3f6b('0x1a')][_0x2708df['uniqueid']]=new Channel();this[_0x3f6b('0x1a')][_0x2708df[_0x3f6b('0x36')]]['starttime']=_0x2708df[_0x3f6b('0x50')]?moment()[_0x3f6b('0x51')](moment[_0x3f6b('0x50')](_0x2708df[_0x3f6b('0x50')])['seconds'](),'seconds')[_0x3f6b('0x3f')](_0x3f6b('0x40')):moment()[_0x3f6b('0x3f')](_0x3f6b('0x40'));this[_0x3f6b('0x1a')][_0x2708df['uniqueid']]['disposition']='NO\x20ANSWER';}_['merge'](this[_0x3f6b('0x1a')][_0x2708df['uniqueid']],_['pick'](_0x2708df,_[_0x3f6b('0x44')](this[_0x3f6b('0x1a')][_0x2708df[_0x3f6b('0x36')]])));if(_[_0x3f6b('0x52')](applications,_0x2708df[_0x3f6b('0x4d')])){this[_0x3f6b('0x1a')][_0x2708df[_0x3f6b('0x36')]]['lastapplication']=_0x2708df['application'];this['channels'][_0x2708df[_0x3f6b('0x36')]][_0x3f6b('0x53')]=_0x2708df[_0x3f6b('0x4e')];if(_0x2708df[_0x3f6b('0x4d')]==='set'&&_[_0x3f6b('0x54')](_0x2708df[_0x3f6b('0x4e')],'cdr(')){var _0x3947b0=_0x2708df[_0x3f6b('0x4e')][_0x3f6b('0x47')]('=');var _0x2efedc=_0x3947b0[0x0][_0x3f6b('0x55')](/cdr\((.*)\)/);if(_0x2efedc){this[_0x3f6b('0x1a')][_0x2708df[_0x3f6b('0x36')]][_0x2efedc[0x1]]=_0x3947b0[0x1];}}else if(_0x2708df[_0x3f6b('0x4d')]===_0x3f6b('0x10')){this['channels'][_0x2708df['uniqueid']][_0x3f6b('0x10')]=_0x2708df[_0x3f6b('0x4e')]['split'](',')[0x0];}}}}}catch(_0x34088a){logger[_0x3f6b('0x3a')]('[syncNewExten][VoiceCallReport]',util[_0x3f6b('0x56')](_0x34088a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x22')]=function(_0x237b49){try{if(this['isNotNull'](_0x237b49)){if(_0x237b49[_0x3f6b('0x36')]!==_0x237b49[_0x3f6b('0x37')]){if(this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x37')]]){if(_0x237b49[_0x3f6b('0x43')]==='6'){if(!this[_0x3f6b('0x1a')][_0x237b49['linkedid']][_0x3f6b('0x57')]){var _0x5c399d=moment();this['channels'][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x57')]=!![];this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x58')]=_0x5c399d[_0x3f6b('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x237b49['linkedid']][_0x3f6b('0x3e')]){this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x59')]=_0x5c399d[_0x3f6b('0x5a')](this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x3e')],_0x3f6b('0x5b'));}}this['channels'][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x37')]=_0x237b49[_0x3f6b('0x36')];if(_0x237b49[_0x3f6b('0x5c')]!==_0x3f6b('0x5d')){this['channels'][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x5e')]=_0x237b49['calleridnum'];}this['channels'][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x5f')]=_0x237b49[_0x3f6b('0x60')];this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x61')]=_0x237b49[_0x3f6b('0x3c')];this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x41')]=dispositions[_[_0x3f6b('0x42')](_0x237b49[_0x3f6b('0x43')])];if(this[_0x3f6b('0x1b')][_0x237b49['channel'][_0x3f6b('0x47')]('-')[0x0]]){this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x62')]=this[_0x3f6b('0x1b')][_0x237b49[_0x3f6b('0x3c')][_0x3f6b('0x47')]('-')[0x0]]['id'];this['channels'][_0x237b49[_0x3f6b('0x37')]][_0x3f6b('0x63')]=this['agents'][_0x237b49[_0x3f6b('0x3c')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x36')]]){if(_0x237b49[_0x3f6b('0x43')]==='6'){if(this[_0x3f6b('0x1b')][_0x237b49[_0x3f6b('0x3c')][_0x3f6b('0x47')]('-')[0x0]]){this[_0x3f6b('0x1a')][_0x237b49[_0x3f6b('0x36')]]['UserId']=this[_0x3f6b('0x1b')][_0x237b49[_0x3f6b('0x3c')][_0x3f6b('0x47')]('-')[0x0]]['id'];this[_0x3f6b('0x1a')][_0x237b49['uniqueid']]['membername']=this[_0x3f6b('0x1b')][_0x237b49['channel']['split']('-')[0x0]][_0x3f6b('0x4a')];}}}}}}catch(_0x1d3952){logger[_0x3f6b('0x3a')](_0x3f6b('0x64'),util[_0x3f6b('0x56')](_0x1d3952,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')]['syncMixMonitorFilename']=function(_0x2f8d4e,_0x21c067){if(this[_0x3f6b('0x1a')][_0x2f8d4e]){this[_0x3f6b('0x1a')][_0x2f8d4e][_0x3f6b('0x65')]=!![];if(_[_0x3f6b('0x66')](_0x21c067,_0x3f6b('0x67'))){_0x21c067=_0x21c067['replace'](_0x3f6b('0x67'),_0x3f6b('0x68'));}this[_0x3f6b('0x1a')][_0x2f8d4e]['monitorFilename']=_0x21c067;var _0xb1090c=_['find'](this[_0x3f6b('0x1a')][_0x2f8d4e][_0x3f6b('0x69')],{'filename':_0x21c067});if(_['isNil'](_0xb1090c)){this['channels'][_0x2f8d4e][_0x3f6b('0x69')]['push']({'filename':_0x21c067,'createdAt':moment()[_0x3f6b('0x3f')](_0x3f6b('0x40')),'mixmonitorid':'','status':_0x3f6b('0x6a')});}}};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x23')]=function(_0xbd4b5d){try{if(this[_0x3f6b('0x33')](_0xbd4b5d)){if(this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]]&&_0xbd4b5d[_0x3f6b('0x3c')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0xbd4b5d[_0x3f6b('0x6b')])){if(this[_0x3f6b('0x33')](_0xbd4b5d[_0x3f6b('0x6b')]['mixmonitor_filename'])){this['syncMixMonitorFilename'](_0xbd4b5d[_0x3f6b('0x36')],_0xbd4b5d[_0x3f6b('0x6c')]);}else if(this[_0x3f6b('0x33')](_0xbd4b5d['variable']['xmd-phone'])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]]['calleridnum']=_0xbd4b5d['value'];}else if(this['isNotNull'](_0xbd4b5d['variable']['xmd-callerid'])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]][_0x3f6b('0x6d')]=_0xbd4b5d[_0x3f6b('0x6c')];}else if(this[_0x3f6b('0x33')](_0xbd4b5d[_0x3f6b('0x6b')]['xmd-cdrtype'])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]][_0x3f6b('0x6e')]=_0xbd4b5d[_0x3f6b('0x6c')];}else if(this[_0x3f6b('0x33')](_0xbd4b5d[_0x3f6b('0x6b')][_0x3f6b('0x6f')])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]][_0x3f6b('0x10')]=_0xbd4b5d[_0x3f6b('0x6c')]['split'](',')[0x0];}else if(this[_0x3f6b('0x33')](_0xbd4b5d[_0x3f6b('0x6b')][_0x3f6b('0x70')])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]]['originatecalleridnum']=_0xbd4b5d[_0x3f6b('0x6c')];}else if(this['isNotNull'](_0xbd4b5d[_0x3f6b('0x6b')][_0x3f6b('0x71')])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]][_0x3f6b('0x72')]=_0xbd4b5d[_0x3f6b('0x6c')];}else if(this['isNotNull'](_0xbd4b5d['variable'][_0x3f6b('0x73')])){this['channels'][_0xbd4b5d[_0x3f6b('0x36')]]['calleridpreview']=_0xbd4b5d['value'];}else if(this[_0x3f6b('0x33')](_0xbd4b5d[_0x3f6b('0x6b')]['xmcs-queue'])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]][_0x3f6b('0x10')]=_0xbd4b5d[_0x3f6b('0x6c')];}else if(this[_0x3f6b('0x33')](_0xbd4b5d['variable'][_0x3f6b('0x74')])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x36')]][_0x3f6b('0x75')]=_0xbd4b5d['value'];}}}else if(this['isNotNull'](_0xbd4b5d['variable'][_0x3f6b('0x76')])){if(_0xbd4b5d[_0x3f6b('0x6c')]){var _0x2d28f4=path[_0x3f6b('0x77')](_0xbd4b5d[_0x3f6b('0x6c')])['name'];this[_0x3f6b('0x78')](_0x2d28f4,_0xbd4b5d[_0x3f6b('0x6c')]);}}else if(this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x37')]]){if(this['isNotNull'](_0xbd4b5d['variable'])){if(this['isNotNull'](_0xbd4b5d['variable'][_0x3f6b('0x74')])){this[_0x3f6b('0x1a')][_0xbd4b5d[_0x3f6b('0x37')]][_0x3f6b('0x79')]=_0xbd4b5d[_0x3f6b('0x6c')];}}}}}catch(_0xe04212){logger[_0x3f6b('0x3a')]('[syncVarSet][VoiceCallReport]',util[_0x3f6b('0x56')](_0xe04212,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')]['syncHangup']=function(_0x1bc97c){try{if(this[_0x3f6b('0x33')](_0x1bc97c)){if(this['channels'][_0x1bc97c['uniqueid']]){var _0x38b3b6=moment();this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]][_0x3f6b('0x7a')]=_0x38b3b6[_0x3f6b('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]][_0x3f6b('0x50')]=_0x38b3b6['diff'](this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]][_0x3f6b('0x3e')],_0x3f6b('0x5b'));if(this['channels'][_0x1bc97c['uniqueid']][_0x3f6b('0x57')]){this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]][_0x3f6b('0x7b')]=_0x38b3b6[_0x3f6b('0x5a')](this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]][_0x3f6b('0x58')],'seconds');this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]][_0x3f6b('0x59')]=this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]][_0x3f6b('0x50')]-this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]][_0x3f6b('0x7b')];}if(_0x1bc97c['context']===_0x3f6b('0x46')){if(this['agents'][_0x1bc97c['channel'][_0x3f6b('0x47')]('-')[0x0]]){this[_0x3f6b('0x1b')][_0x1bc97c[_0x3f6b('0x3c')][_0x3f6b('0x47')]('-')[0x0]]=_[_0x3f6b('0x7c')](this[_0x3f6b('0x1b')][_0x1bc97c[_0x3f6b('0x3c')][_0x3f6b('0x47')]('-')[0x0]],[_0x3f6b('0x7d')]);this['emit'](util['format'](_0x3f6b('0x49'),this[_0x3f6b('0x1b')][_0x1bc97c[_0x3f6b('0x3c')][_0x3f6b('0x47')]('-')[0x0]][_0x3f6b('0x4a')]),_0x3f6b('0x7e'),{'destaccountcode':this[_0x3f6b('0x1b')][_0x1bc97c['channel']['split']('-')[0x0]][_0x3f6b('0x7f')]});}}ami[_0x3f6b('0x35')]('custom:voiceCallReport',this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]]);delete this[_0x3f6b('0x1a')][_0x1bc97c[_0x3f6b('0x36')]];}}}catch(_0x210f0b){logger['error'](_0x3f6b('0x80'),util[_0x3f6b('0x56')](_0x210f0b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x28')]=function(_0x496283){try{if(this['isNotNull'](_0x496283)){if(this[_0x3f6b('0x1a')][_0x496283['transfereeuniqueid']]){this[_0x3f6b('0x1a')][_0x496283[_0x3f6b('0x81')]]['transfercalleridnum']=_0x496283[_0x3f6b('0x82')];this['channels'][_0x496283[_0x3f6b('0x81')]]['transferconnectedlinenum']=_0x496283[_0x3f6b('0x83')];if(this[_0x3f6b('0x1a')][_0x496283['secondtransfereruniqueid']]){var _0x364352=this[_0x3f6b('0x1a')][_0x496283[_0x3f6b('0x84')]];this['channels'][_0x496283[_0x3f6b('0x84')]]=this[_0x3f6b('0x1a')][_0x496283[_0x3f6b('0x81')]];this[_0x3f6b('0x1a')][_0x496283[_0x3f6b('0x81')]]=_0x364352;}}else if(this[_0x3f6b('0x1a')][_0x496283[_0x3f6b('0x85')]]){this[_0x3f6b('0x1a')][_0x496283['transfertargetuniqueid']][_0x3f6b('0x86')]=_0x496283[_0x3f6b('0x82')];this['channels'][_0x496283[_0x3f6b('0x85')]][_0x3f6b('0x87')]=_0x496283[_0x3f6b('0x83')];if(this['channels'][_0x496283[_0x3f6b('0x88')]]){var _0x364352=this['channels'][_0x496283[_0x3f6b('0x88')]];this[_0x3f6b('0x1a')][_0x496283[_0x3f6b('0x88')]]=this[_0x3f6b('0x1a')][_0x496283['transfertargetuniqueid']];this[_0x3f6b('0x1a')][_0x496283[_0x3f6b('0x85')]]=_0x364352;}}}}catch(_0x2198db){logger[_0x3f6b('0x3a')]('[syncAttendedTransfer][VoiceCallReport]',util[_0x3f6b('0x56')](_0x2198db,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x29')]=function(_0x5c888c){try{if(this[_0x3f6b('0x33')](_0x5c888c)){if(this[_0x3f6b('0x1a')][_0x5c888c[_0x3f6b('0x81')]]){this[_0x3f6b('0x1a')][_0x5c888c[_0x3f6b('0x81')]]['transfercalleridnum']=_0x5c888c[_0x3f6b('0x89')];this[_0x3f6b('0x1a')][_0x5c888c['transfereeuniqueid']][_0x3f6b('0x87')]=_0x5c888c[_0x3f6b('0x8a')];this[_0x3f6b('0x8b')]({'event':_0x3f6b('0x8c'),'uniqueid':_0x5c888c[_0x3f6b('0x81')],'context':_0x5c888c[_0x3f6b('0x45')],'channel':_0x5c888c[_0x3f6b('0x8d')]});}}}catch(_0x34130c){logger[_0x3f6b('0x3a')](_0x3f6b('0x8e'),util[_0x3f6b('0x56')](_0x34130c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')]['syncMusicOnHoldStart']=function(_0x233f54){try{if(this[_0x3f6b('0x33')](_0x233f54)){if(this[_0x3f6b('0x1a')][_0x233f54[_0x3f6b('0x36')]]){if(!_[_0x3f6b('0x8f')](this[_0x3f6b('0x1a')][_0x233f54['uniqueid']][_0x3f6b('0x58')])){this['channels'][_0x233f54[_0x3f6b('0x36')]][_0x3f6b('0x90')]=moment()[_0x3f6b('0x3f')](_0x3f6b('0x40'));}}}}catch(_0x2ae86a){logger[_0x3f6b('0x3a')](_0x3f6b('0x91'),util['inspect'](_0x2ae86a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3f6b('0x32')][_0x3f6b('0x2d')]=function(_0x32ccb8){try{if(this['isNotNull'](_0x32ccb8)){if(this['channels'][_0x32ccb8['uniqueid']]){if(!_[_0x3f6b('0x8f')](this[_0x3f6b('0x1a')][_0x32ccb8[_0x3f6b('0x36')]][_0x3f6b('0x90')])){this['channels'][_0x32ccb8[_0x3f6b('0x36')]][_0x3f6b('0x92')]+=moment()[_0x3f6b('0x93')](0x0)[_0x3f6b('0x5a')](this[_0x3f6b('0x1a')][_0x32ccb8[_0x3f6b('0x36')]][_0x3f6b('0x90')],_0x3f6b('0x5b'));delete this['channels'][_0x32ccb8[_0x3f6b('0x36')]][_0x3f6b('0x90')];}}}}catch(_0x55ed82){logger[_0x3f6b('0x3a')]('[syncMusicOnHoldStop][VoiceCallReport]',util['inspect'](_0x55ed82,{'showHidden':![],'depth':null}));}};module[_0x3f6b('0x94')]=VoiceCallReport;
\ No newline at end of file
+var _0x1890=['pick','from-sip','split','agents','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','format','user:%s','name','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','set','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','membername','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','variable','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','BlindTransfer','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','path','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','invalid','unavailable','ringing','onhold','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','channels','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','uniqueid','debug','inspect','linkedid','merge','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','disposition','toNumber','channelstate'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1890,0x128));var _0x0189=function(_0x1c60e6,_0x5b8787){_0x1c60e6=_0x1c60e6-0x0;var _0x5541e9=_0x1890[_0x1c60e6];return _0x5541e9;};'use strict';var BPromise=require('bluebird');var _=require(_0x0189('0x0'));var moment=require(_0x0189('0x1'));var util=require('util');var path=require(_0x0189('0x2'));var Redis=require('ioredis');var config=require(_0x0189('0x3'));var logger=require(_0x0189('0x4'))('ami');var ami=require(_0x0189('0x5'));var Channel=require(_0x0189('0x6'));var statusDesc=[_0x0189('0x7'),_0x0189('0x8'),_0x0189('0x9'),'busy',_0x0189('0xa'),_0x0189('0xb'),_0x0189('0xc'),'ringinuse',_0x0189('0xd')];var applications=['set',_0x0189('0xe'),_0x0189('0xf'),_0x0189('0x10'),_0x0189('0x11'),_0x0189('0x12')];var dispositions=['NO\x20ANSWER',_0x0189('0x13'),_0x0189('0x13'),'NO\x20ANSWER',_0x0189('0x14'),_0x0189('0x14'),_0x0189('0x15'),'BUSY',_0x0189('0x13'),'FAILED',_0x0189('0x13')];var actions={};config[_0x0189('0x16')]=_['defaults'](config[_0x0189('0x16')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0189('0x16')]));function VoiceCallReport(_0x49b768){this[_0x0189('0x17')]=_0x49b768['channels'];this['agents']=_0x49b768['agents'];this[_0x0189('0x18')]={};ami['on']('coreshowchannel',this[_0x0189('0x19')][_0x0189('0x1a')](this));ami['on'](_0x0189('0x1b'),this[_0x0189('0x19')][_0x0189('0x1a')](this));ami['on'](_0x0189('0x1c'),this[_0x0189('0x1d')][_0x0189('0x1a')](this));ami['on'](_0x0189('0x1e'),this[_0x0189('0x1f')][_0x0189('0x1a')](this));ami['on'](_0x0189('0x20'),this[_0x0189('0x21')]['bind'](this));ami['on'](_0x0189('0x22'),this[_0x0189('0x23')]['bind'](this));ami['on']('newcallerid',this[_0x0189('0x24')][_0x0189('0x1a')](this));ami['on'](_0x0189('0x25'),this[_0x0189('0x26')][_0x0189('0x1a')](this));ami['on']('blindtransfer',this[_0x0189('0x27')]['bind'](this));ami['on'](_0x0189('0x28'),this[_0x0189('0x29')][_0x0189('0x1a')](this));ami['on'](_0x0189('0x2a'),this[_0x0189('0x2b')]['bind'](this));try{logger[_0x0189('0x2c')](_0x0189('0x2d'));ami[_0x0189('0x2e')]();}catch(_0x4b2c20){logger[_0x0189('0x2f')](_0x0189('0x30'),util['inspect'](_0x4b2c20,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0189('0x31')][_0x0189('0x32')]=function(_0x2b80ab){return _0x2b80ab!==null&&!_[_0x0189('0x33')](_0x2b80ab);};VoiceCallReport[_0x0189('0x31')][_0x0189('0x34')]=function(_0x534890,_0x225217,_0x2e88e1){io['to'](_0x534890)[_0x0189('0x34')](_0x225217,_0x2e88e1);};VoiceCallReport[_0x0189('0x31')][_0x0189('0x24')]=function(_0x1fe0d8){try{if(this[_0x0189('0x32')](_0x1fe0d8)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x1fe0d8[_0x0189('0x35')],_0x1fe0d8['calleridname'],_0x1fe0d8['calleridnum']);logger[_0x0189('0x36')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x1fe0d8[_0x0189('0x35')],util[_0x0189('0x37')](_0x1fe0d8,{'showHidden':![],'depth':null}));if(_0x1fe0d8['uniqueid']===_0x1fe0d8[_0x0189('0x38')]){if(!_[_0x0189('0x33')](this[_0x0189('0x17')][_0x1fe0d8[_0x0189('0x35')]])){_[_0x0189('0x39')](this['channels'][_0x1fe0d8[_0x0189('0x35')]],_['pick'](_0x1fe0d8,_['keys'](this[_0x0189('0x17')][_0x1fe0d8[_0x0189('0x35')]])));}}}}catch(_0x35270b){logger['error'](_0x0189('0x3a'),_0x1fe0d8[_0x0189('0x35')],util[_0x0189('0x37')](_0x35270b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')]['syncNewChannel']=function(_0x4ce802){try{if(this[_0x0189('0x32')](_0x4ce802)){logger[_0x0189('0x36')](_0x0189('0x3b'),_0x4ce802[_0x0189('0x35')],util[_0x0189('0x37')](_0x4ce802,{'showHidden':![],'depth':null}));if(_0x4ce802['uniqueid']===_0x4ce802[_0x0189('0x38')]&&_0x4ce802[_0x0189('0x3c')]!='OutgoingSpoolFailed'){if(_[_0x0189('0x33')](this[_0x0189('0x17')][_0x4ce802[_0x0189('0x35')]])){logger[_0x0189('0x2c')](_0x0189('0x3d'),_0x4ce802[_0x0189('0x35')],_0x4ce802[_0x0189('0x3e')],_0x4ce802[_0x0189('0x3f')]);this[_0x0189('0x17')][_0x4ce802[_0x0189('0x35')]]=new Channel();this[_0x0189('0x17')][_0x4ce802[_0x0189('0x35')]][_0x0189('0x40')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0189('0x17')][_0x4ce802[_0x0189('0x35')]][_0x0189('0x41')]=dispositions[_[_0x0189('0x42')](_0x4ce802[_0x0189('0x43')])];_[_0x0189('0x39')](this[_0x0189('0x17')][_0x4ce802[_0x0189('0x35')]],_[_0x0189('0x44')](_0x4ce802,_['keys'](this[_0x0189('0x17')][_0x4ce802['uniqueid']])));if(_0x4ce802['context']===_0x0189('0x45')){if(this['agents'][_0x4ce802[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]]){this[_0x0189('0x47')][_0x4ce802[_0x0189('0x3c')]['split']('-')[0x0]][_0x0189('0x48')]=_0x4ce802[_0x0189('0x3f')];logger['debug'](_0x0189('0x49'),_0x4ce802[_0x0189('0x35')],util['inspect']({'destaccountcode':this['agents'][_0x4ce802['channel'][_0x0189('0x46')]('-')[0x0]][_0x0189('0x4a')],'destconnectedlinenum':_0x4ce802[_0x0189('0x3f')]},{'showHidden':![],'depth':null}));this[_0x0189('0x34')](util[_0x0189('0x4b')](_0x0189('0x4c'),this['agents'][_0x4ce802[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]][_0x0189('0x4d')]),'user:agentconnect',{'destaccountcode':this[_0x0189('0x47')][_0x4ce802[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]][_0x0189('0x4a')],'destconnectedlinenum':_0x4ce802[_0x0189('0x3f')]});}}}}}}catch(_0x4b454c){logger[_0x0189('0x2f')]('[%s][voiceCallReport][newchannel]',_0x4ce802['uniqueid'],util[_0x0189('0x37')](_0x4b454c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')][_0x0189('0x19')]=function(_0x5226e4){try{if(this[_0x0189('0x32')](_0x5226e4)){logger[_0x0189('0x36')](_0x0189('0x4e'),_0x5226e4[_0x0189('0x35')],util[_0x0189('0x37')](_0x5226e4,{'showHidden':![],'depth':null}));if(_0x5226e4[_0x0189('0x35')]===_0x5226e4[_0x0189('0x38')]&&_0x5226e4['exten']!='h'&&_0x5226e4[_0x0189('0x3c')]!=_0x0189('0x4f')){_0x5226e4[_0x0189('0x50')]=_0x5226e4[_0x0189('0x50')][_0x0189('0x51')]();_0x5226e4[_0x0189('0x52')]=(_0x5226e4['appdata']||_0x5226e4[_0x0189('0x52')])[_0x0189('0x51')]();logger['info'](_0x0189('0x53'),_0x5226e4[_0x0189('0x35')],_0x5226e4[_0x0189('0x50')],_0x5226e4[_0x0189('0x52')]);if(_[_0x0189('0x33')](this[_0x0189('0x17')][_0x5226e4[_0x0189('0x35')]])){this[_0x0189('0x17')][_0x5226e4['uniqueid']]=new Channel();this['channels'][_0x5226e4[_0x0189('0x35')]][_0x0189('0x40')]=_0x5226e4[_0x0189('0x54')]?moment()['subtract'](moment['duration'](_0x5226e4[_0x0189('0x54')])[_0x0189('0x55')](),_0x0189('0x55'))[_0x0189('0x4b')](_0x0189('0x56')):moment()['format'](_0x0189('0x56'));this[_0x0189('0x17')][_0x5226e4[_0x0189('0x35')]][_0x0189('0x41')]='NO\x20ANSWER';}_[_0x0189('0x39')](this[_0x0189('0x17')][_0x5226e4[_0x0189('0x35')]],_[_0x0189('0x44')](_0x5226e4,_['keys'](this[_0x0189('0x17')][_0x5226e4['uniqueid']])));if(_[_0x0189('0x57')](applications,_0x5226e4[_0x0189('0x50')])){this[_0x0189('0x17')][_0x5226e4['uniqueid']][_0x0189('0x58')]=_0x5226e4[_0x0189('0x50')];this[_0x0189('0x17')][_0x5226e4[_0x0189('0x35')]][_0x0189('0x59')]=_0x5226e4[_0x0189('0x52')];if(_0x5226e4[_0x0189('0x50')]===_0x0189('0x5a')&&_['startsWith'](_0x5226e4[_0x0189('0x52')],_0x0189('0x5b'))){var _0x52c196=_0x5226e4[_0x0189('0x52')][_0x0189('0x46')]('=');var _0x301411=_0x52c196[0x0]['match'](/cdr\((.*)\)/);if(_0x301411){this['channels'][_0x5226e4[_0x0189('0x35')]][_0x301411[0x1]]=_0x52c196[0x1];}}else if(_0x5226e4[_0x0189('0x50')]==='queue'){this[_0x0189('0x17')][_0x5226e4[_0x0189('0x35')]][_0x0189('0xe')]=_0x5226e4[_0x0189('0x52')][_0x0189('0x46')](',')[0x0];}}}}}catch(_0x47bae2){logger[_0x0189('0x2f')](_0x0189('0x5c'),_0x5226e4[_0x0189('0x35')],util[_0x0189('0x37')](_0x47bae2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')][_0x0189('0x1f')]=function(_0x4d3c21){try{if(this[_0x0189('0x32')](_0x4d3c21)){logger[_0x0189('0x2c')](_0x0189('0x5d'),_0x4d3c21[_0x0189('0x35')],_0x4d3c21['linkedid'],_0x4d3c21[_0x0189('0x5e')],_0x4d3c21[_0x0189('0x5f')]);logger[_0x0189('0x36')](_0x0189('0x60'),_0x4d3c21[_0x0189('0x35')],util[_0x0189('0x37')](_0x4d3c21,{'showHidden':![],'depth':null}));if(_0x4d3c21[_0x0189('0x35')]!==_0x4d3c21[_0x0189('0x38')]){if(this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x38')]]){if(_0x4d3c21[_0x0189('0x43')]==='6'){if(!this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x38')]][_0x0189('0x61')]){var _0x500567=moment();this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x38')]][_0x0189('0x61')]=!![];this[_0x0189('0x17')][_0x4d3c21['linkedid']][_0x0189('0x62')]=_0x500567[_0x0189('0x4b')](_0x0189('0x56'));if(this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x38')]][_0x0189('0x40')]){this[_0x0189('0x17')][_0x4d3c21['linkedid']][_0x0189('0x63')]=_0x500567[_0x0189('0x64')](this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x38')]][_0x0189('0x40')],_0x0189('0x55'));}}this[_0x0189('0x17')][_0x4d3c21['linkedid']][_0x0189('0x38')]=_0x4d3c21[_0x0189('0x35')];if(_0x4d3c21[_0x0189('0x5f')]!==_0x0189('0x65')){this['channels'][_0x4d3c21[_0x0189('0x38')]][_0x0189('0x66')]=_0x4d3c21[_0x0189('0x5f')];}this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x38')]][_0x0189('0x67')]=_0x4d3c21['calleridname'];this[_0x0189('0x17')][_0x4d3c21['linkedid']][_0x0189('0x68')]=_0x4d3c21[_0x0189('0x3c')];this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x38')]][_0x0189('0x41')]=dispositions[_[_0x0189('0x42')](_0x4d3c21[_0x0189('0x43')])];if(this[_0x0189('0x47')][_0x4d3c21['channel'][_0x0189('0x46')]('-')[0x0]]){this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x38')]]['UserId']=this[_0x0189('0x47')][_0x4d3c21['channel']['split']('-')[0x0]]['id'];this['channels'][_0x4d3c21['linkedid']][_0x0189('0x69')]=this[_0x0189('0x47')][_0x4d3c21[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]][_0x0189('0x4d')];}}}}else{if(this['channels'][_0x4d3c21['uniqueid']]){if(_0x4d3c21[_0x0189('0x43')]==='6'){if(this[_0x0189('0x47')][_0x4d3c21['channel'][_0x0189('0x46')]('-')[0x0]]){this['channels'][_0x4d3c21[_0x0189('0x35')]][_0x0189('0x6a')]=this[_0x0189('0x47')][_0x4d3c21[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]]['id'];this[_0x0189('0x17')][_0x4d3c21[_0x0189('0x35')]][_0x0189('0x69')]=this[_0x0189('0x47')][_0x4d3c21[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]][_0x0189('0x4d')];}}}}}}catch(_0x17b67c){logger[_0x0189('0x2f')](_0x0189('0x6b'),_0x4d3c21[_0x0189('0x35')],util[_0x0189('0x37')](_0x17b67c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')][_0x0189('0x6c')]=function(_0x15a735,_0x11c7e7){try{if(this[_0x0189('0x17')][_0x15a735]){logger[_0x0189('0x2c')](_0x0189('0x6d'),_0x15a735,_0x11c7e7);this[_0x0189('0x17')][_0x15a735][_0x0189('0x6e')]=!![];if(_[_0x0189('0x6f')](_0x11c7e7,_0x0189('0x70'))){_0x11c7e7=_0x11c7e7[_0x0189('0x71')]('.wav49',_0x0189('0x72'));}this['channels'][_0x15a735][_0x0189('0x73')]=_0x11c7e7;var _0x547bad=_[_0x0189('0x74')](this[_0x0189('0x17')][_0x15a735][_0x0189('0x75')],{'filename':_0x11c7e7});if(_['isNil'](_0x547bad)){this[_0x0189('0x17')][_0x15a735]['monitors'][_0x0189('0x76')]({'filename':_0x11c7e7,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x0189('0x77')});}}}catch(_0x3c103b){logger[_0x0189('0x2f')](_0x0189('0x78'),_0x15a735,util[_0x0189('0x37')](_0x3c103b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')]['syncVarSet']=function(_0x51e898){try{if(this['isNotNull'](_0x51e898)){logger['debug'](_0x0189('0x79'),_0x51e898[_0x0189('0x35')],util[_0x0189('0x37')](_0x51e898,{'showHidden':![],'depth':null}));if(this['channels'][_0x51e898['uniqueid']]&&_0x51e898['channel']!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x51e898['variable'])){if(this[_0x0189('0x32')](_0x51e898['variable']['mixmonitor_filename'])){logger[_0x0189('0x2c')](_0x0189('0x7a'),_0x51e898['uniqueid'],_0x51e898[_0x0189('0x7b')]);this[_0x0189('0x6c')](_0x51e898[_0x0189('0x35')],_0x51e898[_0x0189('0x7b')]);}else if(this['isNotNull'](_0x51e898[_0x0189('0x7c')][_0x0189('0x7d')])){logger[_0x0189('0x2c')](_0x0189('0x7e'),_0x51e898[_0x0189('0x35')],_0x51e898[_0x0189('0x7b')]);this['channels'][_0x51e898[_0x0189('0x35')]]['calleridnum']=_0x51e898[_0x0189('0x7b')];}else if(this[_0x0189('0x32')](_0x51e898['variable']['xmd-callerid'])){logger[_0x0189('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x51e898[_0x0189('0x35')],_0x51e898[_0x0189('0x7b')]);this[_0x0189('0x17')][_0x51e898[_0x0189('0x35')]][_0x0189('0x7f')]=_0x51e898[_0x0189('0x7b')];}else if(this[_0x0189('0x32')](_0x51e898[_0x0189('0x7c')][_0x0189('0x80')])){logger[_0x0189('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x51e898[_0x0189('0x35')],_0x51e898[_0x0189('0x7b')]);this[_0x0189('0x17')][_0x51e898[_0x0189('0x35')]][_0x0189('0x81')]=_0x51e898[_0x0189('0x7b')];}else if(this[_0x0189('0x32')](_0x51e898[_0x0189('0x7c')][_0x0189('0x82')])){logger['info'](_0x0189('0x83'),_0x51e898[_0x0189('0x35')],_0x51e898[_0x0189('0x7b')]['split'](',')[0x0]);this['channels'][_0x51e898['uniqueid']][_0x0189('0xe')]=_0x51e898[_0x0189('0x7b')]['split'](',')[0x0];}else if(this[_0x0189('0x32')](_0x51e898[_0x0189('0x7c')][_0x0189('0x84')])){logger[_0x0189('0x2c')](_0x0189('0x85'),_0x51e898[_0x0189('0x35')],_0x51e898[_0x0189('0x7b')]);this[_0x0189('0x17')][_0x51e898['uniqueid']][_0x0189('0x86')]=_0x51e898[_0x0189('0x7b')];}else if(this[_0x0189('0x32')](_0x51e898[_0x0189('0x7c')][_0x0189('0x87')])){logger[_0x0189('0x2c')](_0x0189('0x88'),_0x51e898[_0x0189('0x35')],_0x51e898['value']);this['channels'][_0x51e898['uniqueid']][_0x0189('0x89')]=_0x51e898['value'];}else if(this[_0x0189('0x32')](_0x51e898[_0x0189('0x7c')]['xmd-callerid-preview'])){logger[_0x0189('0x2c')](_0x0189('0x8a'),_0x51e898['uniqueid'],_0x51e898[_0x0189('0x7b')]);this[_0x0189('0x17')][_0x51e898['uniqueid']][_0x0189('0x8b')]=_0x51e898[_0x0189('0x7b')];}else if(this[_0x0189('0x32')](_0x51e898[_0x0189('0x7c')][_0x0189('0x8c')])){logger[_0x0189('0x2c')](_0x0189('0x8d'),_0x51e898[_0x0189('0x35')],_0x51e898['value']);this[_0x0189('0x17')][_0x51e898[_0x0189('0x35')]][_0x0189('0xe')]=_0x51e898[_0x0189('0x7b')];}else if(this['isNotNull'](_0x51e898[_0x0189('0x7c')][_0x0189('0x8e')])){logger[_0x0189('0x2c')](_0x0189('0x8f'),_0x51e898[_0x0189('0x35')],_0x51e898['value']);this[_0x0189('0x17')][_0x51e898[_0x0189('0x35')]]['sipcalluniqueid']=_0x51e898['value'];}}}else if(this[_0x0189('0x32')](_0x51e898[_0x0189('0x7c')][_0x0189('0x90')])){if(_0x51e898[_0x0189('0x7b')]){var _0x975475=path[_0x0189('0x91')](_0x51e898[_0x0189('0x7b')])[_0x0189('0x4d')];logger[_0x0189('0x2c')](_0x0189('0x7a'),_0x975475,_0x51e898[_0x0189('0x7b')]);this[_0x0189('0x6c')](_0x975475,_0x51e898[_0x0189('0x7b')]);}}else if(this['channels'][_0x51e898[_0x0189('0x38')]]){if(this[_0x0189('0x32')](_0x51e898[_0x0189('0x7c')])){if(this['isNotNull'](_0x51e898[_0x0189('0x7c')][_0x0189('0x8e')])){logger[_0x0189('0x2c')](_0x0189('0x8f'),_0x51e898[_0x0189('0x38')],_0x51e898[_0x0189('0x7b')]);this[_0x0189('0x17')][_0x51e898['linkedid']][_0x0189('0x92')]=_0x51e898['value'];}}}}}catch(_0x32c91e){logger[_0x0189('0x2f')](_0x0189('0x93'),_0x51e898[_0x0189('0x35')],util[_0x0189('0x37')](_0x32c91e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')][_0x0189('0x23')]=function(_0x4967e3){try{if(this['isNotNull'](_0x4967e3)){logger[_0x0189('0x36')]('[%s][voiceCallReport][hangup]\x20event:',_0x4967e3[_0x0189('0x35')],util[_0x0189('0x37')](_0x4967e3,{'showHidden':![],'depth':null}));if(this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]]){logger[_0x0189('0x2c')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x4967e3[_0x0189('0x35')],_0x4967e3[_0x0189('0x94')]);var _0x6ffc7d=moment();this[_0x0189('0x17')][_0x4967e3['uniqueid']][_0x0189('0x95')]=_0x6ffc7d['format'](_0x0189('0x56'));this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]][_0x0189('0x54')]=_0x6ffc7d['diff'](this[_0x0189('0x17')][_0x4967e3['uniqueid']][_0x0189('0x40')],_0x0189('0x55'));if(this['channels'][_0x4967e3['uniqueid']][_0x0189('0x61')]){this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]][_0x0189('0x96')]=_0x6ffc7d[_0x0189('0x64')](this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]][_0x0189('0x62')],'seconds');this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]]['holdtime']=this[_0x0189('0x17')][_0x4967e3['uniqueid']][_0x0189('0x54')]-this[_0x0189('0x17')][_0x4967e3['uniqueid']][_0x0189('0x96')];}if(_0x4967e3[_0x0189('0x3e')]===_0x0189('0x45')){if(this[_0x0189('0x47')][_0x4967e3[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]]){this['agents'][_0x4967e3[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]]=_[_0x0189('0x97')](this['agents'][_0x4967e3[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]],[_0x0189('0x48')]);logger[_0x0189('0x36')](_0x0189('0x98'),_0x4967e3['uniqueid'],util[_0x0189('0x37')]({'destaccountcode':this[_0x0189('0x47')][_0x4967e3[_0x0189('0x3c')][_0x0189('0x46')]('-')[0x0]][_0x0189('0x4a')]},{'showHidden':![],'depth':null}));this[_0x0189('0x34')](util[_0x0189('0x4b')]('user:%s',this[_0x0189('0x47')][_0x4967e3['channel'][_0x0189('0x46')]('-')[0x0]][_0x0189('0x4d')]),_0x0189('0x99'),{'destaccountcode':this[_0x0189('0x47')][_0x4967e3[_0x0189('0x3c')]['split']('-')[0x0]][_0x0189('0x4a')]});}}if(_0x4967e3['event']==='BlindTransfer'){this[_0x0189('0x18')][_0x4967e3[_0x0189('0x35')]]=this[_0x0189('0x17')][_0x4967e3['uniqueid']];}else{if(this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]]['type']==='outbound'&&this['blindTransfers'][_0x4967e3[_0x0189('0x35')]]){this['channels'][_0x4967e3[_0x0189('0x35')]]['uniqueid']=[this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]][_0x0189('0x38')],this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]][_0x0189('0x38')]=this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]][_0x0189('0x35')]][0x0];delete this[_0x0189('0x18')][_0x4967e3[_0x0189('0x35')]];}}logger[_0x0189('0x36')](_0x0189('0x9a'),_0x4967e3[_0x0189('0x35')],util['inspect'](this[_0x0189('0x17')][_0x4967e3[_0x0189('0x35')]],{'showHidden':![],'depth':null}));ami[_0x0189('0x34')](_0x0189('0x9b'),this['channels'][_0x4967e3[_0x0189('0x35')]]);delete this['channels'][_0x4967e3[_0x0189('0x35')]];}}}catch(_0x51f58d){logger[_0x0189('0x2f')](_0x0189('0x9c'),_0x4967e3[_0x0189('0x35')],util[_0x0189('0x37')](_0x51f58d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')][_0x0189('0x26')]=function(_0x4e8726){try{if(this[_0x0189('0x32')](_0x4e8726)){logger[_0x0189('0x2c')](_0x0189('0x9d'),_0x4e8726['uniqueid'],_0x4e8726[_0x0189('0x9e')],_0x4e8726[_0x0189('0x9f')]);logger[_0x0189('0x36')](_0x0189('0xa0'),_0x4e8726[_0x0189('0x35')],util[_0x0189('0x37')](_0x4e8726,{'showHidden':![],'depth':null}));if(this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa1')]]){this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa1')]]['transfercalleridnum']=_0x4e8726[_0x0189('0x9e')];this['channels'][_0x4e8726[_0x0189('0xa1')]][_0x0189('0xa2')]=_0x4e8726[_0x0189('0x9f')];if(this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa3')]]){var _0x1ba0ad=this['channels'][_0x4e8726[_0x0189('0xa3')]];this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa3')]]=this[_0x0189('0x17')][_0x4e8726['transfereeuniqueid']];this['channels'][_0x4e8726[_0x0189('0xa1')]]=_0x1ba0ad;}}else if(this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa4')]]){this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa4')]]['transfercalleridnum']=_0x4e8726[_0x0189('0x9e')];this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa4')]][_0x0189('0xa2')]=_0x4e8726[_0x0189('0x9f')];if(this['channels'][_0x4e8726[_0x0189('0xa5')]]){var _0x1ba0ad=this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa5')]];this[_0x0189('0x17')][_0x4e8726['origtransfereruniqueid']]=this[_0x0189('0x17')][_0x4e8726[_0x0189('0xa4')]];this[_0x0189('0x17')][_0x4e8726['transfertargetuniqueid']]=_0x1ba0ad;}}}}catch(_0x546409){logger[_0x0189('0x2f')](_0x0189('0xa6'),_0x4e8726[_0x0189('0x35')],util[_0x0189('0x37')](_0x546409,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')][_0x0189('0x27')]=function(_0x2645e2){try{if(this[_0x0189('0x32')](_0x2645e2)){logger[_0x0189('0x2c')](_0x0189('0xa7'),_0x2645e2[_0x0189('0x35')],_0x2645e2[_0x0189('0xa8')],_0x2645e2['extension']);logger['debug'](_0x0189('0xa9'),_0x2645e2[_0x0189('0x35')],util[_0x0189('0x37')](_0x2645e2,{'showHidden':![],'depth':null}));if(this[_0x0189('0x17')][_0x2645e2['transfereeuniqueid']]){this[_0x0189('0x17')][_0x2645e2[_0x0189('0xa1')]][_0x0189('0xaa')]=_0x2645e2[_0x0189('0xa8')];this[_0x0189('0x17')][_0x2645e2['transfereeuniqueid']]['transferconnectedlinenum']=_0x2645e2['extension'];this['syncHangup']({'event':_0x0189('0xab'),'uniqueid':_0x2645e2[_0x0189('0xa1')],'context':_0x2645e2[_0x0189('0x3e')],'channel':_0x2645e2['transfererchannel']});}}}catch(_0x55b553){logger[_0x0189('0x2f')](_0x0189('0xac'),_0x2645e2[_0x0189('0x35')],util[_0x0189('0x37')](_0x55b553,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')]['syncMusicOnHoldStart']=function(_0x3a5e90){try{if(this[_0x0189('0x32')](_0x3a5e90)){logger[_0x0189('0x36')](_0x0189('0xad'),_0x3a5e90[_0x0189('0x35')],util[_0x0189('0x37')](_0x3a5e90,{'showHidden':![],'depth':null}));if(this[_0x0189('0x17')][_0x3a5e90[_0x0189('0x35')]]){if(!_[_0x0189('0xae')](this[_0x0189('0x17')][_0x3a5e90[_0x0189('0x35')]]['answertime'])){this[_0x0189('0x17')][_0x3a5e90[_0x0189('0x35')]][_0x0189('0xaf')]=moment()[_0x0189('0x4b')](_0x0189('0x56'));logger['info']('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x3a5e90['uniqueid'],this['channels'][_0x3a5e90[_0x0189('0x35')]][_0x0189('0xaf')]);}}}}catch(_0x56436c){logger[_0x0189('0x2f')](_0x0189('0xb0'),_0x3a5e90['uniqueid'],util['inspect'](_0x56436c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0189('0x31')][_0x0189('0x2b')]=function(_0x30359e){try{if(this['isNotNull'](_0x30359e)){logger[_0x0189('0x36')](_0x0189('0xb1'),_0x30359e['uniqueid'],util[_0x0189('0x37')](_0x30359e,{'showHidden':![],'depth':null}));if(this[_0x0189('0x17')][_0x30359e[_0x0189('0x35')]]){if(!_['isNil'](this[_0x0189('0x17')][_0x30359e[_0x0189('0x35')]]['mohstarttime'])){this[_0x0189('0x17')][_0x30359e[_0x0189('0x35')]][_0x0189('0xb2')]+=moment()['milliseconds'](0x0)[_0x0189('0x64')](this[_0x0189('0x17')][_0x30359e[_0x0189('0x35')]][_0x0189('0xaf')],_0x0189('0x55'));logger[_0x0189('0x2c')](_0x0189('0xb3'),_0x30359e['uniqueid'],this[_0x0189('0x17')][_0x30359e['uniqueid']][_0x0189('0xb2')]);delete this['channels'][_0x30359e[_0x0189('0x35')]][_0x0189('0xaf')];}}}}catch(_0xe648bc){logger['error'](_0x0189('0xb4'),_0x30359e[_0x0189('0x35')],util[_0x0189('0x37')](_0xe648bc,{'showHidden':![],'depth':null}));}};module[_0x0189('0xb5')]=VoiceCallReport;
\ No newline at end of file