Built motion from commit e6806ed6.|2.6.0
[motion2.git] / server / api / chatWebsite / chatWebsite.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 _0xdbcb=['then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request'];(function(_0x148688,_0x1991c2){var _0x34f590=function(_0x314414){while(--_0x314414){_0x148688['push'](_0x148688['shift']());}};_0x34f590(++_0x1991c2);}(_0xdbcb,0x99));var _0xbdbc=function(_0x1d2520,_0x105606){_0x1d2520=_0x1d2520-0x0;var _0x22fd54=_0xdbcb[_0x1d2520];return _0x22fd54;};'use strict';var _=require(_0xbdbc('0x0'));var util=require(_0xbdbc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbdbc('0x2'));var fs=require('fs');var Redis=require(_0xbdbc('0x3'));var db=require(_0xbdbc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbdbc('0x5'));var config=require(_0xbdbc('0x6'));var jayson=require(_0xbdbc('0x7'));var client=jayson['client'][_0xbdbc('0x8')]({'port':0x232a});config[_0xbdbc('0x9')]=_[_0xbdbc('0xa')](config['redis'],{'host':_0xbdbc('0xb'),'port':0x18eb});var socket=require(_0xbdbc('0xc'))(new Redis(config[_0xbdbc('0x9')]));require(_0xbdbc('0xd'))['register'](socket);function respondWithRpcPromise(_0x1fe8df,_0x1b930d,_0x56cea2){return new BPromise(function(_0xc3ad82,_0x5ce6b8){return client[_0xbdbc('0xe')](_0x1fe8df,_0x56cea2)[_0xbdbc('0xf')](function(_0x52857a){logger[_0xbdbc('0x10')](_0xbdbc('0x11'),_0x1b930d,_0xbdbc('0x12'));logger[_0xbdbc('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1b930d,_0xbdbc('0x12'),JSON['stringify'](_0x52857a));if(_0x52857a[_0xbdbc('0x14')]){if(_0x52857a['error'][_0xbdbc('0x15')]===0x1f4){logger['error'](_0xbdbc('0x11'),_0x1b930d,_0x52857a['error'][_0xbdbc('0x16')]);return _0x5ce6b8(_0x52857a[_0xbdbc('0x14')][_0xbdbc('0x16')]);}logger[_0xbdbc('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1b930d,_0x52857a[_0xbdbc('0x14')][_0xbdbc('0x16')]);return _0xc3ad82(_0x52857a[_0xbdbc('0x14')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1b930d,_0xbdbc('0x12'));_0xc3ad82(_0x52857a[_0xbdbc('0x17')][_0xbdbc('0x16')]);}})['catch'](function(_0x975c98){logger[_0xbdbc('0x14')](_0xbdbc('0x11'),_0x1b930d,_0x975c98);_0x5ce6b8(_0x975c98);});});}