3304b9b00abd67b691c86455fcbf5c0ae233f848
[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 _0x617a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','request\x20sent','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x330253,_0x4ade03){var _0xa6148=function(_0x2e1a4c){while(--_0x2e1a4c){_0x330253['push'](_0x330253['shift']());}};_0xa6148(++_0x4ade03);}(_0x617a,0xcc));var _0xa617=function(_0x55ba90,_0x3ab4bc){_0x55ba90=_0x55ba90-0x0;var _0x536129=_0x617a[_0x55ba90];return _0x536129;};'use strict';var _=require('lodash');var util=require(_0xa617('0x0'));var moment=require(_0xa617('0x1'));var BPromise=require(_0xa617('0x2'));var rs=require(_0xa617('0x3'));var fs=require('fs');var Redis=require(_0xa617('0x4'));var db=require(_0xa617('0x5'))['db'];var utils=require(_0xa617('0x6'));var logger=require(_0xa617('0x7'))(_0xa617('0x8'));var config=require(_0xa617('0x9'));var jayson=require(_0xa617('0xa'));var client=jayson[_0xa617('0xb')][_0xa617('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3abde6,_0x560b83,_0x5070ea){return new BPromise(function(_0x583311,_0x4c9c7f){return client['request'](_0x3abde6,_0x5070ea)['then'](function(_0x495744){logger[_0xa617('0xd')]('ChatApplication,\x20%s,\x20%s',_0x560b83,'request\x20sent');logger[_0xa617('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x560b83,_0xa617('0xf'),JSON[_0xa617('0x10')](_0x495744));if(_0x495744[_0xa617('0x11')]){if(_0x495744[_0xa617('0x11')][_0xa617('0x12')]===0x1f4){logger[_0xa617('0x11')](_0xa617('0x13'),_0x560b83,_0x495744[_0xa617('0x11')][_0xa617('0x14')]);return _0x4c9c7f(_0x495744['error'][_0xa617('0x14')]);}logger[_0xa617('0x11')](_0xa617('0x13'),_0x560b83,_0x495744[_0xa617('0x11')]['message']);return _0x583311(_0x495744[_0xa617('0x11')][_0xa617('0x14')]);}else{logger[_0xa617('0xd')](_0xa617('0x13'),_0x560b83,'request\x20sent');_0x583311(_0x495744[_0xa617('0x15')][_0xa617('0x14')]);}})[_0xa617('0x16')](function(_0x265134){logger[_0xa617('0x11')](_0xa617('0x13'),_0x560b83,_0x265134);_0x4c9c7f(_0x265134);});});}