3cb3b4d3d390f4984631aa1379c1d1fb1931c95c
[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 _0x94df=['register','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0x94df,0xa3));var _0xf94d=function(_0x2e56be,_0x4ee223){_0x2e56be=_0x2e56be-0x0;var _0x4cb795=_0x94df[_0x2e56be];return _0x4cb795;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});config[_0xf94d('0xd')]=_[_0xf94d('0xe')](config[_0xf94d('0xd')],{'host':_0xf94d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf94d('0xd')]));require(_0xf94d('0x10'))[_0xf94d('0x11')](socket);function respondWithRpcPromise(_0x1bde05,_0xdaa8d6,_0x45739c){return new BPromise(function(_0x47efc6,_0x25c68e){return client[_0xf94d('0x12')](_0x1bde05,_0x45739c)[_0xf94d('0x13')](function(_0x19b1de){logger[_0xf94d('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0xdaa8d6,'request\x20sent');logger[_0xf94d('0x15')](_0xf94d('0x16'),_0xdaa8d6,_0xf94d('0x17'),JSON[_0xf94d('0x18')](_0x19b1de));if(_0x19b1de[_0xf94d('0x19')]){if(_0x19b1de[_0xf94d('0x19')]['code']===0x1f4){logger[_0xf94d('0x19')](_0xf94d('0x1a'),_0xdaa8d6,_0x19b1de[_0xf94d('0x19')][_0xf94d('0x1b')]);return _0x25c68e(_0x19b1de[_0xf94d('0x19')][_0xf94d('0x1b')]);}logger[_0xf94d('0x19')](_0xf94d('0x1a'),_0xdaa8d6,_0x19b1de['error'][_0xf94d('0x1b')]);return _0x47efc6(_0x19b1de['error'][_0xf94d('0x1b')]);}else{logger['info'](_0xf94d('0x1a'),_0xdaa8d6,'request\x20sent');_0x47efc6(_0x19b1de[_0xf94d('0x1c')][_0xf94d('0x1b')]);}})[_0xf94d('0x1d')](function(_0x349de5){logger['error'](_0xf94d('0x1a'),_0xdaa8d6,_0x349de5);_0x25c68e(_0x349de5);});});}