Built motion from commit 994c64e1.|2.6.1
[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 _0x7f21=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','ChatApplication,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util'];(function(_0x5d6784,_0x5e5f0c){var _0x5f24c9=function(_0x51762d){while(--_0x51762d){_0x5d6784['push'](_0x5d6784['shift']());}};_0x5f24c9(++_0x5e5f0c);}(_0x7f21,0x1a8));var _0x17f2=function(_0x450723,_0x2ca58d){_0x450723=_0x450723-0x0;var _0x43e422=_0x7f21[_0x450723];return _0x43e422;};'use strict';var _=require('lodash');var util=require(_0x17f2('0x0'));var moment=require(_0x17f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x17f2('0x2'));var fs=require('fs');var Redis=require(_0x17f2('0x3'));var db=require(_0x17f2('0x4'))['db'];var utils=require(_0x17f2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x17f2('0x6'));var jayson=require(_0x17f2('0x7'));var client=jayson[_0x17f2('0x8')][_0x17f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x194532,_0x397a0c,_0x513d20){return new BPromise(function(_0x12a6c4,_0x2bab4b){return client['request'](_0x194532,_0x513d20)['then'](function(_0x4f9446){logger[_0x17f2('0xa')](_0x17f2('0xb'),_0x397a0c,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x397a0c,_0x17f2('0xc'),JSON['stringify'](_0x4f9446));if(_0x4f9446[_0x17f2('0xd')]){if(_0x4f9446[_0x17f2('0xd')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x397a0c,_0x4f9446[_0x17f2('0xd')][_0x17f2('0xe')]);return _0x2bab4b(_0x4f9446[_0x17f2('0xd')][_0x17f2('0xe')]);}logger[_0x17f2('0xd')](_0x17f2('0xb'),_0x397a0c,_0x4f9446[_0x17f2('0xd')][_0x17f2('0xe')]);return _0x12a6c4(_0x4f9446[_0x17f2('0xd')][_0x17f2('0xe')]);}else{logger['info'](_0x17f2('0xb'),_0x397a0c,'request\x20sent');_0x12a6c4(_0x4f9446[_0x17f2('0xf')][_0x17f2('0xe')]);}})[_0x17f2('0x10')](function(_0x391e1f){logger[_0x17f2('0xd')]('ChatApplication,\x20%s,\x20%s',_0x397a0c,_0x391e1f);_0x2bab4b(_0x391e1f);});});}