f2113e2488e65bfed1d2e8e4b06857ccf2d37dfd
[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 _0x8d66=['then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request'];(function(_0x1e6fce,_0x260ee3){var _0x24a173=function(_0x1e0b84){while(--_0x1e0b84){_0x1e6fce['push'](_0x1e6fce['shift']());}};_0x24a173(++_0x260ee3);}(_0x8d66,0xa6));var _0x68d6=function(_0x42252b,_0x3d8290){_0x42252b=_0x42252b-0x0;var _0x25a6ba=_0x8d66[_0x42252b];return _0x25a6ba;};'use strict';var _=require(_0x68d6('0x0'));var util=require(_0x68d6('0x1'));var moment=require(_0x68d6('0x2'));var BPromise=require(_0x68d6('0x3'));var rs=require(_0x68d6('0x4'));var fs=require('fs');var Redis=require(_0x68d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x68d6('0x6'));var logger=require(_0x68d6('0x7'))(_0x68d6('0x8'));var config=require(_0x68d6('0x9'));var jayson=require(_0x68d6('0xa'));var client=jayson[_0x68d6('0xb')][_0x68d6('0xc')]({'port':0x232a});config[_0x68d6('0xd')]=_[_0x68d6('0xe')](config['redis'],{'host':_0x68d6('0xf'),'port':0x18eb});var socket=require(_0x68d6('0x10'))(new Redis(config['redis']));require(_0x68d6('0x11'))[_0x68d6('0x12')](socket);function respondWithRpcPromise(_0x1a9fc1,_0x4b6ed0,_0x460a67){return new BPromise(function(_0x3c5a95,_0x4665ca){return client[_0x68d6('0x13')](_0x1a9fc1,_0x460a67)[_0x68d6('0x14')](function(_0x3649ad){logger['info'](_0x68d6('0x15'),_0x4b6ed0,_0x68d6('0x16'));logger[_0x68d6('0x17')](_0x68d6('0x18'),_0x4b6ed0,'request\x20sent',JSON[_0x68d6('0x19')](_0x3649ad));if(_0x3649ad[_0x68d6('0x1a')]){if(_0x3649ad[_0x68d6('0x1a')][_0x68d6('0x1b')]===0x1f4){logger[_0x68d6('0x1a')](_0x68d6('0x15'),_0x4b6ed0,_0x3649ad[_0x68d6('0x1a')][_0x68d6('0x1c')]);return _0x4665ca(_0x3649ad['error']['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4b6ed0,_0x3649ad[_0x68d6('0x1a')][_0x68d6('0x1c')]);return _0x3c5a95(_0x3649ad[_0x68d6('0x1a')][_0x68d6('0x1c')]);}else{logger[_0x68d6('0x1d')](_0x68d6('0x15'),_0x4b6ed0,'request\x20sent');_0x3c5a95(_0x3649ad['result'][_0x68d6('0x1c')]);}})[_0x68d6('0x1e')](function(_0x12f590){logger[_0x68d6('0x1a')](_0x68d6('0x15'),_0x4b6ed0,_0x12f590);_0x4665ca(_0x12f590);});});}