Built motion from commit (unavailable).|2.5.4
[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 _0x24ce=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','[%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!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','../../../../config/logger','routing'];(function(_0x34033d,_0x471338){var _0x20abf1=function(_0x3751d8){while(--_0x3751d8){_0x34033d['push'](_0x34033d['shift']());}};_0x20abf1(++_0x471338);}(_0x24ce,0x1de));var _0xe24c=function(_0x1f7dc1,_0xc0562d){_0x1f7dc1=_0x1f7dc1-0x0;var _0x36b0d6=_0x24ce[_0x1f7dc1];return _0x36b0d6;};'use strict';var moment=require('moment');var logger=require(_0xe24c('0x0'))(_0xe24c('0x1'));var rpc={'chatInteraction':require(_0xe24c('0x2')),'openchannelInteraction':require(_0xe24c('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe24c('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x33d18c,_0x18e92c,_0x6f92e0,_0x1ac59c){return function(_0xe1d970){try{logger['info'](_0xe24c('0x5'),_0x33d18c,_0x18e92c[0x0]);var _0x2d8dde={'closed':0x1,'closedAt':moment()[_0xe24c('0x6')](_0xe24c('0x7')),'closeReason':_0xe24c('0x8'),'disposition':_0x18e92c[0x0]};if(rpc[_0x1ac59c[_0xe24c('0x9')]+_0xe24c('0xa')]){rpc[_0x1ac59c[_0xe24c('0x9')]+_0xe24c('0xa')][_0xe24c('0xb')](_0x1ac59c[_0xe24c('0xc')]['id'],_0x2d8dde)[_0xe24c('0xd')](function(_0x2534a0){logger['info'](_0xe24c('0xe'),_0x33d18c,_0x1ac59c['interaction']['id']);})[_0xe24c('0xf')](function(_0x59a9b5){logger[_0xe24c('0x10')](_0xe24c('0x11'),_0x33d18c,JSON['stringify'](_0x59a9b5));})['finally'](function(){_0xe1d970['stop']();});}}catch(_0x3f0955){logger['error'](_0xe24c('0x11'),_0x33d18c,JSON[_0xe24c('0x12')](_0x3f0955));_0xe1d970[_0xe24c('0x13')]();}};};