Built motion from commit 19a84241.|2.5.34
[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 _0x1f86=['../../config/environment','jayson/promise','http','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','stringify','error','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x11b730,_0x1c15ed){var _0x8c8c63=function(_0x5c0a88){while(--_0x5c0a88){_0x11b730['push'](_0x11b730['shift']());}};_0x8c8c63(++_0x1c15ed);}(_0x1f86,0x13b));var _0x61f8=function(_0x12a7a1,_0x56c17c){_0x12a7a1=_0x12a7a1-0x0;var _0x3fffeb=_0x1f86[_0x12a7a1];return _0x3fffeb;};'use strict';var _=require(_0x61f8('0x0'));var util=require(_0x61f8('0x1'));var moment=require(_0x61f8('0x2'));var BPromise=require(_0x61f8('0x3'));var rs=require(_0x61f8('0x4'));var fs=require('fs');var Redis=require(_0x61f8('0x5'));var db=require(_0x61f8('0x6'))['db'];var utils=require(_0x61f8('0x7'));var logger=require(_0x61f8('0x8'))(_0x61f8('0x9'));var config=require(_0x61f8('0xa'));var jayson=require(_0x61f8('0xb'));var client=jayson['client'][_0x61f8('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x61f8('0xd'))(new Redis(config['redis']));require(_0x61f8('0xe'))[_0x61f8('0xf')](socket);function respondWithRpcPromise(_0x2aa74f,_0x31c07b,_0x26ece2){return new BPromise(function(_0x1fc225,_0x1ca1f8){return client[_0x61f8('0x10')](_0x2aa74f,_0x26ece2)[_0x61f8('0x11')](function(_0x37caf4){logger[_0x61f8('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x31c07b,_0x61f8('0x13'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x31c07b,_0x61f8('0x13'),JSON[_0x61f8('0x14')](_0x37caf4));if(_0x37caf4['error']){if(_0x37caf4['error']['code']===0x1f4){logger[_0x61f8('0x15')](_0x61f8('0x16'),_0x31c07b,_0x37caf4['error'][_0x61f8('0x17')]);return _0x1ca1f8(_0x37caf4[_0x61f8('0x15')][_0x61f8('0x17')]);}logger['error'](_0x61f8('0x16'),_0x31c07b,_0x37caf4[_0x61f8('0x15')][_0x61f8('0x17')]);return _0x1fc225(_0x37caf4[_0x61f8('0x15')][_0x61f8('0x17')]);}else{logger[_0x61f8('0x12')](_0x61f8('0x16'),_0x31c07b,_0x61f8('0x13'));_0x1fc225(_0x37caf4['result'][_0x61f8('0x17')]);}})[_0x61f8('0x18')](function(_0x340504){logger[_0x61f8('0x15')](_0x61f8('0x16'),_0x31c07b,_0x340504);_0x1ca1f8(_0x340504);});});}