Built motion from commit 753c950e.|2.5.42
[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 _0xf0e5=['http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xf0e5,0x1e3));var _0x5f0e=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf0e5[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f0e('0x0'));var BPromise=require(_0x5f0e('0x1'));var rs=require(_0x5f0e('0x2'));var fs=require('fs');var Redis=require(_0x5f0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f0e('0x4'));var logger=require(_0x5f0e('0x5'))(_0x5f0e('0x6'));var config=require(_0x5f0e('0x7'));var jayson=require(_0x5f0e('0x8'));var client=jayson[_0x5f0e('0x9')][_0x5f0e('0xa')]({'port':0x232a});config[_0x5f0e('0xb')]=_[_0x5f0e('0xc')](config[_0x5f0e('0xb')],{'host':_0x5f0e('0xd'),'port':0x18eb});var socket=require(_0x5f0e('0xe'))(new Redis(config['redis']));require(_0x5f0e('0xf'))['register'](socket);function respondWithRpcPromise(_0x385655,_0x5f4119,_0x4e663c){return new BPromise(function(_0x15ad40,_0x3f5296){return client[_0x5f0e('0x10')](_0x385655,_0x4e663c)[_0x5f0e('0x11')](function(_0x3168fe){logger[_0x5f0e('0x12')](_0x5f0e('0x13'),_0x5f4119,'request\x20sent');logger[_0x5f0e('0x14')](_0x5f0e('0x15'),_0x5f4119,_0x5f0e('0x16'),JSON[_0x5f0e('0x17')](_0x3168fe));if(_0x3168fe[_0x5f0e('0x18')]){if(_0x3168fe['error'][_0x5f0e('0x19')]===0x1f4){logger[_0x5f0e('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f4119,_0x3168fe[_0x5f0e('0x18')][_0x5f0e('0x1a')]);return _0x3f5296(_0x3168fe[_0x5f0e('0x18')][_0x5f0e('0x1a')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x5f4119,_0x3168fe['error'][_0x5f0e('0x1a')]);return _0x15ad40(_0x3168fe['error'][_0x5f0e('0x1a')]);}else{logger[_0x5f0e('0x12')](_0x5f0e('0x13'),_0x5f4119,'request\x20sent');_0x15ad40(_0x3168fe[_0x5f0e('0x1b')]['message']);}})[_0x5f0e('0x1c')](function(_0x5a96ab){logger['error'](_0x5f0e('0x13'),_0x5f4119,_0x5a96ab);_0x3f5296(_0x5a96ab);});});}