ddd6cbaa14afe5accbfa5eb4003c2d9ccdc3279a
[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 _0xd87e=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0xaef4f3,_0x22f84c){var _0xb0c977=function(_0x5ed710){while(--_0x5ed710){_0xaef4f3['push'](_0xaef4f3['shift']());}};_0xb0c977(++_0x22f84c);}(_0xd87e,0x1bf));var _0xed87=function(_0x18e0d1,_0xbca4cb){_0x18e0d1=_0x18e0d1-0x0;var _0x58db41=_0xd87e[_0x18e0d1];return _0x58db41;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});config['redis']=_[_0xed87('0x9')](config[_0xed87('0xa')],{'host':_0xed87('0xb'),'port':0x18eb});var socket=require(_0xed87('0xc'))(new Redis(config['redis']));require(_0xed87('0xd'))[_0xed87('0xe')](socket);function respondWithRpcPromise(_0x21d399,_0x3c9a3c,_0x1eeadf){return new BPromise(function(_0x1f1150,_0x293db4){return client['request'](_0x21d399,_0x1eeadf)[_0xed87('0xf')](function(_0xf104cb){logger['info'](_0xed87('0x10'),_0x3c9a3c,_0xed87('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3c9a3c,_0xed87('0x11'),JSON[_0xed87('0x12')](_0xf104cb));if(_0xf104cb[_0xed87('0x13')]){if(_0xf104cb[_0xed87('0x13')][_0xed87('0x14')]===0x1f4){logger[_0xed87('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c9a3c,_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);return _0x293db4(_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);}logger[_0xed87('0x13')](_0xed87('0x10'),_0x3c9a3c,_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);return _0x1f1150(_0xf104cb[_0xed87('0x13')]['message']);}else{logger[_0xed87('0x16')](_0xed87('0x10'),_0x3c9a3c,_0xed87('0x11'));_0x1f1150(_0xf104cb[_0xed87('0x17')]['message']);}})[_0xed87('0x18')](function(_0x473f00){logger[_0xed87('0x13')](_0xed87('0x10'),_0x3c9a3c,_0x473f00);_0x293db4(_0x473f00);});});}