40cdb073235e3e04d993d4fd1f1c3aebca327d92
[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 _0x7d98=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x9b0e6a,_0x588ad3){var _0x1f9803=function(_0x132fcd){while(--_0x132fcd){_0x9b0e6a['push'](_0x9b0e6a['shift']());}};_0x1f9803(++_0x588ad3);}(_0x7d98,0xe7));var _0x87d9=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x7d98[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var moment=require(_0x87d9('0x1'));var BPromise=require(_0x87d9('0x2'));var rs=require(_0x87d9('0x3'));var fs=require('fs');var Redis=require(_0x87d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87d9('0x5'));var logger=require(_0x87d9('0x6'))('rpc');var config=require(_0x87d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x87d9('0x8')]=_[_0x87d9('0x9')](config[_0x87d9('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x87d9('0xa'))(new Redis(config[_0x87d9('0x8')]));require(_0x87d9('0xb'))['register'](socket);function respondWithRpcPromise(_0x22bc16,_0x469cff,_0x467a1b){return new BPromise(function(_0x3657ba,_0x10b32f){return client[_0x87d9('0xc')](_0x22bc16,_0x467a1b)[_0x87d9('0xd')](function(_0x4143f5){logger[_0x87d9('0xe')](_0x87d9('0xf'),_0x469cff,_0x87d9('0x10'));logger[_0x87d9('0x11')](_0x87d9('0x12'),_0x469cff,_0x87d9('0x10'),JSON[_0x87d9('0x13')](_0x4143f5));if(_0x4143f5[_0x87d9('0x14')]){if(_0x4143f5[_0x87d9('0x14')][_0x87d9('0x15')]===0x1f4){logger[_0x87d9('0x14')](_0x87d9('0xf'),_0x469cff,_0x4143f5['error']['message']);return _0x10b32f(_0x4143f5[_0x87d9('0x14')][_0x87d9('0x16')]);}logger[_0x87d9('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x469cff,_0x4143f5['error'][_0x87d9('0x16')]);return _0x3657ba(_0x4143f5[_0x87d9('0x14')][_0x87d9('0x16')]);}else{logger[_0x87d9('0xe')](_0x87d9('0xf'),_0x469cff,_0x87d9('0x10'));_0x3657ba(_0x4143f5[_0x87d9('0x17')][_0x87d9('0x16')]);}})[_0x87d9('0x18')](function(_0x6965d7){logger[_0x87d9('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x469cff,_0x6965d7);_0x10b32f(_0x6965d7);});});}