Built motion from commit 26d08302.|2.6.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 _0xe130=['then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe130,0x127));var _0x0e13=function(_0x443dfb,_0x13ca6d){_0x443dfb=_0x443dfb-0x0;var _0x18e770=_0xe130[_0x443dfb];return _0x18e770;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});config[_0x0e13('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0e13('0xc'))(new Redis(config[_0x0e13('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2906e9,_0x124e0d,_0x3aad73){return new BPromise(function(_0x2e385d,_0x53f9a9){return client['request'](_0x2906e9,_0x3aad73)[_0x0e13('0xd')](function(_0x37a04e){logger[_0x0e13('0xe')](_0x0e13('0xf'),_0x124e0d,'request\x20sent');logger[_0x0e13('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x124e0d,_0x0e13('0x11'),JSON[_0x0e13('0x12')](_0x37a04e));if(_0x37a04e[_0x0e13('0x13')]){if(_0x37a04e[_0x0e13('0x13')][_0x0e13('0x14')]===0x1f4){logger[_0x0e13('0x13')](_0x0e13('0xf'),_0x124e0d,_0x37a04e[_0x0e13('0x13')][_0x0e13('0x15')]);return _0x53f9a9(_0x37a04e['error'][_0x0e13('0x15')]);}logger[_0x0e13('0x13')](_0x0e13('0xf'),_0x124e0d,_0x37a04e[_0x0e13('0x13')][_0x0e13('0x15')]);return _0x2e385d(_0x37a04e[_0x0e13('0x13')]['message']);}else{logger[_0x0e13('0xe')](_0x0e13('0xf'),_0x124e0d,'request\x20sent');_0x2e385d(_0x37a04e['result'][_0x0e13('0x15')]);}})['catch'](function(_0x2063ca){logger['error'](_0x0e13('0xf'),_0x124e0d,_0x2063ca);_0x53f9a9(_0x2063ca);});});}