Built motion from commit 538092ac.|2.6.10
[motion2.git] / server / services / routing / server / applications / close.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 _0xbb0a=['finally','[%s][CLOSE]\x20%s','stringify','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0xbb0a,0xc3));var _0xabb0=function(_0x5c8821,_0x12ddae){_0x5c8821=_0x5c8821-0x0;var _0x3cb98b=_0xbb0a[_0x5c8821];return _0x3cb98b;};'use strict';var moment=require('moment');var logger=require(_0xabb0('0x0'))(_0xabb0('0x1'));var rpc={'chatInteraction':require(_0xabb0('0x2')),'openchannelInteraction':require(_0xabb0('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xabb0('0x4')),'faxInteraction':require(_0xabb0('0x5')),'whatsappInteraction':require(_0xabb0('0x6'))};exports[_0xabb0('0x7')]=function(_0x5e679f,_0x5151af,_0x6c0940,_0x42fdc2){return function(_0x5c2f2b){try{logger[_0xabb0('0x8')](_0xabb0('0x9'),_0x5e679f,_0x5151af[0x0]);var _0x565796={'closed':0x1,'closedAt':moment()[_0xabb0('0xa')](_0xabb0('0xb')),'closeReason':_0xabb0('0xc'),'disposition':_0x5151af[0x0]};if(rpc[_0x42fdc2[_0xabb0('0xd')]+_0xabb0('0xe')]){rpc[_0x42fdc2['channel']+'Interaction'][_0xabb0('0xf')](_0x42fdc2[_0xabb0('0x10')]['id'],_0x565796)[_0xabb0('0x11')](function(_0x4d7a03){logger[_0xabb0('0x8')](_0xabb0('0x12'),_0x5e679f,_0x42fdc2['interaction']['id']);})[_0xabb0('0x13')](function(_0x591667){logger[_0xabb0('0x14')]('[%s][CLOSE]\x20%s',_0x5e679f,JSON['stringify'](_0x591667));})[_0xabb0('0x15')](function(){_0x5c2f2b['stop']();});}}catch(_0x400af3){logger[_0xabb0('0x14')](_0xabb0('0x16'),_0x5e679f,JSON[_0xabb0('0x17')](_0x400af3));_0x5c2f2b['stop']();}};};