Built motion from commit 639a1a7f.|2.6.19
[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 _0x2e88=['error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x13d0e0,_0x2a661b){var _0x18deff=function(_0x396cd1){while(--_0x396cd1){_0x13d0e0['push'](_0x13d0e0['shift']());}};_0x18deff(++_0x2a661b);}(_0x2e88,0x6e));var _0x82e8=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x2e88[_0x65c50e];return _0x4573e7;};'use strict';var _=require(_0x82e8('0x0'));var util=require('util');var moment=require(_0x82e8('0x1'));var BPromise=require(_0x82e8('0x2'));var rs=require(_0x82e8('0x3'));var fs=require('fs');var Redis=require(_0x82e8('0x4'));var db=require(_0x82e8('0x5'))['db'];var utils=require(_0x82e8('0x6'));var logger=require('../../config/logger')(_0x82e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x82e8('0x8'));var client=jayson['client'][_0x82e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa76301,_0x16f39e,_0x4e4076){return new BPromise(function(_0x3310b7,_0x558128){return client[_0x82e8('0xa')](_0xa76301,_0x4e4076)[_0x82e8('0xb')](function(_0x5a1c88){logger['info'](_0x82e8('0xc'),_0x16f39e,_0x82e8('0xd'));logger['debug'](_0x82e8('0xe'),_0x16f39e,_0x82e8('0xd'),JSON[_0x82e8('0xf')](_0x5a1c88));if(_0x5a1c88[_0x82e8('0x10')]){if(_0x5a1c88[_0x82e8('0x10')][_0x82e8('0x11')]===0x1f4){logger[_0x82e8('0x10')]('CmCompany,\x20%s,\x20%s',_0x16f39e,_0x5a1c88['error'][_0x82e8('0x12')]);return _0x558128(_0x5a1c88[_0x82e8('0x10')][_0x82e8('0x12')]);}logger[_0x82e8('0x10')](_0x82e8('0xc'),_0x16f39e,_0x5a1c88[_0x82e8('0x10')][_0x82e8('0x12')]);return _0x3310b7(_0x5a1c88['error'][_0x82e8('0x12')]);}else{logger[_0x82e8('0x13')](_0x82e8('0xc'),_0x16f39e,_0x82e8('0xd'));_0x3310b7(_0x5a1c88['result']['message']);}})[_0x82e8('0x14')](function(_0x475741){logger[_0x82e8('0x10')]('CmCompany,\x20%s,\x20%s',_0x16f39e,_0x475741);_0x558128(_0x475741);});});}