Built motion from commit 497d3d92.|2.5.43
[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 _0xe7f3=['error','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','AccountId','upperFirst','channel','InteractionId','interaction','Message','create','info','body','next','[%s][MESSAGE]\x20%s','stringify','stop'];(function(_0x502ed4,_0x52b3a5){var _0x1c78e6=function(_0x49d0e3){while(--_0x49d0e3){_0x502ed4['push'](_0x502ed4['shift']());}};_0x1c78e6(++_0x52b3a5);}(_0xe7f3,0x16d));var _0x3e7f=function(_0xe7aa09,_0x2a8a6b){_0xe7aa09=_0xe7aa09-0x0;var _0x34dd5c=_0xe7f3[_0xe7aa09];return _0x34dd5c;};'use strict';var _=require(_0x3e7f('0x0'));var utils=require('./utils');var logger=require(_0x3e7f('0x1'))('routing');var rpc={'chatMessage':require(_0x3e7f('0x2')),'openchannelMessage':require(_0x3e7f('0x3')),'mailMessage':require(_0x3e7f('0x4')),'smsMessage':require(_0x3e7f('0x5')),'faxMessage':require(_0x3e7f('0x6')),'whatsappMessage':require(_0x3e7f('0x7'))};exports[_0x3e7f('0x8')]=function(_0x2cdc2d,_0x55b495){return function(_0x344cfb){try{var _0xed0364={'body':utils[_0x3e7f('0x9')](_0x55b495[0x0],this),'ContactId':this[_0x3e7f('0xa')]['id']};if(this['channel']===_0x3e7f('0xb')){_0xed0364[_0x3e7f('0xc')]=this[_0x3e7f('0xd')]['id'];}else{_0xed0364[_['upperFirst'](this['channel'])+_0x3e7f('0xe')]=this['account']['id'];}_0xed0364[_[_0x3e7f('0xf')](this[_0x3e7f('0x10')])+_0x3e7f('0x11')]=this[_0x3e7f('0x12')]['id'];if(rpc[this['channel']+_0x3e7f('0x13')]){return rpc[this['channel']+_0x3e7f('0x13')][_0x3e7f('0x14')](_0xed0364)['then'](function(_0x4315bd){logger[_0x3e7f('0x15')]('[%s][MESSAGE]\x20%s',_0x2cdc2d,_0xed0364[_0x3e7f('0x16')]);_0x344cfb[_0x3e7f('0x17')]();})['catch'](function(_0x430ca4){logger['error'](_0x3e7f('0x18'),_0x2cdc2d,JSON[_0x3e7f('0x19')](_0x430ca4));_0x344cfb[_0x3e7f('0x1a')]();});}}catch(_0x4b2f6e){logger[_0x3e7f('0x1b')]('[%s][MESSAGE]\x20%s',_0x2cdc2d,JSON[_0x3e7f('0x19')](_0x4b2f6e));_0x344cfb[_0x3e7f('0x1a')]();}};};