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 _0x31f0=['consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x55bfb9,_0x208357){var _0x13c0f3=function(_0x96c95b){while(--_0x96c95b){_0x55bfb9['push'](_0x55bfb9['shift']());}};_0x13c0f3(++_0x208357);}(_0x31f0,0xb7));var _0x031f=function(_0xcb01d1,_0x5e7471){_0xcb01d1=_0xcb01d1-0x0;var _0x569c54=_0x31f0[_0xcb01d1];return _0x569c54;};'use strict';var moment=require(_0x031f('0x0'));var logger=require('../../../../config/logger')(_0x031f('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x031f('0x2')),'smsInteraction':require(_0x031f('0x3')),'mailInteraction':require(_0x031f('0x4')),'faxInteraction':require(_0x031f('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x031f('0x6')]=function(_0x1a63ba,_0x4f6059,_0x4c0f94,_0x56328c){return function(_0x3dc98e){try{logger['info'](_0x031f('0x7'),_0x1a63ba,_0x4f6059[0x0]);var _0x4300b4={'closed':0x1,'closedAt':moment()[_0x031f('0x8')](_0x031f('0x9')),'closeReason':'system','disposition':_0x4f6059[0x0]};if(rpc[_0x56328c[_0x031f('0xa')]+_0x031f('0xb')]){rpc[_0x56328c[_0x031f('0xa')]+_0x031f('0xb')][_0x031f('0xc')](_0x56328c[_0x031f('0xd')]['id'],_0x4300b4)[_0x031f('0xe')](function(_0x3fd541){logger['info'](_0x031f('0xf'),_0x1a63ba,_0x56328c[_0x031f('0xd')]['id']);})[_0x031f('0x10')](function(_0x351052){logger[_0x031f('0x11')](_0x031f('0x12'),_0x1a63ba,JSON[_0x031f('0x13')](_0x351052));})['finally'](function(){_0x3dc98e[_0x031f('0x14')]();});}}catch(_0x23b40c){logger[_0x031f('0x11')](_0x031f('0x12'),_0x1a63ba,JSON[_0x031f('0x13')](_0x23b40c));_0x3dc98e['stop']();}};};