6892214df0cfd49329b3688bfba19f082944c34c
[motion2.git] / server / api / chatInternalMessage / chatInternalMessage.rpc.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 _0x9034=['request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket'];(function(_0x4a5570,_0x103d7b){var _0x338d1d=function(_0xe44a85){while(--_0xe44a85){_0x4a5570['push'](_0x4a5570['shift']());}};_0x338d1d(++_0x103d7b);}(_0x9034,0x178));var _0x4903=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9034[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4903('0x0'));var util=require('util');var moment=require(_0x4903('0x1'));var BPromise=require(_0x4903('0x2'));var rs=require(_0x4903('0x3'));var fs=require('fs');var Redis=require(_0x4903('0x4'));var db=require(_0x4903('0x5'))['db'];var utils=require(_0x4903('0x6'));var logger=require(_0x4903('0x7'))('rpc');var config=require(_0x4903('0x8'));var jayson=require(_0x4903('0x9'));var client=jayson[_0x4903('0xa')][_0x4903('0xb')]({'port':0x232a});config[_0x4903('0xc')]=_[_0x4903('0xd')](config['redis'],{'host':_0x4903('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4903('0xf'))['register'](socket);function respondWithRpcPromise(_0x4407cd,_0x2c03d1,_0x24e4c3){return new BPromise(function(_0x52de39,_0x34d55f){return client[_0x4903('0x10')](_0x4407cd,_0x24e4c3)[_0x4903('0x11')](function(_0x3965c2){logger[_0x4903('0x12')](_0x4903('0x13'),_0x2c03d1,_0x4903('0x14'));logger[_0x4903('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2c03d1,'request\x20sent',JSON[_0x4903('0x16')](_0x3965c2));if(_0x3965c2[_0x4903('0x17')]){if(_0x3965c2[_0x4903('0x17')][_0x4903('0x18')]===0x1f4){logger[_0x4903('0x17')](_0x4903('0x13'),_0x2c03d1,_0x3965c2['error']['message']);return _0x34d55f(_0x3965c2['error'][_0x4903('0x19')]);}logger[_0x4903('0x17')](_0x4903('0x13'),_0x2c03d1,_0x3965c2[_0x4903('0x17')]['message']);return _0x52de39(_0x3965c2[_0x4903('0x17')][_0x4903('0x19')]);}else{logger['info'](_0x4903('0x13'),_0x2c03d1,'request\x20sent');_0x52de39(_0x3965c2[_0x4903('0x1a')][_0x4903('0x19')]);}})[_0x4903('0x1b')](function(_0x1879aa){logger[_0x4903('0x17')](_0x4903('0x13'),_0x2c03d1,_0x1879aa);_0x34d55f(_0x1879aa);});});}