Built motion from commit 3c2ce842.|2.6.31
[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 _0x37e9=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x37e9,0x1f4));var _0x937e=function(_0x446384,_0x261f80){_0x446384=_0x446384-0x0;var _0x2d6e2f=_0x37e9[_0x446384];return _0x2d6e2f;};'use strict';var _=require('lodash');var utils=require(_0x937e('0x0'));var logger=require(_0x937e('0x1'))(_0x937e('0x2'));var rpc={'chatMessage':require(_0x937e('0x3')),'openchannelMessage':require(_0x937e('0x4')),'mailMessage':require(_0x937e('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x937e('0x6')),'whatsappMessage':require(_0x937e('0x7'))};exports[_0x937e('0x8')]=function(_0x40418b,_0x3830a6){return function(_0x24c1c7){try{var _0x5a648d={'body':utils[_0x937e('0x9')](_0x3830a6[0x0],this),'ContactId':this[_0x937e('0xa')]['id']};if(this[_0x937e('0xb')]==='chat'){_0x5a648d[_0x937e('0xc')]=this[_0x937e('0xd')]['id'];}else{_0x5a648d[_[_0x937e('0xe')](this['channel'])+'AccountId']=this[_0x937e('0xd')]['id'];}_0x5a648d[_['upperFirst'](this[_0x937e('0xb')])+_0x937e('0xf')]=this[_0x937e('0x10')]['id'];if(rpc[this['channel']+_0x937e('0x11')]){return rpc[this[_0x937e('0xb')]+'Message'][_0x937e('0x12')](_0x5a648d)[_0x937e('0x13')](function(_0x39dbc4){logger[_0x937e('0x14')](_0x937e('0x15'),_0x40418b,_0x5a648d[_0x937e('0x16')]);_0x24c1c7[_0x937e('0x17')]();})[_0x937e('0x18')](function(_0x52edab){logger[_0x937e('0x19')](_0x937e('0x15'),_0x40418b,JSON['stringify'](_0x52edab));_0x24c1c7[_0x937e('0x1a')]();});}}catch(_0x2735d5){logger[_0x937e('0x19')](_0x937e('0x15'),_0x40418b,JSON[_0x937e('0x1b')](_0x2735d5));_0x24c1c7[_0x937e('0x1a')]();}};};