Built motion from commit (unavailable).|2.4.4
[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 _0x2601=['http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x88f957,_0x1d8435){var _0x22db08=function(_0x521488){while(--_0x521488){_0x88f957['push'](_0x88f957['shift']());}};_0x22db08(++_0x1d8435);}(_0x2601,0xfb));var _0x1260=function(_0x1f1ab5,_0x2bb52e){_0x1f1ab5=_0x1f1ab5-0x0;var _0x75fa19=_0x2601[_0x1f1ab5];return _0x75fa19;};'use strict';var _=require(_0x1260('0x0'));var util=require(_0x1260('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1260('0x2'));var fs=require('fs');var Redis=require(_0x1260('0x3'));var db=require(_0x1260('0x4'))['db'];var utils=require(_0x1260('0x5'));var logger=require(_0x1260('0x6'))('rpc');var config=require(_0x1260('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1260('0x8')][_0x1260('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e895d,_0x3fd50c,_0x27a98f){return new BPromise(function(_0x1ccbe6,_0xda0ec2){return client['request'](_0x5e895d,_0x27a98f)[_0x1260('0xa')](function(_0x99dabc){logger['info'](_0x1260('0xb'),_0x3fd50c,_0x1260('0xc'));logger[_0x1260('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3fd50c,_0x1260('0xc'),JSON['stringify'](_0x99dabc));if(_0x99dabc[_0x1260('0xe')]){if(_0x99dabc[_0x1260('0xe')][_0x1260('0xf')]===0x1f4){logger[_0x1260('0xe')](_0x1260('0xb'),_0x3fd50c,_0x99dabc['error']['message']);return _0xda0ec2(_0x99dabc[_0x1260('0xe')][_0x1260('0x10')]);}logger[_0x1260('0xe')](_0x1260('0xb'),_0x3fd50c,_0x99dabc[_0x1260('0xe')][_0x1260('0x10')]);return _0x1ccbe6(_0x99dabc[_0x1260('0xe')][_0x1260('0x10')]);}else{logger[_0x1260('0x11')](_0x1260('0xb'),_0x3fd50c,'request\x20sent');_0x1ccbe6(_0x99dabc[_0x1260('0x12')][_0x1260('0x10')]);}})[_0x1260('0x13')](function(_0x2b32f9){logger[_0x1260('0xe')]('ChatApplication,\x20%s,\x20%s',_0x3fd50c,_0x2b32f9);_0xda0ec2(_0x2b32f9);});});}