2c7559f1c019f941c1953738b9d3af4dc6099f04
[motion2.git] / server / services / routing / server / applications / message.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 _0x3c1a=['Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','error','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','contact','channel','chat','ChatWebsiteId','account','InteractionId','interaction'];(function(_0x416410,_0x6a9e9a){var _0x4bc727=function(_0x104840){while(--_0x104840){_0x416410['push'](_0x416410['shift']());}};_0x4bc727(++_0x6a9e9a);}(_0x3c1a,0xda));var _0xa3c1=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x3c1a[_0x29ae80];return _0x5d6d71;};'use strict';var _=require(_0xa3c1('0x0'));var utils=require(_0xa3c1('0x1'));var logger=require(_0xa3c1('0x2'))(_0xa3c1('0x3'));var rpc={'chatMessage':require(_0xa3c1('0x4')),'openchannelMessage':require(_0xa3c1('0x5')),'mailMessage':require(_0xa3c1('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa3c1('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xa3c1('0x8')]=function(_0x8e2873,_0x3f6cab){return function(_0x2da4d2){try{var _0x546253={'body':utils['getMustacheRender'](_0x3f6cab[0x0],this),'ContactId':this[_0xa3c1('0x9')]['id']};if(this[_0xa3c1('0xa')]===_0xa3c1('0xb')){_0x546253[_0xa3c1('0xc')]=this[_0xa3c1('0xd')]['id'];}else{_0x546253[_['upperFirst'](this[_0xa3c1('0xa')])+'AccountId']=this['account']['id'];}_0x546253[_['upperFirst'](this['channel'])+_0xa3c1('0xe')]=this[_0xa3c1('0xf')]['id'];if(rpc[this[_0xa3c1('0xa')]+_0xa3c1('0x10')]){return rpc[this[_0xa3c1('0xa')]+_0xa3c1('0x10')][_0xa3c1('0x11')](_0x546253)['then'](function(_0x2d2499){logger[_0xa3c1('0x12')](_0xa3c1('0x13'),_0x8e2873,_0x546253[_0xa3c1('0x14')]);_0x2da4d2[_0xa3c1('0x15')]();})[_0xa3c1('0x16')](function(_0x1d3837){logger['error'](_0xa3c1('0x13'),_0x8e2873,JSON[_0xa3c1('0x17')](_0x1d3837));_0x2da4d2['stop']();});}}catch(_0x261ac7){logger[_0xa3c1('0x18')]('[%s][MESSAGE]\x20%s',_0x8e2873,JSON['stringify'](_0x261ac7));_0x2da4d2[_0xa3c1('0x19')]();}};};