fb15cc7823439bd792eb668ea9a2bbacd156edff
[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 _0xfa21=['../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','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','stringify','stop','moment'];(function(_0x3c3fa0,_0x4224be){var _0x4eaa8d=function(_0x239f34){while(--_0x239f34){_0x3c3fa0['push'](_0x3c3fa0['shift']());}};_0x4eaa8d(++_0x4224be);}(_0xfa21,0x7d));var _0x1fa2=function(_0x103d45,_0x21187e){_0x103d45=_0x103d45-0x0;var _0x47d034=_0xfa21[_0x103d45];return _0x47d034;};'use strict';var moment=require(_0x1fa2('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x1fa2('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1fa2('0x2')),'mailInteraction':require(_0x1fa2('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1fa2('0x4'))};exports[_0x1fa2('0x5')]=function(_0x1cf961,_0x4981d4,_0x26eb7f,_0x1db1fe){return function(_0xaae1fa){try{logger[_0x1fa2('0x6')](_0x1fa2('0x7'),_0x1cf961,_0x4981d4[0x0]);var _0x370ea1={'closed':0x1,'closedAt':moment()[_0x1fa2('0x8')](_0x1fa2('0x9')),'closeReason':_0x1fa2('0xa'),'disposition':_0x4981d4[0x0]};if(rpc[_0x1db1fe[_0x1fa2('0xb')]+_0x1fa2('0xc')]){rpc[_0x1db1fe[_0x1fa2('0xb')]+_0x1fa2('0xc')][_0x1fa2('0xd')](_0x1db1fe[_0x1fa2('0xe')]['id'],_0x370ea1)[_0x1fa2('0xf')](function(_0x2bc502){logger['info'](_0x1fa2('0x10'),_0x1cf961,_0x1db1fe[_0x1fa2('0xe')]['id']);})['catch'](function(_0x4f2c7e){logger[_0x1fa2('0x11')](_0x1fa2('0x12'),_0x1cf961,JSON[_0x1fa2('0x13')](_0x4f2c7e));})['finally'](function(){_0xaae1fa[_0x1fa2('0x14')]();});}}catch(_0x2dd515){logger[_0x1fa2('0x11')]('[%s][CLOSE]\x20%s',_0x1cf961,JSON['stringify'](_0x2dd515));_0xaae1fa[_0x1fa2('0x14')]();}};};