94960de49824b7d9470c8b83bdc3c32c0dbb7003
[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 _0x55cc=['../../config/logger','../../config/environment','http','request','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x51e3ff,_0x8bf3e9){var _0x2c44ee=function(_0x151e7c){while(--_0x151e7c){_0x51e3ff['push'](_0x51e3ff['shift']());}};_0x2c44ee(++_0x8bf3e9);}(_0x55cc,0x188));var _0xc55c=function(_0x4cfbd8,_0x407c81){_0x4cfbd8=_0x4cfbd8-0x0;var _0x46820f=_0x55cc[_0x4cfbd8];return _0x46820f;};'use strict';var _=require(_0xc55c('0x0'));var util=require(_0xc55c('0x1'));var moment=require(_0xc55c('0x2'));var BPromise=require(_0xc55c('0x3'));var rs=require(_0xc55c('0x4'));var fs=require('fs');var Redis=require(_0xc55c('0x5'));var db=require(_0xc55c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc55c('0x7'))('rpc');var config=require(_0xc55c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ee6e2,_0x278384,_0x2eb3c1){return new BPromise(function(_0x56302b,_0x2b8873){return client[_0xc55c('0xa')](_0x2ee6e2,_0x2eb3c1)['then'](function(_0x47a9a0){logger[_0xc55c('0xb')](_0xc55c('0xc'),_0x278384,'request\x20sent');logger[_0xc55c('0xd')](_0xc55c('0xe'),_0x278384,_0xc55c('0xf'),JSON[_0xc55c('0x10')](_0x47a9a0));if(_0x47a9a0['error']){if(_0x47a9a0[_0xc55c('0x11')][_0xc55c('0x12')]===0x1f4){logger[_0xc55c('0x11')](_0xc55c('0xc'),_0x278384,_0x47a9a0['error'][_0xc55c('0x13')]);return _0x2b8873(_0x47a9a0['error'][_0xc55c('0x13')]);}logger[_0xc55c('0x11')](_0xc55c('0xc'),_0x278384,_0x47a9a0[_0xc55c('0x11')][_0xc55c('0x13')]);return _0x56302b(_0x47a9a0['error'][_0xc55c('0x13')]);}else{logger[_0xc55c('0xb')](_0xc55c('0xc'),_0x278384,'request\x20sent');_0x56302b(_0x47a9a0['result'][_0xc55c('0x13')]);}})[_0xc55c('0x14')](function(_0x4f2076){logger[_0xc55c('0x11')](_0xc55c('0xc'),_0x278384,_0x4f2076);_0x2b8873(_0x4f2076);});});}