1295dcdd8875f5cabe4a334de772fd190ea78ff7
[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 _0x9fd8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result'];(function(_0x2a44ce,_0x476283){var _0x37b680=function(_0x5b9cd8){while(--_0x5b9cd8){_0x2a44ce['push'](_0x2a44ce['shift']());}};_0x37b680(++_0x476283);}(_0x9fd8,0x1b4));var _0x89fd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9fd8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x89fd('0x0'));var util=require(_0x89fd('0x1'));var moment=require(_0x89fd('0x2'));var BPromise=require(_0x89fd('0x3'));var rs=require(_0x89fd('0x4'));var fs=require('fs');var Redis=require(_0x89fd('0x5'));var db=require(_0x89fd('0x6'))['db'];var utils=require(_0x89fd('0x7'));var logger=require(_0x89fd('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x89fd('0x9'));var client=jayson['client'][_0x89fd('0xa')]({'port':0x232a});config[_0x89fd('0xb')]=_[_0x89fd('0xc')](config['redis'],{'host':_0x89fd('0xd'),'port':0x18eb});var socket=require(_0x89fd('0xe'))(new Redis(config['redis']));require(_0x89fd('0xf'))[_0x89fd('0x10')](socket);function respondWithRpcPromise(_0x5ab7ca,_0x57b395,_0x2ae6f3){return new BPromise(function(_0x31c92c,_0x7c16c0){return client[_0x89fd('0x11')](_0x5ab7ca,_0x2ae6f3)[_0x89fd('0x12')](function(_0x65a4b0){logger[_0x89fd('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x57b395,_0x89fd('0x14'));logger[_0x89fd('0x15')](_0x89fd('0x16'),_0x57b395,_0x89fd('0x14'),JSON[_0x89fd('0x17')](_0x65a4b0));if(_0x65a4b0[_0x89fd('0x18')]){if(_0x65a4b0['error']['code']===0x1f4){logger['error'](_0x89fd('0x19'),_0x57b395,_0x65a4b0['error'][_0x89fd('0x1a')]);return _0x7c16c0(_0x65a4b0['error'][_0x89fd('0x1a')]);}logger[_0x89fd('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x57b395,_0x65a4b0[_0x89fd('0x18')]['message']);return _0x31c92c(_0x65a4b0[_0x89fd('0x18')][_0x89fd('0x1a')]);}else{logger['info'](_0x89fd('0x19'),_0x57b395,_0x89fd('0x14'));_0x31c92c(_0x65a4b0[_0x89fd('0x1b')][_0x89fd('0x1a')]);}})[_0x89fd('0x1c')](function(_0x804267){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x57b395,_0x804267);_0x7c16c0(_0x804267);});});}