0f6ba5e3552c8d5bdbf4eef152f659e6ae7cec30
[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 _0x2ea9=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x345a5b,_0x2e883f){var _0x256180=function(_0x674a46){while(--_0x674a46){_0x345a5b['push'](_0x345a5b['shift']());}};_0x256180(++_0x2e883f);}(_0x2ea9,0x110));var _0x92ea=function(_0x118230,_0x4cbc09){_0x118230=_0x118230-0x0;var _0x24e95d=_0x2ea9[_0x118230];return _0x24e95d;};'use strict';var _=require(_0x92ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x92ea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92ea('0x2'));var db=require(_0x92ea('0x3'))['db'];var utils=require(_0x92ea('0x4'));var logger=require(_0x92ea('0x5'))(_0x92ea('0x6'));var config=require(_0x92ea('0x7'));var jayson=require(_0x92ea('0x8'));var client=jayson[_0x92ea('0x9')][_0x92ea('0xa')]({'port':0x232a});config[_0x92ea('0xb')]=_['defaults'](config[_0x92ea('0xb')],{'host':_0x92ea('0xc'),'port':0x18eb});var socket=require(_0x92ea('0xd'))(new Redis(config[_0x92ea('0xb')]));require(_0x92ea('0xe'))[_0x92ea('0xf')](socket);function respondWithRpcPromise(_0x16ee34,_0x3ca10f,_0x480bc0){return new BPromise(function(_0x3c6b9b,_0x4e9e79){return client[_0x92ea('0x10')](_0x16ee34,_0x480bc0)[_0x92ea('0x11')](function(_0x1347b1){logger[_0x92ea('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x3ca10f,_0x92ea('0x13'));logger[_0x92ea('0x14')](_0x92ea('0x15'),_0x3ca10f,_0x92ea('0x13'),JSON[_0x92ea('0x16')](_0x1347b1));if(_0x1347b1[_0x92ea('0x17')]){if(_0x1347b1[_0x92ea('0x17')][_0x92ea('0x18')]===0x1f4){logger[_0x92ea('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x3ca10f,_0x1347b1[_0x92ea('0x17')][_0x92ea('0x19')]);return _0x4e9e79(_0x1347b1['error'][_0x92ea('0x19')]);}logger[_0x92ea('0x17')](_0x92ea('0x1a'),_0x3ca10f,_0x1347b1[_0x92ea('0x17')][_0x92ea('0x19')]);return _0x3c6b9b(_0x1347b1['error'][_0x92ea('0x19')]);}else{logger[_0x92ea('0x12')](_0x92ea('0x1a'),_0x3ca10f,_0x92ea('0x13'));_0x3c6b9b(_0x1347b1['result'][_0x92ea('0x19')]);}})[_0x92ea('0x1b')](function(_0x14b34a){logger[_0x92ea('0x17')](_0x92ea('0x1a'),_0x3ca10f,_0x14b34a);_0x4e9e79(_0x14b34a);});});}