a01c068fc67a870fedf304e9719d4f2856c62a3b
[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 _0x8e74=['jayson/promise','client','request','info','JscriptyProject,\x20%s,\x20%s','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8e74,0x1de));var _0x48e7=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x8e74[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x48e7('0x0'));var util=require('util');var moment=require(_0x48e7('0x1'));var BPromise=require(_0x48e7('0x2'));var rs=require(_0x48e7('0x3'));var fs=require('fs');var Redis=require(_0x48e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x48e7('0x5'));var logger=require('../../config/logger')(_0x48e7('0x6'));var config=require(_0x48e7('0x7'));var jayson=require(_0x48e7('0x8'));var client=jayson[_0x48e7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546733,_0x5863d2,_0x3587a6){return new BPromise(function(_0x21e570,_0x5847fe){return client[_0x48e7('0xa')](_0x546733,_0x3587a6)['then'](function(_0x1417f5){logger[_0x48e7('0xb')](_0x48e7('0xc'),_0x5863d2,'request\x20sent');logger['debug'](_0x48e7('0xd'),_0x5863d2,'request\x20sent',JSON[_0x48e7('0xe')](_0x1417f5));if(_0x1417f5[_0x48e7('0xf')]){if(_0x1417f5[_0x48e7('0xf')]['code']===0x1f4){logger['error'](_0x48e7('0xc'),_0x5863d2,_0x1417f5[_0x48e7('0xf')][_0x48e7('0x10')]);return _0x5847fe(_0x1417f5[_0x48e7('0xf')][_0x48e7('0x10')]);}logger[_0x48e7('0xf')](_0x48e7('0xc'),_0x5863d2,_0x1417f5['error'][_0x48e7('0x10')]);return _0x21e570(_0x1417f5['error'][_0x48e7('0x10')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5863d2,_0x48e7('0x11'));_0x21e570(_0x1417f5['result'][_0x48e7('0x10')]);}})['catch'](function(_0x51f1a9){logger['error'](_0x48e7('0xc'),_0x5863d2,_0x51f1a9);_0x5847fe(_0x51f1a9);});});}