Built motion from commit e1760111.|2.6.18
[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 _0x5c00=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57f4f7,_0x5342c1){var _0x22c153=function(_0x147c52){while(--_0x147c52){_0x57f4f7['push'](_0x57f4f7['shift']());}};_0x22c153(++_0x5342c1);}(_0x5c00,0x17e));var _0x05c0=function(_0x1254c8,_0x34e836){_0x1254c8=_0x1254c8-0x0;var _0x4c2496=_0x5c00[_0x1254c8];return _0x4c2496;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});config[_0x05c0('0xb')]=_['defaults'](config[_0x05c0('0xb')],{'host':_0x05c0('0xc'),'port':0x18eb});var socket=require(_0x05c0('0xd'))(new Redis(config['redis']));require(_0x05c0('0xe'))[_0x05c0('0xf')](socket);function respondWithRpcPromise(_0x996d6b,_0x321c09,_0x273b2d){return new BPromise(function(_0x1edbb,_0x5226c5){return client['request'](_0x996d6b,_0x273b2d)[_0x05c0('0x10')](function(_0x516a66){logger[_0x05c0('0x11')](_0x05c0('0x12'),_0x321c09,_0x05c0('0x13'));logger['debug'](_0x05c0('0x14'),_0x321c09,'request\x20sent',JSON[_0x05c0('0x15')](_0x516a66));if(_0x516a66[_0x05c0('0x16')]){if(_0x516a66[_0x05c0('0x16')][_0x05c0('0x17')]===0x1f4){logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);return _0x5226c5(_0x516a66['error'][_0x05c0('0x18')]);}logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);return _0x1edbb(_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);}else{logger[_0x05c0('0x11')](_0x05c0('0x12'),_0x321c09,'request\x20sent');_0x1edbb(_0x516a66[_0x05c0('0x19')][_0x05c0('0x18')]);}})[_0x05c0('0x1a')](function(_0x54fef0){logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x54fef0);_0x5226c5(_0x54fef0);});});}