bf4465c00bd96a8c2ccd92753830bda5e7971ee3
[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 _0xa6d0=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing'];(function(_0x2ce288,_0x37702a){var _0x533008=function(_0x2d0a10){while(--_0x2d0a10){_0x2ce288['push'](_0x2ce288['shift']());}};_0x533008(++_0x37702a);}(_0xa6d0,0x11a));var _0x0a6d=function(_0x3d8a27,_0x46442d){_0x3d8a27=_0x3d8a27-0x0;var _0x9a0d4a=_0xa6d0[_0x3d8a27];return _0x9a0d4a;};'use strict';var moment=require(_0x0a6d('0x0'));var logger=require(_0x0a6d('0x1'))(_0x0a6d('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0a6d('0x3')),'smsInteraction':require(_0x0a6d('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0a6d('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x0a6d('0x6')]=function(_0x1369a3,_0x31ae8b,_0xb7bac3,_0x5ae3d8){return function(_0x3513db){try{logger[_0x0a6d('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x1369a3,_0x31ae8b[0x0]);var _0x5b7404={'closed':0x1,'closedAt':moment()['format'](_0x0a6d('0x8')),'closeReason':'system','disposition':_0x31ae8b[0x0]};if(rpc[_0x5ae3d8[_0x0a6d('0x9')]+_0x0a6d('0xa')]){rpc[_0x5ae3d8[_0x0a6d('0x9')]+_0x0a6d('0xa')][_0x0a6d('0xb')](_0x5ae3d8[_0x0a6d('0xc')]['id'],_0x5b7404)['then'](function(_0x1b142f){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1369a3,_0x5ae3d8[_0x0a6d('0xc')]['id']);})[_0x0a6d('0xd')](function(_0x21915c){logger[_0x0a6d('0xe')](_0x0a6d('0xf'),_0x1369a3,JSON[_0x0a6d('0x10')](_0x21915c));})[_0x0a6d('0x11')](function(){_0x3513db[_0x0a6d('0x12')]();});}}catch(_0x5cc3b8){logger[_0x0a6d('0xe')](_0x0a6d('0xf'),_0x1369a3,JSON['stringify'](_0x5cc3b8));_0x3513db[_0x0a6d('0x12')]();}};};