Built motion from commit (unavailable).|2.5.30
[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 _0x0fff=['client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0x0fff,0x99));var _0xf0ff=function(_0x408bee,_0x2ec3da){_0x408bee=_0x408bee-0x0;var _0x5ea0=_0x0fff[_0x408bee];return _0x5ea0;};'use strict';var _=require('lodash');var util=require(_0xf0ff('0x0'));var moment=require(_0xf0ff('0x1'));var BPromise=require('bluebird');var rs=require(_0xf0ff('0x2'));var fs=require('fs');var Redis=require(_0xf0ff('0x3'));var db=require(_0xf0ff('0x4'))['db'];var utils=require(_0xf0ff('0x5'));var logger=require(_0xf0ff('0x6'))(_0xf0ff('0x7'));var config=require('../../config/environment');var jayson=require(_0xf0ff('0x8'));var client=jayson[_0xf0ff('0x9')][_0xf0ff('0xa')]({'port':0x232a});config[_0xf0ff('0xb')]=_['defaults'](config[_0xf0ff('0xb')],{'host':_0xf0ff('0xc'),'port':0x18eb});var socket=require(_0xf0ff('0xd'))(new Redis(config[_0xf0ff('0xb')]));require('./openchannelAccount.socket')[_0xf0ff('0xe')](socket);function respondWithRpcPromise(_0x330f3b,_0x3eff26,_0x193e52){return new BPromise(function(_0x37d2b9,_0x2cf167){return client[_0xf0ff('0xf')](_0x330f3b,_0x193e52)[_0xf0ff('0x10')](function(_0x197a69){logger[_0xf0ff('0x11')](_0xf0ff('0x12'),_0x3eff26,_0xf0ff('0x13'));logger[_0xf0ff('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3eff26,_0xf0ff('0x13'),JSON[_0xf0ff('0x15')](_0x197a69));if(_0x197a69[_0xf0ff('0x16')]){if(_0x197a69[_0xf0ff('0x16')][_0xf0ff('0x17')]===0x1f4){logger[_0xf0ff('0x16')](_0xf0ff('0x12'),_0x3eff26,_0x197a69[_0xf0ff('0x16')][_0xf0ff('0x18')]);return _0x2cf167(_0x197a69[_0xf0ff('0x16')][_0xf0ff('0x18')]);}logger['error'](_0xf0ff('0x12'),_0x3eff26,_0x197a69['error'][_0xf0ff('0x18')]);return _0x37d2b9(_0x197a69[_0xf0ff('0x16')]['message']);}else{logger['info'](_0xf0ff('0x12'),_0x3eff26,_0xf0ff('0x13'));_0x37d2b9(_0x197a69[_0xf0ff('0x19')][_0xf0ff('0x18')]);}})[_0xf0ff('0x1a')](function(_0x168d75){logger[_0xf0ff('0x16')](_0xf0ff('0x12'),_0x3eff26,_0x168d75);_0x2cf167(_0x168d75);});});}