Built motion from commit (unavailable).|2.2.6
[motion2.git] / server / services / xdr / recordings.controller.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 _0x0c5d=['.wav49','replace','.WAV','assign','queue','connectedlinenum','type','destinationchannel','dialer','uniqueid','destinationcontext','lastdata','calleridnum','connectedlinename','calleridname','lodash','./utils','debug','getUserByInternal','accountcode','then','membername','name','UserId','request','channel','isNil','variable','mixmonitor_filename','endsWith','value'];(function(_0x2ac1cb,_0x1d9f83){var _0x386925=function(_0x2e451b){while(--_0x2e451b){_0x2ac1cb['push'](_0x2ac1cb['shift']());}};_0x386925(++_0x1d9f83);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x1eebd3,_0x1b672a){_0x1eebd3=_0x1eebd3-0x0;var _0x352685=_0x0c5d[_0x1eebd3];return _0x352685;};'use strict';var _=require(_0xd0c5('0x0'));var utils=require(_0xd0c5('0x1'));var recordings={};function writeDB(_0x4d5e69){utils[_0xd0c5('0x2')](_0x4d5e69);if(_0x4d5e69['accountcode']){utils[_0xd0c5('0x3')](_0x4d5e69[_0xd0c5('0x4')])[_0xd0c5('0x5')](function(_0x177811){if(_0x177811){_0x4d5e69[_0xd0c5('0x6')]=_0x177811[_0xd0c5('0x7')];_0x4d5e69[_0xd0c5('0x8')]=_0x177811['id'];}utils[_0xd0c5('0x9')]('CreateVoiceRecording',_0x4d5e69);});}else{utils[_0xd0c5('0x9')]('CreateVoiceRecording',_0x4d5e69);}if(recordings[_0x4d5e69['channel']]){delete recordings[_0x4d5e69[_0xd0c5('0xa')]];}}exports['varset']=function(_0x567113){if(!_[_0xd0c5('0xb')](_0x567113[_0xd0c5('0xc')])&&!_['isNil'](_0x567113[_0xd0c5('0xc')][_0xd0c5('0xd')])){if(!_['isNil'](recordings[_0x567113[_0xd0c5('0xa')]])){writeDB(recordings[_0x567113[_0xd0c5('0xa')]]);}if(_[_0xd0c5('0xe')](_0x567113[_0xd0c5('0xf')],_0xd0c5('0x10'))){_0x567113[_0xd0c5('0xf')]=_0x567113[_0xd0c5('0xf')][_0xd0c5('0x11')](_0xd0c5('0x10'),_0xd0c5('0x12'));}recordings[_0x567113[_0xd0c5('0xa')]]=_[_0xd0c5('0x13')](_0x567113,{});}};exports['agentconnect']=function(_0x11511d){if(!_[_0xd0c5('0xb')](recordings[_0x11511d[_0xd0c5('0xa')]])){recordings[_0x11511d[_0xd0c5('0xa')]]=_['assign'](recordings[_0x11511d[_0xd0c5('0xa')]],{'membername':_0x11511d[_0xd0c5('0x6')],'queue':_0x11511d[_0xd0c5('0x14')],'accountcode':_0x11511d[_0xd0c5('0x15')]});}};exports['cdr']=function(_0x2be13d){if(!_['isNil'](recordings[_0x2be13d[_0xd0c5('0xa')]])){recordings[_0x2be13d['channel']]=_[_0xd0c5('0x13')](recordings[_0x2be13d[_0xd0c5('0xa')]],{'type':_0x2be13d[_0xd0c5('0x16')]});writeDB(recordings[_0x2be13d[_0xd0c5('0xa')]]);}else if(!_[_0xd0c5('0xb')](recordings[_0x2be13d[_0xd0c5('0x17')]])){recordings[_0x2be13d[_0xd0c5('0xa')]]=recordings[_0x2be13d[_0xd0c5('0x17')]];delete recordings[_0x2be13d['destinationchannel']];if(_0x2be13d[_0xd0c5('0x16')]==_0xd0c5('0x18')){recordings[_0x2be13d['channel']]=_[_0xd0c5('0x13')](recordings[_0x2be13d[_0xd0c5('0xa')]],{'type':_0x2be13d[_0xd0c5('0x16')],'uniqueid':_0x2be13d[_0xd0c5('0x19')],'context':_0x2be13d[_0xd0c5('0x1a')],'queue':_0x2be13d[_0xd0c5('0x1b')],'connectedlinenum':_0x2be13d[_0xd0c5('0x4')],'connectedlinename':'','calleridnum':_0x2be13d['destination'],'exten':recordings[_0x2be13d['channel']][_0xd0c5('0x1c')]});}else{recordings[_0x2be13d[_0xd0c5('0xa')]]=_[_0xd0c5('0x13')](recordings[_0x2be13d[_0xd0c5('0xa')]],{'type':_0x2be13d['type'],'channel':_0x2be13d[_0xd0c5('0xa')],'exten':_0x2be13d['destination'],'context':_0x2be13d['destinationcontext'],'uniqueid':_0x2be13d[_0xd0c5('0x19')],'calleridnum':recordings[_0x2be13d[_0xd0c5('0xa')]][_0xd0c5('0x15')],'calleridname':recordings[_0x2be13d[_0xd0c5('0xa')]][_0xd0c5('0x1d')],'connectedlinenum':recordings[_0x2be13d[_0xd0c5('0xa')]][_0xd0c5('0x1c')],'connectedlinename':recordings[_0x2be13d[_0xd0c5('0xa')]][_0xd0c5('0x1e')]});}writeDB(recordings[_0x2be13d[_0xd0c5('0xa')]]);}};