f29fa1ae35c63f77bfef4fc834156a434167449d
[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 _0xdb21=['stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','channel','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xdb21,0xcd));var _0x1db2=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0xdb21[_0x214d54];return _0x44ca46;};'use strict';var _=require(_0x1db2('0x0'));var utils=require(_0x1db2('0x1'));var logger=require('../../../../config/logger')(_0x1db2('0x2'));var rpc={'chatMessage':require(_0x1db2('0x3')),'openchannelMessage':require(_0x1db2('0x4')),'mailMessage':require(_0x1db2('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1db2('0x6')),'whatsappMessage':require(_0x1db2('0x7'))};exports[_0x1db2('0x8')]=function(_0x4732b6,_0x23784b){return function(_0x1f5184){try{var _0x2091b4={'body':utils[_0x1db2('0x9')](_0x23784b[0x0],this),'ContactId':this[_0x1db2('0xa')]['id']};if(this['channel']===_0x1db2('0xb')){_0x2091b4[_0x1db2('0xc')]=this[_0x1db2('0xd')]['id'];}else{_0x2091b4[_['upperFirst'](this[_0x1db2('0xe')])+_0x1db2('0xf')]=this[_0x1db2('0xd')]['id'];}_0x2091b4[_[_0x1db2('0x10')](this[_0x1db2('0xe')])+_0x1db2('0x11')]=this[_0x1db2('0x12')]['id'];if(rpc[this[_0x1db2('0xe')]+'Message']){return rpc[this[_0x1db2('0xe')]+_0x1db2('0x13')][_0x1db2('0x14')](_0x2091b4)[_0x1db2('0x15')](function(_0x93baf7){logger[_0x1db2('0x16')](_0x1db2('0x17'),_0x4732b6,_0x2091b4['body']);_0x1f5184[_0x1db2('0x18')]();})[_0x1db2('0x19')](function(_0x414336){logger[_0x1db2('0x1a')](_0x1db2('0x17'),_0x4732b6,JSON[_0x1db2('0x1b')](_0x414336));_0x1f5184[_0x1db2('0x1c')]();});}}catch(_0x371737){logger[_0x1db2('0x1a')](_0x1db2('0x17'),_0x4732b6,JSON[_0x1db2('0x1b')](_0x371737));_0x1f5184[_0x1db2('0x1c')]();}};};