Built motion from commit (unavailable).|2.5.31
[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 _0x1f49=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result'];(function(_0x33b82a,_0xf0ca57){var _0x443762=function(_0x7b7b0a){while(--_0x7b7b0a){_0x33b82a['push'](_0x33b82a['shift']());}};_0x443762(++_0xf0ca57);}(_0x1f49,0xa3));var _0x91f4=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x1f49[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x91f4('0x0'));var util=require(_0x91f4('0x1'));var moment=require(_0x91f4('0x2'));var BPromise=require(_0x91f4('0x3'));var rs=require(_0x91f4('0x4'));var fs=require('fs');var Redis=require(_0x91f4('0x5'));var db=require(_0x91f4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x91f4('0x7'))(_0x91f4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x91f4('0x9')]['http']({'port':0x232a});config['redis']=_[_0x91f4('0xa')](config[_0x91f4('0xb')],{'host':_0x91f4('0xc'),'port':0x18eb});var socket=require(_0x91f4('0xd'))(new Redis(config[_0x91f4('0xb')]));require(_0x91f4('0xe'))[_0x91f4('0xf')](socket);function respondWithRpcPromise(_0x396398,_0xd9b59d,_0x4a38ce){return new BPromise(function(_0x240898,_0x467886){return client[_0x91f4('0x10')](_0x396398,_0x4a38ce)['then'](function(_0x1210b2){logger[_0x91f4('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0xd9b59d,_0x91f4('0x12'));logger[_0x91f4('0x13')](_0x91f4('0x14'),_0xd9b59d,_0x91f4('0x12'),JSON['stringify'](_0x1210b2));if(_0x1210b2[_0x91f4('0x15')]){if(_0x1210b2[_0x91f4('0x15')][_0x91f4('0x16')]===0x1f4){logger[_0x91f4('0x15')](_0x91f4('0x17'),_0xd9b59d,_0x1210b2[_0x91f4('0x15')][_0x91f4('0x18')]);return _0x467886(_0x1210b2[_0x91f4('0x15')][_0x91f4('0x18')]);}logger[_0x91f4('0x15')](_0x91f4('0x17'),_0xd9b59d,_0x1210b2['error']['message']);return _0x240898(_0x1210b2[_0x91f4('0x15')]['message']);}else{logger[_0x91f4('0x11')](_0x91f4('0x17'),_0xd9b59d,'request\x20sent');_0x240898(_0x1210b2[_0x91f4('0x19')][_0x91f4('0x18')]);}})[_0x91f4('0x1a')](function(_0x2c3311){logger[_0x91f4('0x15')](_0x91f4('0x17'),_0xd9b59d,_0x2c3311);_0x467886(_0x2c3311);});});}