Built motion from commit (unavailable).|2.5.15
[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 _0x1a37=['rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1dfc22,_0x229757){var _0x58881f=function(_0x188c41){while(--_0x188c41){_0x1dfc22['push'](_0x1dfc22['shift']());}};_0x58881f(++_0x229757);}(_0x1a37,0xb4));var _0x71a3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1a37[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});}