Built motion from commit 19a84241.|2.5.34
[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 _0xf4f5=['stop','error','lodash','./utils','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','AccountId','channel','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify'];(function(_0x399a05,_0x236939){var _0x1f4676=function(_0x2137ad){while(--_0x2137ad){_0x399a05['push'](_0x399a05['shift']());}};_0x1f4676(++_0x236939);}(_0xf4f5,0x89));var _0x5f4f=function(_0x426509,_0x5604e4){_0x426509=_0x426509-0x0;var _0x2fee34=_0xf4f5[_0x426509];return _0x2fee34;};'use strict';var _=require(_0x5f4f('0x0'));var utils=require(_0x5f4f('0x1'));var logger=require('../../../../config/logger')(_0x5f4f('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5f4f('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5f4f('0x4')),'faxMessage':require(_0x5f4f('0x5')),'whatsappMessage':require(_0x5f4f('0x6'))};exports[_0x5f4f('0x7')]=function(_0x554c4c,_0x18efa9){return function(_0x5934cd){try{var _0x48b5d9={'body':utils[_0x5f4f('0x8')](_0x18efa9[0x0],this),'ContactId':this[_0x5f4f('0x9')]['id']};if(this['channel']===_0x5f4f('0xa')){_0x48b5d9[_0x5f4f('0xb')]=this[_0x5f4f('0xc')]['id'];}else{_0x48b5d9[_[_0x5f4f('0xd')](this['channel'])+_0x5f4f('0xe')]=this[_0x5f4f('0xc')]['id'];}_0x48b5d9[_[_0x5f4f('0xd')](this[_0x5f4f('0xf')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x5f4f('0xf')]+_0x5f4f('0x10')]){return rpc[this[_0x5f4f('0xf')]+_0x5f4f('0x10')][_0x5f4f('0x11')](_0x48b5d9)[_0x5f4f('0x12')](function(_0x467c09){logger[_0x5f4f('0x13')](_0x5f4f('0x14'),_0x554c4c,_0x48b5d9[_0x5f4f('0x15')]);_0x5934cd[_0x5f4f('0x16')]();})[_0x5f4f('0x17')](function(_0x10b440){logger['error'](_0x5f4f('0x14'),_0x554c4c,JSON[_0x5f4f('0x18')](_0x10b440));_0x5934cd[_0x5f4f('0x19')]();});}}catch(_0x2cd43d){logger[_0x5f4f('0x1a')](_0x5f4f('0x14'),_0x554c4c,JSON[_0x5f4f('0x18')](_0x2cd43d));_0x5934cd[_0x5f4f('0x19')]();}};};