Built motion from commit (unavailable).|2.3.94
[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 _0x3ec7=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','then','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','ChatInternalMessage,\x20%s,\x20%s','result'];(function(_0x516eb0,_0x2bf9ee){var _0x4a9a49=function(_0x3142a0){while(--_0x3142a0){_0x516eb0['push'](_0x516eb0['shift']());}};_0x4a9a49(++_0x2bf9ee);}(_0x3ec7,0x1e7));var _0x73ec=function(_0x258506,_0x663262){_0x258506=_0x258506-0x0;var _0x1a4dc1=_0x3ec7[_0x258506];return _0x1a4dc1;};'use strict';var _=require('lodash');var util=require(_0x73ec('0x0'));var moment=require(_0x73ec('0x1'));var BPromise=require('bluebird');var rs=require(_0x73ec('0x2'));var fs=require('fs');var Redis=require(_0x73ec('0x3'));var db=require(_0x73ec('0x4'))['db'];var utils=require(_0x73ec('0x5'));var logger=require(_0x73ec('0x6'))(_0x73ec('0x7'));var config=require(_0x73ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x73ec('0x9')][_0x73ec('0xa')]({'port':0x232a});config[_0x73ec('0xb')]=_[_0x73ec('0xc')](config[_0x73ec('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x73ec('0xd'))(new Redis(config[_0x73ec('0xb')]));require(_0x73ec('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b36e1,_0x312fe5,_0x2d12ba){return new BPromise(function(_0x6027b5,_0x5cc8c7){return client[_0x73ec('0xf')](_0x5b36e1,_0x2d12ba)[_0x73ec('0x10')](function(_0x4c258c){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x312fe5,'request\x20sent');logger[_0x73ec('0x11')](_0x73ec('0x12'),_0x312fe5,_0x73ec('0x13'),JSON[_0x73ec('0x14')](_0x4c258c));if(_0x4c258c[_0x73ec('0x15')]){if(_0x4c258c[_0x73ec('0x15')]['code']===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x312fe5,_0x4c258c[_0x73ec('0x15')]['message']);return _0x5cc8c7(_0x4c258c[_0x73ec('0x15')][_0x73ec('0x16')]);}logger[_0x73ec('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x312fe5,_0x4c258c[_0x73ec('0x15')][_0x73ec('0x16')]);return _0x6027b5(_0x4c258c[_0x73ec('0x15')][_0x73ec('0x16')]);}else{logger[_0x73ec('0x17')](_0x73ec('0x18'),_0x312fe5,_0x73ec('0x13'));_0x6027b5(_0x4c258c[_0x73ec('0x19')][_0x73ec('0x16')]);}})[_0x73ec('0x1a')](function(_0x366c98){logger[_0x73ec('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x312fe5,_0x366c98);_0x5cc8c7(_0x366c98);});});}