Built motion from commit (unavailable).|2.0.84
[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 _0xdca7=['connectedlinename','calleridnum','calleridname','./utils','debug','accountcode','getUserByInternal','membername','name','UserId','CreateVoiceRecording','request','channel','varset','isNil','variable','mixmonitor_filename','value','.wav49','.WAV','assign','agentconnect','queue','cdr','destinationchannel','type','destinationcontext','uniqueid'];(function(_0x18398f,_0x3dbe75){var _0x4714f1=function(_0x94963d){while(--_0x94963d){_0x18398f['push'](_0x18398f['shift']());}};_0x4714f1(++_0x3dbe75);}(_0xdca7,0x11b));var _0x7dca=function(_0x3f1e1e,_0x2d8ee1){_0x3f1e1e=_0x3f1e1e-0x0;var _0x4215b5=_0xdca7[_0x3f1e1e];return _0x4215b5;};'use strict';var _=require('lodash');var utils=require(_0x7dca('0x0'));var recordings={};function writeDB(_0x389e9f){utils[_0x7dca('0x1')](_0x389e9f);if(_0x389e9f[_0x7dca('0x2')]){utils[_0x7dca('0x3')](_0x389e9f[_0x7dca('0x2')])['then'](function(_0x31b21a){if(_0x31b21a){_0x389e9f[_0x7dca('0x4')]=_0x31b21a[_0x7dca('0x5')];_0x389e9f[_0x7dca('0x6')]=_0x31b21a['id'];}utils['request'](_0x7dca('0x7'),_0x389e9f);});}else{utils[_0x7dca('0x8')](_0x7dca('0x7'),_0x389e9f);}if(recordings[_0x389e9f[_0x7dca('0x9')]]){delete recordings[_0x389e9f[_0x7dca('0x9')]];}}exports[_0x7dca('0xa')]=function(_0x50e4ab){if(!_[_0x7dca('0xb')](_0x50e4ab[_0x7dca('0xc')])&&!_[_0x7dca('0xb')](_0x50e4ab['variable'][_0x7dca('0xd')])){if(!_[_0x7dca('0xb')](recordings[_0x50e4ab[_0x7dca('0x9')]])){writeDB(recordings[_0x50e4ab[_0x7dca('0x9')]]);}if(_['endsWith'](_0x50e4ab[_0x7dca('0xe')],_0x7dca('0xf'))){_0x50e4ab['value']=_0x50e4ab[_0x7dca('0xe')]['replace'](_0x7dca('0xf'),_0x7dca('0x10'));}recordings[_0x50e4ab['channel']]=_[_0x7dca('0x11')](_0x50e4ab,{});}};exports[_0x7dca('0x12')]=function(_0x5030f4){if(!_[_0x7dca('0xb')](recordings[_0x5030f4[_0x7dca('0x9')]])){recordings[_0x5030f4[_0x7dca('0x9')]]=_['assign'](recordings[_0x5030f4['channel']],{'membername':_0x5030f4[_0x7dca('0x4')],'queue':_0x5030f4[_0x7dca('0x13')],'accountcode':_0x5030f4['connectedlinenum']});}};exports[_0x7dca('0x14')]=function(_0x5cf9a7){if(!_[_0x7dca('0xb')](recordings[_0x5cf9a7[_0x7dca('0x9')]])){recordings[_0x5cf9a7[_0x7dca('0x9')]]=_[_0x7dca('0x11')](recordings[_0x5cf9a7[_0x7dca('0x9')]],{'type':_0x5cf9a7['type']});writeDB(recordings[_0x5cf9a7[_0x7dca('0x9')]]);}else if(!_[_0x7dca('0xb')](recordings[_0x5cf9a7[_0x7dca('0x15')]])){recordings[_0x5cf9a7[_0x7dca('0x9')]]=recordings[_0x5cf9a7[_0x7dca('0x15')]];delete recordings[_0x5cf9a7[_0x7dca('0x15')]];recordings[_0x5cf9a7[_0x7dca('0x9')]]=_['assign'](recordings[_0x5cf9a7['channel']],{'type':_0x5cf9a7[_0x7dca('0x16')],'channel':_0x5cf9a7['channel'],'exten':_0x5cf9a7['destination'],'context':_0x5cf9a7[_0x7dca('0x17')],'uniqueid':_0x5cf9a7[_0x7dca('0x18')],'calleridnum':recordings[_0x5cf9a7[_0x7dca('0x9')]]['connectedlinenum'],'calleridname':recordings[_0x5cf9a7[_0x7dca('0x9')]][_0x7dca('0x19')],'connectedlinenum':recordings[_0x5cf9a7['channel']][_0x7dca('0x1a')],'connectedlinename':recordings[_0x5cf9a7['channel']][_0x7dca('0x1b')]});writeDB(recordings[_0x5cf9a7['channel']]);}};