c1d5a4f385db9b86ffc56bba3523425f82766c2f
[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 _0xf17e=['defaults','socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4d11c0,_0x291164){var _0x3050f7=function(_0x5ba769){while(--_0x5ba769){_0x4d11c0['push'](_0x4d11c0['shift']());}};_0x3050f7(++_0x291164);}(_0xf17e,0x9d));var _0xef17=function(_0x322721,_0x31cb2d){_0x322721=_0x322721-0x0;var _0x5e8c7a=_0xf17e[_0x322721];return _0x5e8c7a;};'use strict';var _=require(_0xef17('0x0'));var util=require(_0xef17('0x1'));var moment=require(_0xef17('0x2'));var BPromise=require(_0xef17('0x3'));var rs=require(_0xef17('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef17('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xef17('0x6'));var jayson=require(_0xef17('0x7'));var client=jayson[_0xef17('0x8')][_0xef17('0x9')]({'port':0x232a});config[_0xef17('0xa')]=_[_0xef17('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xef17('0xc'))(new Redis(config[_0xef17('0xa')]));require(_0xef17('0xd'))['register'](socket);function respondWithRpcPromise(_0x576663,_0x5d5c27,_0x25a6e6){return new BPromise(function(_0x59c1ae,_0x22274e){return client['request'](_0x576663,_0x25a6e6)[_0xef17('0xe')](function(_0x188291){logger[_0xef17('0xf')](_0xef17('0x10'),_0x5d5c27,_0xef17('0x11'));logger['debug'](_0xef17('0x12'),_0x5d5c27,_0xef17('0x11'),JSON[_0xef17('0x13')](_0x188291));if(_0x188291[_0xef17('0x14')]){if(_0x188291['error']['code']===0x1f4){logger[_0xef17('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d5c27,_0x188291['error'][_0xef17('0x15')]);return _0x22274e(_0x188291[_0xef17('0x14')]['message']);}logger[_0xef17('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d5c27,_0x188291['error']['message']);return _0x59c1ae(_0x188291['error']['message']);}else{logger['info'](_0xef17('0x10'),_0x5d5c27,_0xef17('0x11'));_0x59c1ae(_0x188291[_0xef17('0x16')]['message']);}})[_0xef17('0x17')](function(_0x3e467b){logger[_0xef17('0x14')](_0xef17('0x10'),_0x5d5c27,_0x3e467b);_0x22274e(_0x3e467b);});});}