bc54b228c3d30f9fa7ef4cd2c26f1e66c07e76e9
[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 _0x51c5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0xcf945a,_0x3eb2e2){var _0x35e3ff=function(_0x1ca251){while(--_0x1ca251){_0xcf945a['push'](_0xcf945a['shift']());}};_0x35e3ff(++_0x3eb2e2);}(_0x51c5,0x8f));var _0x551c=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x51c5[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var moment=require(_0x551c('0x2'));var BPromise=require(_0x551c('0x3'));var rs=require(_0x551c('0x4'));var fs=require('fs');var Redis=require(_0x551c('0x5'));var db=require(_0x551c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x551c('0x7'))(_0x551c('0x8'));var config=require(_0x551c('0x9'));var jayson=require(_0x551c('0xa'));var client=jayson[_0x551c('0xb')][_0x551c('0xc')]({'port':0x232a});config[_0x551c('0xd')]=_[_0x551c('0xe')](config['redis'],{'host':_0x551c('0xf'),'port':0x18eb});var socket=require(_0x551c('0x10'))(new Redis(config[_0x551c('0xd')]));require('./openchannelAccount.socket')[_0x551c('0x11')](socket);function respondWithRpcPromise(_0x5c0257,_0x5682ef,_0x5ed459){return new BPromise(function(_0x1a92a3,_0x5cad27){return client[_0x551c('0x12')](_0x5c0257,_0x5ed459)[_0x551c('0x13')](function(_0xe61359){logger[_0x551c('0x14')](_0x551c('0x15'),_0x5682ef,_0x551c('0x16'));logger['debug'](_0x551c('0x17'),_0x5682ef,_0x551c('0x16'),JSON[_0x551c('0x18')](_0xe61359));if(_0xe61359['error']){if(_0xe61359[_0x551c('0x19')][_0x551c('0x1a')]===0x1f4){logger['error'](_0x551c('0x15'),_0x5682ef,_0xe61359['error'][_0x551c('0x1b')]);return _0x5cad27(_0xe61359[_0x551c('0x19')][_0x551c('0x1b')]);}logger[_0x551c('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x5682ef,_0xe61359['error'][_0x551c('0x1b')]);return _0x1a92a3(_0xe61359[_0x551c('0x19')]['message']);}else{logger[_0x551c('0x14')](_0x551c('0x15'),_0x5682ef,_0x551c('0x16'));_0x1a92a3(_0xe61359[_0x551c('0x1c')]['message']);}})['catch'](function(_0x491fec){logger[_0x551c('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x5682ef,_0x491fec);_0x5cad27(_0x491fec);});});}