Built motion from commit e1760111.|2.6.18
[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 _0xb8bd=['format','system','channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb8bd,0x77));var _0xdb8b=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xb8bd[_0x1762b4];return _0x29beda;};'use strict';var moment=require(_0xdb8b('0x0'));var logger=require(_0xdb8b('0x1'))('routing');var rpc={'chatInteraction':require(_0xdb8b('0x2')),'openchannelInteraction':require(_0xdb8b('0x3')),'smsInteraction':require(_0xdb8b('0x4')),'mailInteraction':require(_0xdb8b('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xdb8b('0x6'))};exports['consequence']=function(_0x3b6e9d,_0x307d37,_0x563b1a,_0x19f5e7){return function(_0x41550d){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x3b6e9d,_0x307d37[0x0]);var _0x4bffd2={'closed':0x1,'closedAt':moment()[_0xdb8b('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xdb8b('0x8'),'disposition':_0x307d37[0x0]};if(rpc[_0x19f5e7[_0xdb8b('0x9')]+'Interaction']){rpc[_0x19f5e7[_0xdb8b('0x9')]+'Interaction'][_0xdb8b('0xa')](_0x19f5e7[_0xdb8b('0xb')]['id'],_0x4bffd2)['then'](function(_0x1c9594){logger['info'](_0xdb8b('0xc'),_0x3b6e9d,_0x19f5e7[_0xdb8b('0xb')]['id']);})[_0xdb8b('0xd')](function(_0x1e6ec0){logger[_0xdb8b('0xe')]('[%s][CLOSE]\x20%s',_0x3b6e9d,JSON[_0xdb8b('0xf')](_0x1e6ec0));})['finally'](function(){_0x41550d[_0xdb8b('0x10')]();});}}catch(_0xbf8409){logger['error'](_0xdb8b('0x11'),_0x3b6e9d,JSON['stringify'](_0xbf8409));_0x41550d['stop']();}};};