1bdcdfb8f22c03d367e24559304f18c6a34e32c1
[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 _0x4996=['error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0x4996,0x1d3));var _0x6499=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x4996[_0x4314d7];return _0x5c599b;};'use strict';var _=require('lodash');var util=require(_0x6499('0x0'));var moment=require(_0x6499('0x1'));var BPromise=require('bluebird');var rs=require(_0x6499('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6499('0x3'))['db'];var utils=require(_0x6499('0x4'));var logger=require(_0x6499('0x5'))(_0x6499('0x6'));var config=require('../../config/environment');var jayson=require(_0x6499('0x7'));var client=jayson[_0x6499('0x8')][_0x6499('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db33e,_0x1df817,_0x49952b){return new BPromise(function(_0x333a18,_0x17ebfb){return client['request'](_0x5db33e,_0x49952b)[_0x6499('0xa')](function(_0x420577){logger[_0x6499('0xb')](_0x6499('0xc'),_0x1df817,_0x6499('0xd'));logger[_0x6499('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1df817,_0x6499('0xd'),JSON[_0x6499('0xf')](_0x420577));if(_0x420577[_0x6499('0x10')]){if(_0x420577[_0x6499('0x10')][_0x6499('0x11')]===0x1f4){logger[_0x6499('0x10')](_0x6499('0xc'),_0x1df817,_0x420577[_0x6499('0x10')][_0x6499('0x12')]);return _0x17ebfb(_0x420577[_0x6499('0x10')][_0x6499('0x12')]);}logger['error'](_0x6499('0xc'),_0x1df817,_0x420577[_0x6499('0x10')][_0x6499('0x12')]);return _0x333a18(_0x420577[_0x6499('0x10')][_0x6499('0x12')]);}else{logger['info'](_0x6499('0xc'),_0x1df817,_0x6499('0xd'));_0x333a18(_0x420577[_0x6499('0x13')][_0x6499('0x12')]);}})[_0x6499('0x14')](function(_0x93966){logger['error'](_0x6499('0xc'),_0x1df817,_0x93966);_0x17ebfb(_0x93966);});});}