Built motion from commit d69f4380.|2.6.29
[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 _0xe87d=['stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s'];(function(_0x3fc28f,_0x5aba73){var _0x36bd7e=function(_0x5f16f9){while(--_0x5f16f9){_0x3fc28f['push'](_0x3fc28f['shift']());}};_0x36bd7e(++_0x5aba73);}(_0xe87d,0xdb));var _0xde87=function(_0xf3ccda,_0x182c8f){_0xf3ccda=_0xf3ccda-0x0;var _0x35638c=_0xe87d[_0xf3ccda];return _0x35638c;};'use strict';var moment=require(_0xde87('0x0'));var logger=require(_0xde87('0x1'))('routing');var rpc={'chatInteraction':require(_0xde87('0x2')),'openchannelInteraction':require(_0xde87('0x3')),'smsInteraction':require(_0xde87('0x4')),'mailInteraction':require(_0xde87('0x5')),'faxInteraction':require(_0xde87('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xde87('0x7')]=function(_0x41af2e,_0x475fa4,_0x3a4fa9,_0x1fe7bf){return function(_0x5509a3){try{logger[_0xde87('0x8')](_0xde87('0x9'),_0x41af2e,_0x475fa4[0x0]);var _0x418bc5={'closed':0x1,'closedAt':moment()[_0xde87('0xa')](_0xde87('0xb')),'closeReason':_0xde87('0xc'),'disposition':_0x475fa4[0x0]};if(rpc[_0x1fe7bf[_0xde87('0xd')]+'Interaction']){rpc[_0x1fe7bf[_0xde87('0xd')]+_0xde87('0xe')][_0xde87('0xf')](_0x1fe7bf[_0xde87('0x10')]['id'],_0x418bc5)[_0xde87('0x11')](function(_0x12a3ae){logger[_0xde87('0x8')](_0xde87('0x12'),_0x41af2e,_0x1fe7bf[_0xde87('0x10')]['id']);})['catch'](function(_0x178f77){logger[_0xde87('0x13')](_0xde87('0x14'),_0x41af2e,JSON[_0xde87('0x15')](_0x178f77));})[_0xde87('0x16')](function(){_0x5509a3[_0xde87('0x17')]();});}}catch(_0x5cc618){logger['error'](_0xde87('0x14'),_0x41af2e,JSON[_0xde87('0x15')](_0x5cc618));_0x5509a3['stop']();}};};