Built motion from commit (unavailable).|2.3.1
[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 _0x8f37=['value','.WAV','assign','agentconnect','queue','connectedlinenum','cdr','type','destinationchannel','dialer','destinationcontext','lastdata','destination','calleridnum','connectedlinename','calleridname','lodash','./utils','getUserByInternal','accountcode','then','membername','UserId','CreateVoiceRecording','request','channel','varset','variable','isNil','mixmonitor_filename','endsWith','.wav49'];(function(_0x28e1a0,_0x463ab4){var _0x4a759f=function(_0x26e7e8){while(--_0x26e7e8){_0x28e1a0['push'](_0x28e1a0['shift']());}};_0x4a759f(++_0x463ab4);}(_0x8f37,0x190));var _0x78f3=function(_0x1a8f78,_0x53f7d5){_0x1a8f78=_0x1a8f78-0x0;var _0x12a821=_0x8f37[_0x1a8f78];return _0x12a821;};'use strict';var _=require(_0x78f3('0x0'));var utils=require(_0x78f3('0x1'));var recordings={};function writeDB(_0x351c4f){utils['debug'](_0x351c4f);if(_0x351c4f['accountcode']){utils[_0x78f3('0x2')](_0x351c4f[_0x78f3('0x3')])[_0x78f3('0x4')](function(_0x539794){if(_0x539794){_0x351c4f[_0x78f3('0x5')]=_0x539794['name'];_0x351c4f[_0x78f3('0x6')]=_0x539794['id'];}utils['request'](_0x78f3('0x7'),_0x351c4f);});}else{utils[_0x78f3('0x8')]('CreateVoiceRecording',_0x351c4f);}if(recordings[_0x351c4f[_0x78f3('0x9')]]){delete recordings[_0x351c4f['channel']];}}exports[_0x78f3('0xa')]=function(_0x423223){if(!_['isNil'](_0x423223[_0x78f3('0xb')])&&!_[_0x78f3('0xc')](_0x423223[_0x78f3('0xb')][_0x78f3('0xd')])){if(!_[_0x78f3('0xc')](recordings[_0x423223['channel']])){writeDB(recordings[_0x423223[_0x78f3('0x9')]]);}if(_[_0x78f3('0xe')](_0x423223['value'],_0x78f3('0xf'))){_0x423223[_0x78f3('0x10')]=_0x423223[_0x78f3('0x10')]['replace'](_0x78f3('0xf'),_0x78f3('0x11'));}recordings[_0x423223[_0x78f3('0x9')]]=_[_0x78f3('0x12')](_0x423223,{});}};exports[_0x78f3('0x13')]=function(_0x1858f1){if(!_[_0x78f3('0xc')](recordings[_0x1858f1[_0x78f3('0x9')]])){recordings[_0x1858f1[_0x78f3('0x9')]]=_[_0x78f3('0x12')](recordings[_0x1858f1[_0x78f3('0x9')]],{'membername':_0x1858f1[_0x78f3('0x5')],'queue':_0x1858f1[_0x78f3('0x14')],'accountcode':_0x1858f1[_0x78f3('0x15')]});}};exports[_0x78f3('0x16')]=function(_0x422855){if(!_[_0x78f3('0xc')](recordings[_0x422855[_0x78f3('0x9')]])){recordings[_0x422855[_0x78f3('0x9')]]=_[_0x78f3('0x12')](recordings[_0x422855[_0x78f3('0x9')]],{'type':_0x422855[_0x78f3('0x17')]});writeDB(recordings[_0x422855[_0x78f3('0x9')]]);}else if(!_['isNil'](recordings[_0x422855[_0x78f3('0x18')]])){recordings[_0x422855[_0x78f3('0x9')]]=recordings[_0x422855['destinationchannel']];delete recordings[_0x422855['destinationchannel']];if(_0x422855['type']==_0x78f3('0x19')){recordings[_0x422855[_0x78f3('0x9')]]=_[_0x78f3('0x12')](recordings[_0x422855[_0x78f3('0x9')]],{'type':_0x422855[_0x78f3('0x17')],'uniqueid':_0x422855['uniqueid'],'context':_0x422855[_0x78f3('0x1a')],'queue':_0x422855[_0x78f3('0x1b')],'connectedlinenum':_0x422855[_0x78f3('0x3')],'connectedlinename':'','calleridnum':_0x422855[_0x78f3('0x1c')],'exten':recordings[_0x422855[_0x78f3('0x9')]][_0x78f3('0x1d')]});}else{recordings[_0x422855[_0x78f3('0x9')]]=_[_0x78f3('0x12')](recordings[_0x422855[_0x78f3('0x9')]],{'type':_0x422855[_0x78f3('0x17')],'channel':_0x422855['channel'],'exten':_0x422855[_0x78f3('0x1c')],'context':_0x422855[_0x78f3('0x1a')],'uniqueid':_0x422855['uniqueid'],'calleridnum':recordings[_0x422855[_0x78f3('0x9')]][_0x78f3('0x15')],'calleridname':recordings[_0x422855[_0x78f3('0x9')]][_0x78f3('0x1e')],'connectedlinenum':recordings[_0x422855[_0x78f3('0x9')]]['calleridnum'],'connectedlinename':recordings[_0x422855[_0x78f3('0x9')]][_0x78f3('0x1f')]});}writeDB(recordings[_0x422855[_0x78f3('0x9')]]);}};