Built motion from commit (unavailable).|2.2.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 _0x8ce8=['error','[%s][CLOSE]\x20%s','stop','stringify','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%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'];(function(_0x168d63,_0x1f3478){var _0x2cfb43=function(_0x6a9d25){while(--_0x6a9d25){_0x168d63['push'](_0x168d63['shift']());}};_0x2cfb43(++_0x1f3478);}(_0x8ce8,0xd3));var _0x88ce=function(_0x4f58a7,_0x13aec8){_0x4f58a7=_0x4f58a7-0x0;var _0x83e376=_0x8ce8[_0x4f58a7];return _0x83e376;};'use strict';var moment=require(_0x88ce('0x0'));var logger=require('../../../../config/logger')(_0x88ce('0x1'));var rpc={'chatInteraction':require(_0x88ce('0x2')),'openchannelInteraction':require(_0x88ce('0x3')),'smsInteraction':require(_0x88ce('0x4')),'mailInteraction':require(_0x88ce('0x5')),'faxInteraction':require(_0x88ce('0x6'))};exports[_0x88ce('0x7')]=function(_0x1adf89,_0x460e42,_0x8f83dc,_0x530921){return function(_0x58e101){try{logger[_0x88ce('0x8')](_0x88ce('0x9'),_0x1adf89,_0x460e42[0x0]);var _0x32de44={'closed':0x1,'closedAt':moment()[_0x88ce('0xa')](_0x88ce('0xb')),'closeReason':'system','disposition':_0x460e42[0x0]};if(rpc[_0x530921[_0x88ce('0xc')]+'Interaction']){rpc[_0x530921[_0x88ce('0xc')]+_0x88ce('0xd')][_0x88ce('0xe')](_0x530921[_0x88ce('0xf')]['id'],_0x32de44)[_0x88ce('0x10')](function(_0x3d8ad6){logger[_0x88ce('0x8')](_0x88ce('0x11'),_0x1adf89,_0x530921['interaction']['id']);})[_0x88ce('0x12')](function(_0x4cd1c0){logger[_0x88ce('0x13')](_0x88ce('0x14'),_0x1adf89,JSON['stringify'](_0x4cd1c0));})['finally'](function(){_0x58e101[_0x88ce('0x15')]();});}}catch(_0xbc1936){logger[_0x88ce('0x13')](_0x88ce('0x14'),_0x1adf89,JSON[_0x88ce('0x16')](_0xbc1936));_0x58e101[_0x88ce('0x15')]();}};};