Built motion from commit (unavailable).|2.4.20
[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 _0x7782=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x55f768,_0x235d1b){var _0x57456c=function(_0xc4685b){while(--_0xc4685b){_0x55f768['push'](_0x55f768['shift']());}};_0x57456c(++_0x235d1b);}(_0x7782,0x7f));var _0x2778=function(_0x4eb273,_0x184b36){_0x4eb273=_0x4eb273-0x0;var _0x303d40=_0x7782[_0x4eb273];return _0x303d40;};'use strict';var _=require(_0x2778('0x0'));var util=require(_0x2778('0x1'));var moment=require(_0x2778('0x2'));var BPromise=require(_0x2778('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2778('0x4'));var db=require(_0x2778('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2778('0x6'))(_0x2778('0x7'));var config=require(_0x2778('0x8'));var jayson=require(_0x2778('0x9'));var client=jayson[_0x2778('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c59b9,_0x399304,_0x53ce76){return new BPromise(function(_0x2c94ec,_0x1849c9){return client['request'](_0x5c59b9,_0x53ce76)[_0x2778('0xb')](function(_0x5439c1){logger[_0x2778('0xc')](_0x2778('0xd'),_0x399304,_0x2778('0xe'));logger[_0x2778('0xf')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x399304,_0x2778('0xe'),JSON[_0x2778('0x10')](_0x5439c1));if(_0x5439c1[_0x2778('0x11')]){if(_0x5439c1[_0x2778('0x11')]['code']===0x1f4){logger['error'](_0x2778('0xd'),_0x399304,_0x5439c1[_0x2778('0x11')][_0x2778('0x12')]);return _0x1849c9(_0x5439c1['error'][_0x2778('0x12')]);}logger[_0x2778('0x11')](_0x2778('0xd'),_0x399304,_0x5439c1[_0x2778('0x11')][_0x2778('0x12')]);return _0x2c94ec(_0x5439c1[_0x2778('0x11')][_0x2778('0x12')]);}else{logger[_0x2778('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x399304,'request\x20sent');_0x2c94ec(_0x5439c1[_0x2778('0x13')]['message']);}})[_0x2778('0x14')](function(_0x46566b){logger[_0x2778('0x11')](_0x2778('0xd'),_0x399304,_0x46566b);_0x1849c9(_0x46566b);});});}