Built motion from commit e6806ed6.|2.6.0
[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 _0x2b65=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x2b65,0x131));var _0x52b6=function(_0x5bd5fc,_0x57597){_0x5bd5fc=_0x5bd5fc-0x0;var _0x420110=_0x2b65[_0x5bd5fc];return _0x420110;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});config[_0x52b6('0xd')]=_[_0x52b6('0xe')](config[_0x52b6('0xd')],{'host':_0x52b6('0xf'),'port':0x18eb});var socket=require(_0x52b6('0x10'))(new Redis(config['redis']));require(_0x52b6('0x11'))[_0x52b6('0x12')](socket);function respondWithRpcPromise(_0x18b34d,_0x4d6d94,_0x19d1d9){return new BPromise(function(_0x2bb857,_0x19f475){return client[_0x52b6('0x13')](_0x18b34d,_0x19d1d9)['then'](function(_0xf91209){logger[_0x52b6('0x14')](_0x52b6('0x15'),_0x4d6d94,'request\x20sent');logger[_0x52b6('0x16')](_0x52b6('0x17'),_0x4d6d94,'request\x20sent',JSON[_0x52b6('0x18')](_0xf91209));if(_0xf91209['error']){if(_0xf91209['error'][_0x52b6('0x19')]===0x1f4){logger[_0x52b6('0x1a')](_0x52b6('0x15'),_0x4d6d94,_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);return _0x19f475(_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);}logger[_0x52b6('0x1a')](_0x52b6('0x15'),_0x4d6d94,_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);return _0x2bb857(_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);}else{logger['info'](_0x52b6('0x15'),_0x4d6d94,_0x52b6('0x1c'));_0x2bb857(_0xf91209[_0x52b6('0x1d')]['message']);}})[_0x52b6('0x1e')](function(_0x184ee8){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4d6d94,_0x184ee8);_0x19f475(_0x184ee8);});});}