Built motion from commit 9d0783e6.|2.6.13
[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 _0xc343=['client','http','redis','./chatInternalMessage.socket','register','request','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','ChatInternalMessage,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x24919a,_0x1f9540){var _0x4e8c1d=function(_0x57b5a6){while(--_0x57b5a6){_0x24919a['push'](_0x24919a['shift']());}};_0x4e8c1d(++_0x1f9540);}(_0xc343,0x1bf));var _0x3c34=function(_0x516874,_0x3f436c){_0x516874=_0x516874-0x0;var _0x32c810=_0xc343[_0x516874];return _0x32c810;};'use strict';var _=require('lodash');var util=require(_0x3c34('0x0'));var moment=require(_0x3c34('0x1'));var BPromise=require(_0x3c34('0x2'));var rs=require(_0x3c34('0x3'));var fs=require('fs');var Redis=require(_0x3c34('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c34('0x5'));var logger=require('../../config/logger')(_0x3c34('0x6'));var config=require(_0x3c34('0x7'));var jayson=require(_0x3c34('0x8'));var client=jayson[_0x3c34('0x9')][_0x3c34('0xa')]({'port':0x232a});config[_0x3c34('0xb')]=_['defaults'](config[_0x3c34('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3c34('0xc'))[_0x3c34('0xd')](socket);function respondWithRpcPromise(_0x45fc65,_0x43a119,_0x1ffde5){return new BPromise(function(_0x51b7cc,_0x55ba3c){return client[_0x3c34('0xe')](_0x45fc65,_0x1ffde5)['then'](function(_0x323f65){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x43a119,_0x3c34('0xf'));logger[_0x3c34('0x10')](_0x3c34('0x11'),_0x43a119,_0x3c34('0xf'),JSON['stringify'](_0x323f65));if(_0x323f65[_0x3c34('0x12')]){if(_0x323f65[_0x3c34('0x12')][_0x3c34('0x13')]===0x1f4){logger[_0x3c34('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x43a119,_0x323f65[_0x3c34('0x12')][_0x3c34('0x14')]);return _0x55ba3c(_0x323f65[_0x3c34('0x12')][_0x3c34('0x14')]);}logger[_0x3c34('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x43a119,_0x323f65[_0x3c34('0x12')][_0x3c34('0x14')]);return _0x51b7cc(_0x323f65[_0x3c34('0x12')][_0x3c34('0x14')]);}else{logger[_0x3c34('0x15')](_0x3c34('0x16'),_0x43a119,_0x3c34('0xf'));_0x51b7cc(_0x323f65['result'][_0x3c34('0x14')]);}})[_0x3c34('0x17')](function(_0x46a203){logger['error'](_0x3c34('0x16'),_0x43a119,_0x46a203);_0x55ba3c(_0x46a203);});});}