0e1d2f37cbfdb320a9329cba926d5f63a54be234
[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 _0xb4cb=['[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xb4cb,0x174));var _0xbb4c=function(_0x1d244d,_0xd816e0){_0x1d244d=_0x1d244d-0x0;var _0x31d301=_0xb4cb[_0x1d244d];return _0x31d301;};'use strict';var moment=require(_0xbb4c('0x0'));var logger=require(_0xbb4c('0x1'))(_0xbb4c('0x2'));var rpc={'chatInteraction':require(_0xbb4c('0x3')),'openchannelInteraction':require(_0xbb4c('0x4')),'smsInteraction':require(_0xbb4c('0x5')),'mailInteraction':require(_0xbb4c('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xbb4c('0x7'))};exports[_0xbb4c('0x8')]=function(_0x286812,_0x5911fd,_0x625220,_0x461779){return function(_0x530ea6){try{logger['info'](_0xbb4c('0x9'),_0x286812,_0x5911fd[0x0]);var _0x264296={'closed':0x1,'closedAt':moment()[_0xbb4c('0xa')](_0xbb4c('0xb')),'closeReason':'system','disposition':_0x5911fd[0x0]};if(rpc[_0x461779[_0xbb4c('0xc')]+_0xbb4c('0xd')]){rpc[_0x461779['channel']+_0xbb4c('0xd')][_0xbb4c('0xe')](_0x461779['interaction']['id'],_0x264296)[_0xbb4c('0xf')](function(_0x18ce2e){logger['info'](_0xbb4c('0x10'),_0x286812,_0x461779['interaction']['id']);})[_0xbb4c('0x11')](function(_0x3f29d6){logger[_0xbb4c('0x12')](_0xbb4c('0x13'),_0x286812,JSON['stringify'](_0x3f29d6));})[_0xbb4c('0x14')](function(){_0x530ea6[_0xbb4c('0x15')]();});}}catch(_0x20701a){logger[_0xbb4c('0x12')](_0xbb4c('0x13'),_0x286812,JSON[_0xbb4c('0x16')](_0x20701a));_0x530ea6[_0xbb4c('0x15')]();}};};