Built motion from commit (unavailable).|2.5.0
[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 _0x94d2=['error','[%s][CLOSE]\x20%s','stringify','finally','stop','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x94d2,0x1cd));var _0x294d=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x94d2[_0x235f49];return _0x551139;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x294d('0x0'));var rpc={'chatInteraction':require(_0x294d('0x1')),'openchannelInteraction':require(_0x294d('0x2')),'smsInteraction':require(_0x294d('0x3')),'mailInteraction':require(_0x294d('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};exports['consequence']=function(_0x2f2fc8,_0x393430,_0xb2c63a,_0x234700){return function(_0x279b9b){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x2f2fc8,_0x393430[0x0]);var _0x2cf111={'closed':0x1,'closedAt':moment()[_0x294d('0x5')](_0x294d('0x6')),'closeReason':_0x294d('0x7'),'disposition':_0x393430[0x0]};if(rpc[_0x234700[_0x294d('0x8')]+'Interaction']){rpc[_0x234700[_0x294d('0x8')]+_0x294d('0x9')]['update'](_0x234700[_0x294d('0xa')]['id'],_0x2cf111)[_0x294d('0xb')](function(_0x56f7c7){logger['info'](_0x294d('0xc'),_0x2f2fc8,_0x234700[_0x294d('0xa')]['id']);})[_0x294d('0xd')](function(_0x54de42){logger[_0x294d('0xe')](_0x294d('0xf'),_0x2f2fc8,JSON[_0x294d('0x10')](_0x54de42));})[_0x294d('0x11')](function(){_0x279b9b['stop']();});}}catch(_0xc3a5c8){logger['error']('[%s][CLOSE]\x20%s',_0x2f2fc8,JSON[_0x294d('0x10')](_0xc3a5c8));_0x279b9b[_0x294d('0x12')]();}};};