f4a3fd636cd5aebb584432809bc5cd1ce13f9a03
[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 _0x407f=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x619529,_0x1c3df8){var _0x144135=function(_0x4f0e40){while(--_0x4f0e40){_0x619529['push'](_0x619529['shift']());}};_0x144135(++_0x1c3df8);}(_0x407f,0xc2));var _0xf407=function(_0x496046,_0x6d5fd9){_0x496046=_0x496046-0x0;var _0x5f3e3b=_0x407f[_0x496046];return _0x5f3e3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf407('0x0'));var rs=require(_0xf407('0x1'));var fs=require('fs');var Redis=require(_0xf407('0x2'));var db=require(_0xf407('0x3'))['db'];var utils=require(_0xf407('0x4'));var logger=require(_0xf407('0x5'))(_0xf407('0x6'));var config=require(_0xf407('0x7'));var jayson=require(_0xf407('0x8'));var client=jayson[_0xf407('0x9')][_0xf407('0xa')]({'port':0x232a});config[_0xf407('0xb')]=_[_0xf407('0xc')](config[_0xf407('0xb')],{'host':_0xf407('0xd'),'port':0x18eb});var socket=require(_0xf407('0xe'))(new Redis(config['redis']));require(_0xf407('0xf'))[_0xf407('0x10')](socket);function respondWithRpcPromise(_0x436e03,_0x5af7b8,_0x4ff28e){return new BPromise(function(_0x4f4840,_0x5583fc){return client[_0xf407('0x11')](_0x436e03,_0x4ff28e)[_0xf407('0x12')](function(_0x31ac1b){logger[_0xf407('0x13')](_0xf407('0x14'),_0x5af7b8,'request\x20sent');logger[_0xf407('0x15')](_0xf407('0x16'),_0x5af7b8,_0xf407('0x17'),JSON[_0xf407('0x18')](_0x31ac1b));if(_0x31ac1b[_0xf407('0x19')]){if(_0x31ac1b[_0xf407('0x19')][_0xf407('0x1a')]===0x1f4){logger[_0xf407('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x5af7b8,_0x31ac1b['error'][_0xf407('0x1b')]);return _0x5583fc(_0x31ac1b['error'][_0xf407('0x1b')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5af7b8,_0x31ac1b[_0xf407('0x19')][_0xf407('0x1b')]);return _0x4f4840(_0x31ac1b[_0xf407('0x19')][_0xf407('0x1b')]);}else{logger[_0xf407('0x13')](_0xf407('0x14'),_0x5af7b8,_0xf407('0x17'));_0x4f4840(_0x31ac1b[_0xf407('0x1c')]['message']);}})[_0xf407('0x1d')](function(_0x1cd48f){logger[_0xf407('0x19')](_0xf407('0x14'),_0x5af7b8,_0x1cd48f);_0x5583fc(_0x1cd48f);});});}