Built motion from commit fe909640.|2.6.8
[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 _0x4bf0=['jayson/promise','client','http','defaults','redis','localhost','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e6e99,_0xd3bb5f){var _0x6b6ca8=function(_0xa29245){while(--_0xa29245){_0x1e6e99['push'](_0x1e6e99['shift']());}};_0x6b6ca8(++_0xd3bb5f);}(_0x4bf0,0xaa));var _0x04bf=function(_0x22d262,_0x1ec922){_0x22d262=_0x22d262-0x0;var _0x440ce5=_0x4bf0[_0x22d262];return _0x440ce5;};'use strict';var _=require(_0x04bf('0x0'));var util=require(_0x04bf('0x1'));var moment=require('moment');var BPromise=require(_0x04bf('0x2'));var rs=require(_0x04bf('0x3'));var fs=require('fs');var Redis=require(_0x04bf('0x4'));var db=require(_0x04bf('0x5'))['db'];var utils=require(_0x04bf('0x6'));var logger=require(_0x04bf('0x7'))(_0x04bf('0x8'));var config=require(_0x04bf('0x9'));var jayson=require(_0x04bf('0xa'));var client=jayson[_0x04bf('0xb')][_0x04bf('0xc')]({'port':0x232a});config['redis']=_[_0x04bf('0xd')](config[_0x04bf('0xe')],{'host':_0x04bf('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x04bf('0x10')](socket);function respondWithRpcPromise(_0x3bd5cb,_0x5eb692,_0x2d82ca){return new BPromise(function(_0x3f3fe6,_0x154be5){return client[_0x04bf('0x11')](_0x3bd5cb,_0x2d82ca)[_0x04bf('0x12')](function(_0x29b612){logger[_0x04bf('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x5eb692,_0x04bf('0x14'));logger[_0x04bf('0x15')](_0x04bf('0x16'),_0x5eb692,_0x04bf('0x14'),JSON[_0x04bf('0x17')](_0x29b612));if(_0x29b612['error']){if(_0x29b612['error'][_0x04bf('0x18')]===0x1f4){logger[_0x04bf('0x19')](_0x04bf('0x1a'),_0x5eb692,_0x29b612['error'][_0x04bf('0x1b')]);return _0x154be5(_0x29b612['error'][_0x04bf('0x1b')]);}logger[_0x04bf('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x5eb692,_0x29b612['error'][_0x04bf('0x1b')]);return _0x3f3fe6(_0x29b612[_0x04bf('0x19')]['message']);}else{logger[_0x04bf('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x5eb692,_0x04bf('0x14'));_0x3f3fe6(_0x29b612[_0x04bf('0x1c')][_0x04bf('0x1b')]);}})[_0x04bf('0x1d')](function(_0xb3a302){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5eb692,_0xb3a302);_0x154be5(_0xb3a302);});});}