Built motion from commit (unavailable).|2.4.21
[motion2.git] / server / api / cmCompany / cmCompany.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 _0x90a1=['error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0x90a1,0x143));var _0x190a=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x90a1[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0x190a('0x0'));var moment=require(_0x190a('0x1'));var BPromise=require(_0x190a('0x2'));var rs=require(_0x190a('0x3'));var fs=require('fs');var Redis=require(_0x190a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x190a('0x5'));var logger=require(_0x190a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x190a('0x7'));var client=jayson['client'][_0x190a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1015bd,_0x2d24a5,_0x527e80){return new BPromise(function(_0x63f3c,_0x4e4fae){return client['request'](_0x1015bd,_0x527e80)[_0x190a('0x9')](function(_0x3c86cd){logger[_0x190a('0xa')](_0x190a('0xb'),_0x2d24a5,_0x190a('0xc'));logger[_0x190a('0xd')](_0x190a('0xe'),_0x2d24a5,'request\x20sent',JSON[_0x190a('0xf')](_0x3c86cd));if(_0x3c86cd['error']){if(_0x3c86cd['error'][_0x190a('0x10')]===0x1f4){logger[_0x190a('0x11')](_0x190a('0xb'),_0x2d24a5,_0x3c86cd[_0x190a('0x11')][_0x190a('0x12')]);return _0x4e4fae(_0x3c86cd[_0x190a('0x11')]['message']);}logger['error'](_0x190a('0xb'),_0x2d24a5,_0x3c86cd['error']['message']);return _0x63f3c(_0x3c86cd[_0x190a('0x11')][_0x190a('0x12')]);}else{logger[_0x190a('0xa')]('CmCompany,\x20%s,\x20%s',_0x2d24a5,'request\x20sent');_0x63f3c(_0x3c86cd[_0x190a('0x13')][_0x190a('0x12')]);}})['catch'](function(_0x2407c0){logger[_0x190a('0x11')]('CmCompany,\x20%s,\x20%s',_0x2d24a5,_0x2407c0);_0x4e4fae(_0x2407c0);});});}