Built motion from commit c0cdc9d8.|2.6.28
[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 _0xd3f5=['system','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2dd7ba,_0x2f1a58){var _0x3a659f=function(_0x1e5497){while(--_0x1e5497){_0x2dd7ba['push'](_0x2dd7ba['shift']());}};_0x3a659f(++_0x2f1a58);}(_0xd3f5,0x1a9));var _0x5d3f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd3f5[_0x3b380d];return _0x54502b;};'use strict';var moment=require(_0x5d3f('0x0'));var logger=require(_0x5d3f('0x1'))(_0x5d3f('0x2'));var rpc={'chatInteraction':require(_0x5d3f('0x3')),'openchannelInteraction':require(_0x5d3f('0x4')),'smsInteraction':require(_0x5d3f('0x5')),'mailInteraction':require(_0x5d3f('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5d3f('0x7'))};exports[_0x5d3f('0x8')]=function(_0x5c7111,_0x16c65d,_0x3436f1,_0x247ad0){return function(_0xfb068f){try{logger[_0x5d3f('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x5c7111,_0x16c65d[0x0]);var _0x41d9c5={'closed':0x1,'closedAt':moment()[_0x5d3f('0xa')](_0x5d3f('0xb')),'closeReason':_0x5d3f('0xc'),'disposition':_0x16c65d[0x0]};if(rpc[_0x247ad0[_0x5d3f('0xd')]+_0x5d3f('0xe')]){rpc[_0x247ad0[_0x5d3f('0xd')]+_0x5d3f('0xe')]['update'](_0x247ad0['interaction']['id'],_0x41d9c5)[_0x5d3f('0xf')](function(_0x5615b2){logger[_0x5d3f('0x9')](_0x5d3f('0x10'),_0x5c7111,_0x247ad0[_0x5d3f('0x11')]['id']);})['catch'](function(_0x4595b6){logger[_0x5d3f('0x12')]('[%s][CLOSE]\x20%s',_0x5c7111,JSON[_0x5d3f('0x13')](_0x4595b6));})[_0x5d3f('0x14')](function(){_0xfb068f[_0x5d3f('0x15')]();});}}catch(_0x54bf5b){logger[_0x5d3f('0x12')](_0x5d3f('0x16'),_0x5c7111,JSON['stringify'](_0x54bf5b));_0xfb068f[_0x5d3f('0x15')]();}};};