f59e0c07f13113f43b4a3be400669a943b118777
[motion2.git] / server / api / chatApplication / chatApplication.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 _0x24ef=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then'];(function(_0x17d23a,_0xd4fbc){var _0x23e756=function(_0xfbb322){while(--_0xfbb322){_0x17d23a['push'](_0x17d23a['shift']());}};_0x23e756(++_0xd4fbc);}(_0x24ef,0x1bd));var _0xf24e=function(_0x341d42,_0xabce20){_0x341d42=_0x341d42-0x0;var _0xecf46c=_0x24ef[_0x341d42];return _0xecf46c;};'use strict';var _=require(_0xf24e('0x0'));var util=require(_0xf24e('0x1'));var moment=require('moment');var BPromise=require(_0xf24e('0x2'));var rs=require(_0xf24e('0x3'));var fs=require('fs');var Redis=require(_0xf24e('0x4'));var db=require(_0xf24e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf24e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf24e('0x7')][_0xf24e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45d35c,_0x5ab5da,_0x2cc458){return new BPromise(function(_0x1f569a,_0x1eff07){return client[_0xf24e('0x9')](_0x45d35c,_0x2cc458)[_0xf24e('0xa')](function(_0x274e65){logger[_0xf24e('0xb')](_0xf24e('0xc'),_0x5ab5da,_0xf24e('0xd'));logger['debug'](_0xf24e('0xe'),_0x5ab5da,_0xf24e('0xd'),JSON['stringify'](_0x274e65));if(_0x274e65[_0xf24e('0xf')]){if(_0x274e65[_0xf24e('0xf')][_0xf24e('0x10')]===0x1f4){logger[_0xf24e('0xf')](_0xf24e('0xc'),_0x5ab5da,_0x274e65['error'][_0xf24e('0x11')]);return _0x1eff07(_0x274e65[_0xf24e('0xf')][_0xf24e('0x11')]);}logger[_0xf24e('0xf')](_0xf24e('0xc'),_0x5ab5da,_0x274e65[_0xf24e('0xf')][_0xf24e('0x11')]);return _0x1f569a(_0x274e65[_0xf24e('0xf')][_0xf24e('0x11')]);}else{logger[_0xf24e('0xb')](_0xf24e('0xc'),_0x5ab5da,_0xf24e('0xd'));_0x1f569a(_0x274e65[_0xf24e('0x12')][_0xf24e('0x11')]);}})['catch'](function(_0x1660c7){logger[_0xf24e('0xf')](_0xf24e('0xc'),_0x5ab5da,_0x1660c7);_0x1eff07(_0x1660c7);});});}