Built motion from commit (unavailable).|2.2.2
[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 _0x9c2c=['interaction','then','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction'];(function(_0x473619,_0x5d553a){var _0x594798=function(_0x4a1d94){while(--_0x4a1d94){_0x473619['push'](_0x473619['shift']());}};_0x594798(++_0x5d553a);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xc9c2('0x0'));var logger=require(_0xc9c2('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc9c2('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xc9c2('0x3'))};exports[_0xc9c2('0x4')]=function(_0x5bf334,_0x4db342,_0x35818b,_0x5140a8){return function(_0x30f3d6){try{logger[_0xc9c2('0x5')](_0xc9c2('0x6'),_0x5bf334,_0x4db342[0x0]);var _0x18a815={'closed':0x1,'closedAt':moment()[_0xc9c2('0x7')](_0xc9c2('0x8')),'closeReason':_0xc9c2('0x9'),'disposition':_0x4db342[0x0]};if(rpc[_0x5140a8[_0xc9c2('0xa')]+_0xc9c2('0xb')]){rpc[_0x5140a8['channel']+_0xc9c2('0xb')]['update'](_0x5140a8[_0xc9c2('0xc')]['id'],_0x18a815)[_0xc9c2('0xd')](function(_0x2a0d62){logger[_0xc9c2('0x5')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5bf334,_0x5140a8['interaction']['id']);})[_0xc9c2('0xe')](function(_0x25aee6){logger['error'](_0xc9c2('0xf'),_0x5bf334,JSON[_0xc9c2('0x10')](_0x25aee6));})[_0xc9c2('0x11')](function(){_0x30f3d6[_0xc9c2('0x12')]();});}}catch(_0x81352e){logger[_0xc9c2('0x13')](_0xc9c2('0xf'),_0x5bf334,JSON[_0xc9c2('0x10')](_0x81352e));_0x30f3d6[_0xc9c2('0x12')]();}};};