e13188918adbcdd4ac1852d9d49aeb00722cf0e0
[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 _0x2a4f=['next','catch','error','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x2a4f,0xac));var _0xf2a4=function(_0x51156d,_0xe9e50){_0x51156d=_0x51156d-0x0;var _0x598764=_0x2a4f[_0x51156d];return _0x598764;};'use strict';var _=require('lodash');var utils=require(_0xf2a4('0x0'));var logger=require(_0xf2a4('0x1'))(_0xf2a4('0x2'));var rpc={'chatMessage':require(_0xf2a4('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf2a4('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf2a4('0x5'))};exports[_0xf2a4('0x6')]=function(_0x5d5b88,_0x18438e){return function(_0x2df18a){try{var _0x108baf={'body':utils['getMustacheRender'](_0x18438e[0x0],this),'ContactId':this[_0xf2a4('0x7')]['id']};if(this[_0xf2a4('0x8')]==='chat'){_0x108baf[_0xf2a4('0x9')]=this['account']['id'];}else{_0x108baf[_[_0xf2a4('0xa')](this[_0xf2a4('0x8')])+_0xf2a4('0xb')]=this['account']['id'];}_0x108baf[_['upperFirst'](this['channel'])+_0xf2a4('0xc')]=this[_0xf2a4('0xd')]['id'];if(rpc[this['channel']+_0xf2a4('0xe')]){return rpc[this[_0xf2a4('0x8')]+'Message'][_0xf2a4('0xf')](_0x108baf)[_0xf2a4('0x10')](function(_0x78718d){logger[_0xf2a4('0x11')](_0xf2a4('0x12'),_0x5d5b88,_0x108baf[_0xf2a4('0x13')]);_0x2df18a[_0xf2a4('0x14')]();})[_0xf2a4('0x15')](function(_0x2cea2e){logger[_0xf2a4('0x16')](_0xf2a4('0x12'),_0x5d5b88,JSON['stringify'](_0x2cea2e));_0x2df18a[_0xf2a4('0x17')]();});}}catch(_0x555109){logger[_0xf2a4('0x16')](_0xf2a4('0x12'),_0x5d5b88,JSON['stringify'](_0x555109));_0x2df18a[_0xf2a4('0x17')]();}};};