367cd53191702510f5b8934e58cca82ec4fed268
[motion2.git] / server / api / jscriptyProject / jscriptyProject.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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xac4a,0x13f));var _0xaac4=function(_0x5af5e6,_0x39f247){_0x5af5e6=_0x5af5e6-0x0;var _0x278e5d=_0xac4a[_0x5af5e6];return _0x278e5d;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});}