Built motion from commit (unavailable).|2.5.6
[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 _0xcbfa=['getMustacheRender','contact','channel','chat','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xcbfa,0xa2));var _0xacbf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xcbfa[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var utils=require(_0xacbf('0x0'));var logger=require(_0xacbf('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xacbf('0x2')),'smsMessage':require(_0xacbf('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xacbf('0x4'))};exports[_0xacbf('0x5')]=function(_0x85e046,_0x2ccc22){return function(_0x343e12){try{var _0x547cec={'body':utils[_0xacbf('0x6')](_0x2ccc22[0x0],this),'ContactId':this[_0xacbf('0x7')]['id']};if(this[_0xacbf('0x8')]===_0xacbf('0x9')){_0x547cec['ChatWebsiteId']=this['account']['id'];}else{_0x547cec[_[_0xacbf('0xa')](this['channel'])+_0xacbf('0xb')]=this['account']['id'];}_0x547cec[_[_0xacbf('0xa')](this[_0xacbf('0x8')])+'InteractionId']=this[_0xacbf('0xc')]['id'];if(rpc[this['channel']+_0xacbf('0xd')]){return rpc[this['channel']+'Message'][_0xacbf('0xe')](_0x547cec)[_0xacbf('0xf')](function(_0x4b4787){logger[_0xacbf('0x10')](_0xacbf('0x11'),_0x85e046,_0x547cec[_0xacbf('0x12')]);_0x343e12[_0xacbf('0x13')]();})[_0xacbf('0x14')](function(_0xa6b0e8){logger[_0xacbf('0x15')](_0xacbf('0x11'),_0x85e046,JSON[_0xacbf('0x16')](_0xa6b0e8));_0x343e12[_0xacbf('0x17')]();});}}catch(_0x1c7db2){logger['error'](_0xacbf('0x11'),_0x85e046,JSON[_0xacbf('0x16')](_0x1c7db2));_0x343e12[_0xacbf('0x17')]();}};};