Built motion from commit e8d9bd62.|2.6.25
[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 _0xebfb=['then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update'];(function(_0x227427,_0x3159c8){var _0x51d536=function(_0x4d7244){while(--_0x4d7244){_0x227427['push'](_0x227427['shift']());}};_0x51d536(++_0x3159c8);}(_0xebfb,0xc1));var _0xbebf=function(_0x2408a8,_0x26ebe4){_0x2408a8=_0x2408a8-0x0;var _0x3a4cf5=_0xebfb[_0x2408a8];return _0x3a4cf5;};'use strict';var moment=require(_0xbebf('0x0'));var logger=require(_0xbebf('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xbebf('0x2')),'smsInteraction':require(_0xbebf('0x3')),'mailInteraction':require(_0xbebf('0x4')),'faxInteraction':require(_0xbebf('0x5')),'whatsappInteraction':require(_0xbebf('0x6'))};exports['consequence']=function(_0x41eac9,_0x53bab4,_0x5627d4,_0x271fb0){return function(_0x316283){try{logger['info'](_0xbebf('0x7'),_0x41eac9,_0x53bab4[0x0]);var _0x34bf50={'closed':0x1,'closedAt':moment()[_0xbebf('0x8')](_0xbebf('0x9')),'closeReason':_0xbebf('0xa'),'disposition':_0x53bab4[0x0]};if(rpc[_0x271fb0[_0xbebf('0xb')]+_0xbebf('0xc')]){rpc[_0x271fb0['channel']+'Interaction'][_0xbebf('0xd')](_0x271fb0['interaction']['id'],_0x34bf50)[_0xbebf('0xe')](function(_0x189c2f){logger[_0xbebf('0xf')](_0xbebf('0x10'),_0x41eac9,_0x271fb0[_0xbebf('0x11')]['id']);})[_0xbebf('0x12')](function(_0xba7551){logger[_0xbebf('0x13')](_0xbebf('0x14'),_0x41eac9,JSON[_0xbebf('0x15')](_0xba7551));})['finally'](function(){_0x316283['stop']();});}}catch(_0x235f18){logger[_0xbebf('0x13')](_0xbebf('0x14'),_0x41eac9,JSON[_0xbebf('0x15')](_0x235f18));_0x316283[_0xbebf('0x16')]();}};};