X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=server%2Fservices%2Fami%2Freport%2Findex.js;h=966e5c5b582c11cc5429f986bccc1526c6d658dc;hb=142b2b07c26fb6697bb0d2f2a4a8c0253173e8fe;hp=ee73a9f06840712286956d48c09c8c0c3330c337;hpb=bc8ba5d49091d4cd92a2c18e276791604cb31450;p=motion2.git diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ee73a9f..966e5c5 100644 --- a/server/services/ami/report/index.js +++ b/server/services/ami/report/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0408=['../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','isNil','accountcode','name','find','interface','SIP/%s','length','assigned','lastAssignedTo','queuecallercompleteAt','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','channel','outbound','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','callerid','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','split','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0408,0x178));var _0x8040=function(_0x4be8c7,_0x1b38bb){_0x4be8c7=_0x4be8c7-0x0;var _0x301fcf=_0x0408[_0x4be8c7];return _0x301fcf;};'use strict';var _=require(_0x8040('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x8040('0x1'));var ami=require(_0x8040('0x2'));var RpcVoiceAgentReport=require(_0x8040('0x3'));var RpcVoiceCallReport=require(_0x8040('0x4'));var RpcVoiceDialReport=require(_0x8040('0x5'));var RpcMemberReport=require(_0x8040('0x6'));var RpcVoiceQueueReport=require(_0x8040('0x7'));var RpcVoiceRecording=require(_0x8040('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8040('0x9'));var VoiceAgentReport=require(_0x8040('0xa'));var VoiceDialReport=require(_0x8040('0xb'));var UserReport=require(_0x8040('0xc'));function Report(_0x3ebad8){this['realtime']=_0x3ebad8;this[_0x8040('0xd')]=_0x3ebad8[_0x8040('0xd')];this[_0x8040('0xe')]=_0x3ebad8[_0x8040('0xe')];}Report['prototype']['sync']=function(_0x338a17){var _0x802221=new VoiceQueueReport(this['realtime']);var _0x28ee94=new VoiceAgentReport(this[_0x8040('0xf')]);var _0x419422=new VoiceDialReport(this[_0x8040('0xf')]);var _0x58075d=new VoiceCallReport(this[_0x8040('0xf')]);var _0x53cdf7=new UserReport(this[_0x8040('0xf')]);if(config['xdr']&&config[_0x8040('0x10')][_0x8040('0x11')]){ami['on'](_0x8040('0x12'),this['voiceQueueReport'][_0x8040('0x13')](this));ami['on'](_0x8040('0x14'),this['voiceCallReport'][_0x8040('0x13')](this));ami['on'](_0x8040('0x15'),this[_0x8040('0x16')][_0x8040('0x13')](this));ami['on'](_0x8040('0x17'),this[_0x8040('0x18')][_0x8040('0x13')](this));ami['on'](_0x8040('0x19'),this[_0x8040('0x1a')][_0x8040('0x13')](this));ami['on'](_0x8040('0x1b'),this[_0x8040('0x1c')][_0x8040('0x13')](this));}};Report[_0x8040('0x1d')][_0x8040('0x1e')]=function(_0x14c6dd){var _0x3c81d6;_0x3c81d6=_['find'](this[_0x8040('0xd')],function(_0x3d90d3){return _0x3d90d3['accountcode']==_0x14c6dd||_0x3d90d3['name']==_0x14c6dd;});if(_[_0x8040('0x1f')](_0x3c81d6)){var _0x4cf3af=_['find'](this[_0x8040('0xe')],function(_0x109f82){return _0x109f82[_0x8040('0x20')]==_0x14c6dd||_0x109f82[_0x8040('0x21')]==_0x14c6dd;});if(_0x4cf3af){_0x3c81d6=_[_0x8040('0x22')](this['agents'],function(_0x4028b9){return _0x4028b9[_0x8040('0x23')]==util['format'](_0x8040('0x24'),_0x4cf3af[_0x8040('0x21')]);});}}return _0x3c81d6;};Report[_0x8040('0x1d')]['voiceQueueReport']=function(_0x39ffef){for(var _0x5277a5=0x0;_0x5277a5<_0x39ffef[_0x8040('0x25')];_0x5277a5+=0x1){var _0x304f13=this[_0x8040('0x1e')](_0x39ffef[_0x5277a5]['connectedlinenum']);if(_0x304f13){_0x39ffef[_0x5277a5][_0x8040('0x20')]=_0x304f13['accountcode'];_0x39ffef[_0x5277a5][_0x8040('0x26')]=!![];_0x39ffef[_0x5277a5][_0x8040('0x27')]=_0x304f13[_0x8040('0x21')];_0x39ffef[_0x5277a5][_0x8040('0x23')]=_[_0x8040('0x1f')](_0x304f13[_0x8040('0x23')])?util['format'](_0x8040('0x24'),_0x304f13[_0x8040('0x21')]):_0x304f13[_0x8040('0x23')];if(_0x39ffef[_0x5277a5]['queuecallercomplete']){_0x39ffef[_0x5277a5][_0x8040('0x28')]=moment()[_0x8040('0x29')](_0x8040('0x2a'));}if(_0x39ffef[_0x5277a5]['queuecallerexit']){_0x39ffef[_0x5277a5][_0x8040('0x2b')]=moment()[_0x8040('0x29')](_0x8040('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x39ffef[_0x5277a5]);}RpcVoiceQueueReport[_0x8040('0x2c')](_0x39ffef[_0x5277a5]);}};function extractCalleridNumber(_0x350eeb){var _0x2e94dc=_0x350eeb['match'](/<(.*?)>/);return _0x2e94dc?_0x2e94dc[0x1]:_0x350eeb;}Report[_0x8040('0x1d')][_0x8040('0x2d')]=function(_0x326b76){for(var _0x180081=0x0;_0x180081','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','Local','indexOf','mobile','substring','lastIndexOf','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7960,0x12b));var _0x0796=function(_0x53d519,_0x19d299){_0x53d519=_0x53d519-0x0;var _0x2a0a12=_0x7960[_0x53d519];return _0x2a0a12;};'use strict';var _=require(_0x0796('0x0'));var moment=require(_0x0796('0x1'));var util=require(_0x0796('0x2'));var config=require(_0x0796('0x3'));var ami=require(_0x0796('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x0796('0x5'));var RpcVoiceDialReport=require(_0x0796('0x6'));var RpcMemberReport=require(_0x0796('0x7'));var RpcVoiceQueueReport=require(_0x0796('0x8'));var RpcVoiceRecording=require(_0x0796('0x9'));var RpcVoiceTransferReport=require(_0x0796('0xa'));var VoiceQueueReport=require(_0x0796('0xb'));var VoiceCallReport=require(_0x0796('0xc'));var VoiceAgentReport=require(_0x0796('0xd'));var VoiceDialReport=require(_0x0796('0xe'));var UserReport=require(_0x0796('0xf'));function Report(_0x5c769d){this[_0x0796('0x10')]=_0x5c769d;this[_0x0796('0x11')]=_0x5c769d[_0x0796('0x11')];this[_0x0796('0x12')]=_0x5c769d['telephones'];}Report[_0x0796('0x13')]['sync']=function(_0x5da4b7){var _0x2c6644=new VoiceQueueReport(this[_0x0796('0x10')]);var _0x5110fa=new VoiceAgentReport(this['realtime']);var _0x1ef077=new VoiceDialReport(this[_0x0796('0x10')]);var _0xcc4782=new VoiceCallReport(this[_0x0796('0x10')]);var _0x13edb8=new UserReport(this['realtime']);if(config[_0x0796('0x14')]&&config['xdr']['disabled']){ami['on']('custom:voiceQueueReport',this[_0x0796('0x15')][_0x0796('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x0796('0x17')][_0x0796('0x16')](this));ami['on'](_0x0796('0x18'),this[_0x0796('0x19')][_0x0796('0x16')](this));ami['on'](_0x0796('0x1a'),this['voiceDialReport'][_0x0796('0x16')](this));ami['on'](_0x0796('0x1b'),this[_0x0796('0x1c')]['bind'](this));ami['on']('attendedtransfer',this[_0x0796('0x1d')][_0x0796('0x16')](this));}};Report[_0x0796('0x13')][_0x0796('0x1e')]=function(_0x47c198){var _0x221769;_0x221769=_[_0x0796('0x1f')](this[_0x0796('0x11')],function(_0x17938c){return _0x17938c[_0x0796('0x20')]==_0x47c198||_0x17938c[_0x0796('0x21')]==_0x47c198;});if(_[_0x0796('0x22')](_0x221769)){var _0x2ac889=_[_0x0796('0x1f')](this[_0x0796('0x12')],function(_0x2e4578){return _0x2e4578[_0x0796('0x20')]==_0x47c198||_0x2e4578[_0x0796('0x21')]==_0x47c198;});if(_0x2ac889){_0x221769=_['find'](this[_0x0796('0x11')],function(_0x22a6f7){return _0x22a6f7[_0x0796('0x23')]==util[_0x0796('0x24')](_0x0796('0x25'),_0x2ac889[_0x0796('0x21')]);});}}return _0x221769;};Report[_0x0796('0x13')][_0x0796('0x15')]=function(_0x106500){for(var _0x1e8992=0x0;_0x1e8992<_0x106500[_0x0796('0x26')];_0x1e8992+=0x1){var _0x47a60b=this[_0x0796('0x1e')](_0x106500[_0x1e8992][_0x0796('0x27')]);if(_0x47a60b){_0x106500[_0x1e8992]['accountcode']=_0x47a60b[_0x0796('0x20')];_0x106500[_0x1e8992]['assigned']=!![];_0x106500[_0x1e8992][_0x0796('0x28')]=_0x47a60b[_0x0796('0x21')];_0x106500[_0x1e8992]['interface']=_[_0x0796('0x22')](_0x47a60b[_0x0796('0x23')])?util[_0x0796('0x24')]('SIP/%s',_0x47a60b['name']):_0x47a60b[_0x0796('0x23')];if(_0x106500[_0x1e8992][_0x0796('0x29')]){_0x106500[_0x1e8992][_0x0796('0x2a')]=moment()[_0x0796('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x106500[_0x1e8992][_0x0796('0x2b')]){_0x106500[_0x1e8992]['queuecallerexitAt']=moment()[_0x0796('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x0796('0x15')](_0x106500[_0x1e8992]);}RpcVoiceQueueReport[_0x0796('0x2c')](_0x106500[_0x1e8992]);}};function extractCalleridNumber(_0x2af05d){var _0x247c31=_0x2af05d['match'](/<(.*?)>/);return _0x247c31?_0x247c31[0x1]:_0x2af05d;}Report['prototype']['getAgentByInternal']=function(_0xbbdd1f){for(var _0x4ae2dd=0x0;_0x4ae2dd