Built motion from commit 10af8726.|2.6.34
[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 _0x777d=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x112984,_0x2986bc){var _0x59eff4=function(_0x4492a7){while(--_0x4492a7){_0x112984['push'](_0x112984['shift']());}};_0x59eff4(++_0x2986bc);}(_0x777d,0xe9));var _0xd777=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x777d[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var moment=require(_0xd777('0x1'));var BPromise=require(_0xd777('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd777('0x3'));var db=require(_0xd777('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd777('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd777('0x6')]['http']({'port':0x232a});config[_0xd777('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd777('0x8'))(new Redis(config[_0xd777('0x7')]));require(_0xd777('0x9'))[_0xd777('0xa')](socket);function respondWithRpcPromise(_0x15b49e,_0x261e0d,_0x28fedc){return new BPromise(function(_0x234862,_0x45afb5){return client[_0xd777('0xb')](_0x15b49e,_0x28fedc)[_0xd777('0xc')](function(_0x22f2f1){logger[_0xd777('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x261e0d,'request\x20sent');logger[_0xd777('0xe')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x261e0d,_0xd777('0xf'),JSON[_0xd777('0x10')](_0x22f2f1));if(_0x22f2f1[_0xd777('0x11')]){if(_0x22f2f1[_0xd777('0x11')][_0xd777('0x12')]===0x1f4){logger['error'](_0xd777('0x13'),_0x261e0d,_0x22f2f1['error'][_0xd777('0x14')]);return _0x45afb5(_0x22f2f1[_0xd777('0x11')][_0xd777('0x14')]);}logger[_0xd777('0x11')](_0xd777('0x13'),_0x261e0d,_0x22f2f1['error'][_0xd777('0x14')]);return _0x234862(_0x22f2f1['error'][_0xd777('0x14')]);}else{logger['info'](_0xd777('0x13'),_0x261e0d,_0xd777('0xf'));_0x234862(_0x22f2f1[_0xd777('0x15')][_0xd777('0x14')]);}})[_0xd777('0x16')](function(_0x201175){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x261e0d,_0x201175);_0x45afb5(_0x201175);});});}