095109354a8cea60c00a0d3e10b834345285cc9f
[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 _0xdbca=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','finally','stop','stringify','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x26bc36,_0x95e54){var _0x173490=function(_0xc1dacb){while(--_0xc1dacb){_0x26bc36['push'](_0x26bc36['shift']());}};_0x173490(++_0x95e54);}(_0xdbca,0x8d));var _0xadbc=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0xdbca[_0x1b8d87];return _0x182b74;};'use strict';var moment=require('moment');var logger=require(_0xadbc('0x0'))(_0xadbc('0x1'));var rpc={'chatInteraction':require(_0xadbc('0x2')),'openchannelInteraction':require(_0xadbc('0x3')),'smsInteraction':require(_0xadbc('0x4')),'mailInteraction':require(_0xadbc('0x5')),'faxInteraction':require(_0xadbc('0x6')),'whatsappInteraction':require(_0xadbc('0x7'))};exports[_0xadbc('0x8')]=function(_0xdc6a5e,_0x20e1fe,_0x4dd684,_0x292d1b){return function(_0x11bbe0){try{logger[_0xadbc('0x9')](_0xadbc('0xa'),_0xdc6a5e,_0x20e1fe[0x0]);var _0x338ac7={'closed':0x1,'closedAt':moment()[_0xadbc('0xb')](_0xadbc('0xc')),'closeReason':_0xadbc('0xd'),'disposition':_0x20e1fe[0x0]};if(rpc[_0x292d1b['channel']+'Interaction']){rpc[_0x292d1b['channel']+_0xadbc('0xe')][_0xadbc('0xf')](_0x292d1b[_0xadbc('0x10')]['id'],_0x338ac7)[_0xadbc('0x11')](function(_0x4b380f){logger['info'](_0xadbc('0x12'),_0xdc6a5e,_0x292d1b[_0xadbc('0x10')]['id']);})[_0xadbc('0x13')](function(_0x1237e5){logger[_0xadbc('0x14')]('[%s][CLOSE]\x20%s',_0xdc6a5e,JSON['stringify'](_0x1237e5));})[_0xadbc('0x15')](function(){_0x11bbe0[_0xadbc('0x16')]();});}}catch(_0x7745e3){logger[_0xadbc('0x14')]('[%s][CLOSE]\x20%s',_0xdc6a5e,JSON[_0xadbc('0x17')](_0x7745e3));_0x11bbe0[_0xadbc('0x16')]();}};};