fe9accc5b1e4c7bc8c57ad4b2aad0219fd07520e
[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 _0xdec7=['stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdec7,0x1c0));var _0x7dec=function(_0x41ea1f,_0x59f342){_0x41ea1f=_0x41ea1f-0x0;var _0x1132e7=_0xdec7[_0x41ea1f];return _0x1132e7;};'use strict';var _=require(_0x7dec('0x0'));var util=require('util');var moment=require(_0x7dec('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dec('0x2'));var fs=require('fs');var Redis=require(_0x7dec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7dec('0x4'))(_0x7dec('0x5'));var config=require(_0x7dec('0x6'));var jayson=require(_0x7dec('0x7'));var client=jayson[_0x7dec('0x8')][_0x7dec('0x9')]({'port':0x232a});config[_0x7dec('0xa')]=_[_0x7dec('0xb')](config[_0x7dec('0xa')],{'host':_0x7dec('0xc'),'port':0x18eb});var socket=require(_0x7dec('0xd'))(new Redis(config[_0x7dec('0xa')]));require(_0x7dec('0xe'))[_0x7dec('0xf')](socket);function respondWithRpcPromise(_0x33a323,_0x299513,_0x3610cb){return new BPromise(function(_0x3dc89f,_0x805a84){return client[_0x7dec('0x10')](_0x33a323,_0x3610cb)[_0x7dec('0x11')](function(_0xf69acc){logger[_0x7dec('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x299513,'request\x20sent');logger['debug'](_0x7dec('0x13'),_0x299513,'request\x20sent',JSON[_0x7dec('0x14')](_0xf69acc));if(_0xf69acc['error']){if(_0xf69acc['error']['code']===0x1f4){logger[_0x7dec('0x15')](_0x7dec('0x16'),_0x299513,_0xf69acc[_0x7dec('0x15')][_0x7dec('0x17')]);return _0x805a84(_0xf69acc['error'][_0x7dec('0x17')]);}logger[_0x7dec('0x15')](_0x7dec('0x16'),_0x299513,_0xf69acc[_0x7dec('0x15')][_0x7dec('0x17')]);return _0x3dc89f(_0xf69acc['error'][_0x7dec('0x17')]);}else{logger['info'](_0x7dec('0x16'),_0x299513,'request\x20sent');_0x3dc89f(_0xf69acc[_0x7dec('0x18')][_0x7dec('0x17')]);}})[_0x7dec('0x19')](function(_0x154f35){logger[_0x7dec('0x15')](_0x7dec('0x16'),_0x299513,_0x154f35);_0x805a84(_0x154f35);});});}