X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=server%2Fservices%2Fami%2Freport%2Findex.js;h=6e109a62974ae8d3706d650098095c89515967da;hb=b2ace134e5eb466deeb396f27c0c22876a7ffeae;hp=8ad3698d09c40867dae997dc532e1a0d2c3388d4;hpb=fed88ff2b9fedc76d735d841a58c735e5087ca2f;p=motion2.git diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8ad3698..6e109a6 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 _0x80b5=['destinationchannel','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','UserId','split','membername','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','moment','util','../../../config/environment','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','keys','getCallType','channel','calleridnum','outbound','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x80b5,0x12b));var _0x580b=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x80b5[_0x330414];return _0x99dbff;};'use strict';var _=require('lodash');var moment=require(_0x580b('0x0'));var util=require(_0x580b('0x1'));var config=require(_0x580b('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x580b('0x3'));var RpcMemberReport=require(_0x580b('0x4'));var RpcVoiceQueueReport=require(_0x580b('0x5'));var RpcVoiceRecording=require(_0x580b('0x6'));var RpcVoiceTransferReport=require(_0x580b('0x7'));var VoiceQueueReport=require(_0x580b('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x580b('0x9'));var VoiceDialReport=require(_0x580b('0xa'));var UserReport=require(_0x580b('0xb'));function Report(_0x5eca70){this[_0x580b('0xc')]=_0x5eca70;this[_0x580b('0xd')]=_0x5eca70[_0x580b('0xd')];this['telephones']=_0x5eca70[_0x580b('0xe')];}Report[_0x580b('0xf')][_0x580b('0x10')]=function(_0x7d6020){var _0x5114bd=new VoiceQueueReport(this[_0x580b('0xc')]);var _0x1f4d09=new VoiceAgentReport(this['realtime']);var _0x2c14dd=new VoiceDialReport(this[_0x580b('0xc')]);var _0x571090=new VoiceCallReport(this[_0x580b('0xc')]);var _0x48fff2=new UserReport(this[_0x580b('0xc')]);if(config['xdr']&&config[_0x580b('0x11')][_0x580b('0x12')]){ami['on'](_0x580b('0x13'),this[_0x580b('0x14')][_0x580b('0x15')](this));ami['on'](_0x580b('0x16'),this[_0x580b('0x17')][_0x580b('0x15')](this));ami['on'](_0x580b('0x18'),this[_0x580b('0x19')][_0x580b('0x15')](this));ami['on'](_0x580b('0x1a'),this[_0x580b('0x1b')][_0x580b('0x15')](this));ami['on'](_0x580b('0x1c'),this[_0x580b('0x1d')][_0x580b('0x15')](this));ami['on']('attendedtransfer',this[_0x580b('0x1e')][_0x580b('0x15')](this));}};Report[_0x580b('0xf')][_0x580b('0x1f')]=function(_0xe5050c){var _0x1c169d;_0x1c169d=_[_0x580b('0x20')](this['agents'],function(_0x4c13e4){return _0x4c13e4[_0x580b('0x21')]==_0xe5050c||_0x4c13e4[_0x580b('0x22')]==_0xe5050c;});if(_[_0x580b('0x23')](_0x1c169d)){var _0x4ee136=_[_0x580b('0x20')](this[_0x580b('0xe')],function(_0x2ac1c0){return _0x2ac1c0['accountcode']==_0xe5050c||_0x2ac1c0[_0x580b('0x22')]==_0xe5050c;});if(_0x4ee136){_0x1c169d=_[_0x580b('0x20')](this[_0x580b('0xd')],function(_0x33393b){return _0x33393b[_0x580b('0x24')]==util[_0x580b('0x25')](_0x580b('0x26'),_0x4ee136[_0x580b('0x22')]);});}}return _0x1c169d;};Report[_0x580b('0xf')][_0x580b('0x14')]=function(_0x2ff810){for(var _0x41e4b0=0x0;_0x41e4b0<_0x2ff810[_0x580b('0x27')];_0x41e4b0+=0x1){var _0x575032=this['findAgent'](_0x2ff810[_0x41e4b0][_0x580b('0x28')]);if(_0x575032){_0x2ff810[_0x41e4b0]['accountcode']=_0x575032[_0x580b('0x21')];_0x2ff810[_0x41e4b0][_0x580b('0x29')]=!![];_0x2ff810[_0x41e4b0][_0x580b('0x2a')]=_0x575032[_0x580b('0x22')];_0x2ff810[_0x41e4b0][_0x580b('0x24')]=_[_0x580b('0x23')](_0x575032[_0x580b('0x24')])?util[_0x580b('0x25')](_0x580b('0x26'),_0x575032['name']):_0x575032[_0x580b('0x24')];if(_0x2ff810[_0x41e4b0][_0x580b('0x2b')]){_0x2ff810[_0x41e4b0][_0x580b('0x2c')]=moment()[_0x580b('0x25')](_0x580b('0x2d'));}if(_0x2ff810[_0x41e4b0]['queuecallerexit']){_0x2ff810[_0x41e4b0]['queuecallerexitAt']=moment()[_0x580b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x580b('0x14')](_0x2ff810[_0x41e4b0]);}RpcVoiceQueueReport[_0x580b('0x2e')](_0x2ff810[_0x41e4b0]);}};function extractCalleridNumber(_0x29582e){var _0x37d23f=_0x29582e[_0x580b('0x2f')](/<(.*?)>/);return _0x37d23f?_0x37d23f[0x1]:_0x29582e;}Report['prototype']['getAgentByInternal']=function(_0x2f69bc){for(var _0x2586d8=0x0;_0x2586d8','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','membername','monitor','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','transfererlinkedid','attendedTransfer','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','agents','interface','length'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0xc550,0x142));var _0x0c55=function(_0x1a8a79,_0x57182d){_0x1a8a79=_0x1a8a79-0x0;var _0x436f4c=_0xc550[_0x1a8a79];return _0x436f4c;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var config=require(_0x0c55('0x0'));var ami=require(_0x0c55('0x1'));var RpcVoiceAgentReport=require(_0x0c55('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x0c55('0x3'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x0c55('0x4'));var RpcVoiceRecording=require(_0x0c55('0x5'));var RpcVoiceTransferReport=require(_0x0c55('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x0c55('0x7'));var VoiceAgentReport=require(_0x0c55('0x8'));var VoiceDialReport=require(_0x0c55('0x9'));var UserReport=require(_0x0c55('0xa'));function Report(_0x44771e){this[_0x0c55('0xb')]=_0x44771e;this['agents']=_0x44771e['agents'];this[_0x0c55('0xc')]=_0x44771e[_0x0c55('0xc')];}Report[_0x0c55('0xd')][_0x0c55('0xe')]=function(_0x45dfe8){var _0x4f0f97=new VoiceQueueReport(this['realtime']);var _0x32893b=new VoiceAgentReport(this[_0x0c55('0xb')]);var _0x54577d=new VoiceDialReport(this['realtime']);var _0x3582b2=new VoiceCallReport(this[_0x0c55('0xb')]);var _0x16dba9=new UserReport(this['realtime']);if(config[_0x0c55('0xf')]&&config[_0x0c55('0xf')][_0x0c55('0x10')]){ami['on'](_0x0c55('0x11'),this[_0x0c55('0x12')][_0x0c55('0x13')](this));ami['on']('custom:voiceCallReport',this[_0x0c55('0x14')][_0x0c55('0x13')](this));ami['on'](_0x0c55('0x15'),this['voiceAgentReport'][_0x0c55('0x13')](this));ami['on'](_0x0c55('0x16'),this[_0x0c55('0x17')]['bind'](this));ami['on'](_0x0c55('0x18'),this['blindTransfer']['bind'](this));ami['on'](_0x0c55('0x19'),this['attendedTransfer'][_0x0c55('0x13')](this));}};Report[_0x0c55('0xd')][_0x0c55('0x1a')]=function(_0x5a5e6d){var _0x5a2791;_0x5a2791=_['find'](this['agents'],function(_0x3023e9){return _0x3023e9[_0x0c55('0x1b')]==_0x5a5e6d||_0x3023e9[_0x0c55('0x1c')]==_0x5a5e6d;});if(_[_0x0c55('0x1d')](_0x5a2791)){var _0x2c2d66=_[_0x0c55('0x1e')](this[_0x0c55('0xc')],function(_0x4c6aaa){return _0x4c6aaa[_0x0c55('0x1b')]==_0x5a5e6d||_0x4c6aaa[_0x0c55('0x1c')]==_0x5a5e6d;});if(_0x2c2d66){_0x5a2791=_[_0x0c55('0x1e')](this[_0x0c55('0x1f')],function(_0x20158d){return _0x20158d[_0x0c55('0x20')]==util['format']('SIP/%s',_0x2c2d66[_0x0c55('0x1c')]);});}}return _0x5a2791;};Report[_0x0c55('0xd')][_0x0c55('0x12')]=function(_0x425148){for(var _0x379328=0x0;_0x379328<_0x425148[_0x0c55('0x21')];_0x379328+=0x1){var _0x2685d0=this[_0x0c55('0x1a')](_0x425148[_0x379328][_0x0c55('0x22')]);if(_0x2685d0){_0x425148[_0x379328][_0x0c55('0x1b')]=_0x2685d0[_0x0c55('0x1b')];_0x425148[_0x379328][_0x0c55('0x23')]=!![];_0x425148[_0x379328][_0x0c55('0x24')]=_0x2685d0[_0x0c55('0x1c')];_0x425148[_0x379328][_0x0c55('0x20')]=_[_0x0c55('0x1d')](_0x2685d0[_0x0c55('0x20')])?util[_0x0c55('0x25')](_0x0c55('0x26'),_0x2685d0[_0x0c55('0x1c')]):_0x2685d0['interface'];if(_0x425148[_0x379328]['queuecallercomplete']){_0x425148[_0x379328][_0x0c55('0x27')]=moment()[_0x0c55('0x25')](_0x0c55('0x28'));}if(_0x425148[_0x379328][_0x0c55('0x29')]){_0x425148[_0x379328]['queuecallerexitAt']=moment()['format'](_0x0c55('0x28'));}RpcMemberReport['voiceQueueReport'](_0x425148[_0x379328]);}RpcVoiceQueueReport[_0x0c55('0x2a')](_0x425148[_0x379328]);}};function extractCalleridNumber(_0x3c7b74){var _0x7217f9=_0x3c7b74['match'](/<(.*?)>/);return _0x7217f9?_0x7217f9[0x1]:_0x3c7b74;}Report['prototype'][_0x0c55('0x2b')]=function(_0x14028e){for(var _0x42698c=0x0;_0x42698c