0128bb2d780ac0a6ca61b6147431b74fb83247ea
[motion2.git] / server / api / openchannelAccount / openchannelAccount.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 _0xc784=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc784,0x156));var _0x4c78=function(_0x2851ce,_0x16ba11){_0x2851ce=_0x2851ce-0x0;var _0x4160d9=_0xc784[_0x2851ce];return _0x4160d9;};'use strict';var _=require(_0x4c78('0x0'));var util=require(_0x4c78('0x1'));var moment=require(_0x4c78('0x2'));var BPromise=require(_0x4c78('0x3'));var rs=require(_0x4c78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c78('0x6'))(_0x4c78('0x7'));var config=require(_0x4c78('0x8'));var jayson=require(_0x4c78('0x9'));var client=jayson['client'][_0x4c78('0xa')]({'port':0x232a});config[_0x4c78('0xb')]=_['defaults'](config[_0x4c78('0xb')],{'host':_0x4c78('0xc'),'port':0x18eb});var socket=require(_0x4c78('0xd'))(new Redis(config[_0x4c78('0xb')]));require(_0x4c78('0xe'))[_0x4c78('0xf')](socket);function respondWithRpcPromise(_0x45b8ea,_0x44e155,_0x237e6e){return new BPromise(function(_0x4aba28,_0x5e3866){return client[_0x4c78('0x10')](_0x45b8ea,_0x237e6e)[_0x4c78('0x11')](function(_0x14d3bf){logger[_0x4c78('0x12')](_0x4c78('0x13'),_0x44e155,'request\x20sent');logger[_0x4c78('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x44e155,_0x4c78('0x15'),JSON[_0x4c78('0x16')](_0x14d3bf));if(_0x14d3bf[_0x4c78('0x17')]){if(_0x14d3bf[_0x4c78('0x17')]['code']===0x1f4){logger[_0x4c78('0x17')](_0x4c78('0x13'),_0x44e155,_0x14d3bf[_0x4c78('0x17')][_0x4c78('0x18')]);return _0x5e3866(_0x14d3bf[_0x4c78('0x17')][_0x4c78('0x18')]);}logger['error'](_0x4c78('0x13'),_0x44e155,_0x14d3bf[_0x4c78('0x17')]['message']);return _0x4aba28(_0x14d3bf[_0x4c78('0x17')][_0x4c78('0x18')]);}else{logger[_0x4c78('0x12')](_0x4c78('0x13'),_0x44e155,'request\x20sent');_0x4aba28(_0x14d3bf[_0x4c78('0x19')][_0x4c78('0x18')]);}})['catch'](function(_0x309d7e){logger[_0x4c78('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x44e155,_0x309d7e);_0x5e3866(_0x309d7e);});});}