Built motion from commit b5996064.|2.6.21
[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 _0x4c5a=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','stop','error','stringify','lodash','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c5a,0x1c0));var _0xa4c5=function(_0x151e67,_0x41cca0){_0x151e67=_0x151e67-0x0;var _0x8dc7c7=_0x4c5a[_0x151e67];return _0x8dc7c7;};'use strict';var _=require(_0xa4c5('0x0'));var utils=require(_0xa4c5('0x1'));var logger=require('../../../../config/logger')(_0xa4c5('0x2'));var rpc={'chatMessage':require(_0xa4c5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa4c5('0x4')),'smsMessage':require(_0xa4c5('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa4c5('0x6'))};exports['consequence']=function(_0x4ed3bd,_0x748d28){return function(_0x1141fe){try{var _0x1b7b9e={'body':utils[_0xa4c5('0x7')](_0x748d28[0x0],this),'ContactId':this['contact']['id']};if(this[_0xa4c5('0x8')]===_0xa4c5('0x9')){_0x1b7b9e[_0xa4c5('0xa')]=this[_0xa4c5('0xb')]['id'];}else{_0x1b7b9e[_['upperFirst'](this[_0xa4c5('0x8')])+_0xa4c5('0xc')]=this[_0xa4c5('0xb')]['id'];}_0x1b7b9e[_[_0xa4c5('0xd')](this[_0xa4c5('0x8')])+_0xa4c5('0xe')]=this[_0xa4c5('0xf')]['id'];if(rpc[this[_0xa4c5('0x8')]+_0xa4c5('0x10')]){return rpc[this[_0xa4c5('0x8')]+_0xa4c5('0x10')]['create'](_0x1b7b9e)[_0xa4c5('0x11')](function(_0x1ee5b6){logger[_0xa4c5('0x12')](_0xa4c5('0x13'),_0x4ed3bd,_0x1b7b9e[_0xa4c5('0x14')]);_0x1141fe[_0xa4c5('0x15')]();})['catch'](function(_0x44c912){logger['error'](_0xa4c5('0x13'),_0x4ed3bd,JSON['stringify'](_0x44c912));_0x1141fe[_0xa4c5('0x16')]();});}}catch(_0x47bc0c){logger[_0xa4c5('0x17')](_0xa4c5('0x13'),_0x4ed3bd,JSON[_0xa4c5('0x18')](_0x47bc0c));_0x1141fe[_0xa4c5('0x16')]();}};};