Built motion from commit 3c2ce842.|2.6.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 _0x13f6=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','redis','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x18a397,_0x4f7413){var _0x50a9b7=function(_0x124dfd){while(--_0x124dfd){_0x18a397['push'](_0x18a397['shift']());}};_0x50a9b7(++_0x4f7413);}(_0x13f6,0x124));var _0x613f=function(_0xc434e4,_0x470cae){_0xc434e4=_0xc434e4-0x0;var _0x21b400=_0x13f6[_0xc434e4];return _0x21b400;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x613f('0xa'))(new Redis(config[_0x613f('0xb')]));require(_0x613f('0xc'))[_0x613f('0xd')](socket);function respondWithRpcPromise(_0x4e98ce,_0x1a8dd0,_0x40d7f5){return new BPromise(function(_0xcd514c,_0x5210a0){return client[_0x613f('0xe')](_0x4e98ce,_0x40d7f5)[_0x613f('0xf')](function(_0x31875a){logger['info'](_0x613f('0x10'),_0x1a8dd0,_0x613f('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1a8dd0,'request\x20sent',JSON[_0x613f('0x12')](_0x31875a));if(_0x31875a[_0x613f('0x13')]){if(_0x31875a[_0x613f('0x13')][_0x613f('0x14')]===0x1f4){logger[_0x613f('0x13')](_0x613f('0x10'),_0x1a8dd0,_0x31875a[_0x613f('0x13')][_0x613f('0x15')]);return _0x5210a0(_0x31875a[_0x613f('0x13')][_0x613f('0x15')]);}logger['error'](_0x613f('0x10'),_0x1a8dd0,_0x31875a['error']['message']);return _0xcd514c(_0x31875a[_0x613f('0x13')][_0x613f('0x15')]);}else{logger['info'](_0x613f('0x10'),_0x1a8dd0,'request\x20sent');_0xcd514c(_0x31875a[_0x613f('0x16')][_0x613f('0x15')]);}})[_0x613f('0x17')](function(_0x2a47f4){logger[_0x613f('0x13')](_0x613f('0x10'),_0x1a8dd0,_0x2a47f4);_0x5210a0(_0x2a47f4);});});}