Built motion from commit da617fac.|2.6.6
[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 _0xa86c=['../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment'];(function(_0x1eee6e,_0x12f7a3){var _0x3caf1d=function(_0x263ed9){while(--_0x263ed9){_0x1eee6e['push'](_0x1eee6e['shift']());}};_0x3caf1d(++_0x12f7a3);}(_0xa86c,0x1af));var _0xca86=function(_0x1e1943,_0x1a6d54){_0x1e1943=_0x1e1943-0x0;var _0x4989a9=_0xa86c[_0x1e1943];return _0x4989a9;};'use strict';var moment=require(_0xca86('0x0'));var logger=require(_0xca86('0x1'))('routing');var rpc={'chatInteraction':require(_0xca86('0x2')),'openchannelInteraction':require(_0xca86('0x3')),'smsInteraction':require(_0xca86('0x4')),'mailInteraction':require(_0xca86('0x5')),'faxInteraction':require(_0xca86('0x6')),'whatsappInteraction':require(_0xca86('0x7'))};exports[_0xca86('0x8')]=function(_0x3d1c7b,_0x153ed8,_0x25849f,_0x464260){return function(_0x3747d7){try{logger[_0xca86('0x9')](_0xca86('0xa'),_0x3d1c7b,_0x153ed8[0x0]);var _0x48a645={'closed':0x1,'closedAt':moment()['format'](_0xca86('0xb')),'closeReason':_0xca86('0xc'),'disposition':_0x153ed8[0x0]};if(rpc[_0x464260[_0xca86('0xd')]+'Interaction']){rpc[_0x464260['channel']+_0xca86('0xe')][_0xca86('0xf')](_0x464260['interaction']['id'],_0x48a645)[_0xca86('0x10')](function(_0x6b5fdb){logger[_0xca86('0x9')](_0xca86('0x11'),_0x3d1c7b,_0x464260[_0xca86('0x12')]['id']);})['catch'](function(_0x1cb46d){logger[_0xca86('0x13')](_0xca86('0x14'),_0x3d1c7b,JSON[_0xca86('0x15')](_0x1cb46d));})[_0xca86('0x16')](function(){_0x3747d7[_0xca86('0x17')]();});}}catch(_0x23137a){logger['error'](_0xca86('0x14'),_0x3d1c7b,JSON[_0xca86('0x15')](_0x23137a));_0x3747d7['stop']();}};};