Built motion from commit (unavailable).|2.5.30
[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 _0x7611=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x12d129,_0x7863e7){var _0x1da00d=function(_0x20be53){while(--_0x20be53){_0x12d129['push'](_0x12d129['shift']());}};_0x1da00d(++_0x7863e7);}(_0x7611,0x1c0));var _0x1761=function(_0x1cbce8,_0x26ae0b){_0x1cbce8=_0x1cbce8-0x0;var _0xb150c4=_0x7611[_0x1cbce8];return _0xb150c4;};'use strict';var _=require(_0x1761('0x0'));var util=require('util');var moment=require(_0x1761('0x1'));var BPromise=require(_0x1761('0x2'));var rs=require(_0x1761('0x3'));var fs=require('fs');var Redis=require(_0x1761('0x4'));var db=require(_0x1761('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1761('0x6'))(_0x1761('0x7'));var config=require(_0x1761('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1761('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45327d,_0x59f54b,_0x2ed773){return new BPromise(function(_0x2382c9,_0x4764d3){return client[_0x1761('0xa')](_0x45327d,_0x2ed773)[_0x1761('0xb')](function(_0x1ca5e9){logger[_0x1761('0xc')]('ChatApplication,\x20%s,\x20%s',_0x59f54b,_0x1761('0xd'));logger['debug'](_0x1761('0xe'),_0x59f54b,'request\x20sent',JSON[_0x1761('0xf')](_0x1ca5e9));if(_0x1ca5e9[_0x1761('0x10')]){if(_0x1ca5e9['error'][_0x1761('0x11')]===0x1f4){logger[_0x1761('0x10')]('ChatApplication,\x20%s,\x20%s',_0x59f54b,_0x1ca5e9[_0x1761('0x10')][_0x1761('0x12')]);return _0x4764d3(_0x1ca5e9[_0x1761('0x10')][_0x1761('0x12')]);}logger['error'](_0x1761('0x13'),_0x59f54b,_0x1ca5e9[_0x1761('0x10')][_0x1761('0x12')]);return _0x2382c9(_0x1ca5e9[_0x1761('0x10')][_0x1761('0x12')]);}else{logger['info'](_0x1761('0x13'),_0x59f54b,_0x1761('0xd'));_0x2382c9(_0x1ca5e9[_0x1761('0x14')][_0x1761('0x12')]);}})[_0x1761('0x15')](function(_0x2771ab){logger[_0x1761('0x10')](_0x1761('0x13'),_0x59f54b,_0x2771ab);_0x4764d3(_0x2771ab);});});}