Built motion from commit (unavailable).|2.5.31
[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 _0x3493=['localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x3493,0x1d9));var _0x3349=function(_0x155abf,_0x3e4e85){_0x155abf=_0x155abf-0x0;var _0x1084dd=_0x3493[_0x155abf];return _0x1084dd;};'use strict';var _=require(_0x3349('0x0'));var util=require(_0x3349('0x1'));var moment=require(_0x3349('0x2'));var BPromise=require(_0x3349('0x3'));var rs=require(_0x3349('0x4'));var fs=require('fs');var Redis=require(_0x3349('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3349('0x6'))(_0x3349('0x7'));var config=require('../../config/environment');var jayson=require(_0x3349('0x8'));var client=jayson[_0x3349('0x9')][_0x3349('0xa')]({'port':0x232a});config[_0x3349('0xb')]=_[_0x3349('0xc')](config[_0x3349('0xb')],{'host':_0x3349('0xd'),'port':0x18eb});var socket=require(_0x3349('0xe'))(new Redis(config[_0x3349('0xb')]));require('./openchannelAccount.socket')[_0x3349('0xf')](socket);function respondWithRpcPromise(_0x2c3bc0,_0x3814e9,_0x231fa4){return new BPromise(function(_0x5254c1,_0x584315){return client[_0x3349('0x10')](_0x2c3bc0,_0x231fa4)[_0x3349('0x11')](function(_0x12b532){logger[_0x3349('0x12')](_0x3349('0x13'),_0x3814e9,_0x3349('0x14'));logger[_0x3349('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3814e9,_0x3349('0x14'),JSON[_0x3349('0x16')](_0x12b532));if(_0x12b532['error']){if(_0x12b532[_0x3349('0x17')][_0x3349('0x18')]===0x1f4){logger[_0x3349('0x17')](_0x3349('0x13'),_0x3814e9,_0x12b532['error']['message']);return _0x584315(_0x12b532['error']['message']);}logger['error'](_0x3349('0x13'),_0x3814e9,_0x12b532[_0x3349('0x17')][_0x3349('0x19')]);return _0x5254c1(_0x12b532[_0x3349('0x17')][_0x3349('0x19')]);}else{logger[_0x3349('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x3814e9,_0x3349('0x14'));_0x5254c1(_0x12b532[_0x3349('0x1a')][_0x3349('0x19')]);}})['catch'](function(_0x45cb2d){logger['error'](_0x3349('0x13'),_0x3814e9,_0x45cb2d);_0x584315(_0x45cb2d);});});}