Built motion from commit d5e4af8c.|2.6.23
[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 _0x7be1=['../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x7be1,0x165));var _0x17be=function(_0x1fd450,_0x42cbf6){_0x1fd450=_0x1fd450-0x0;var _0x4cb0a5=_0x7be1[_0x1fd450];return _0x4cb0a5;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var moment=require(_0x17be('0x2'));var BPromise=require('bluebird');var rs=require(_0x17be('0x3'));var fs=require('fs');var Redis=require(_0x17be('0x4'));var db=require(_0x17be('0x5'))['db'];var utils=require(_0x17be('0x6'));var logger=require(_0x17be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17be('0x8')][_0x17be('0x9')]({'port':0x232a});config['redis']=_[_0x17be('0xa')](config[_0x17be('0xb')],{'host':_0x17be('0xc'),'port':0x18eb});var socket=require(_0x17be('0xd'))(new Redis(config[_0x17be('0xb')]));require(_0x17be('0xe'))['register'](socket);function respondWithRpcPromise(_0x41e383,_0x589cdb,_0x3d23c3){return new BPromise(function(_0x2c276e,_0x520a49){return client[_0x17be('0xf')](_0x41e383,_0x3d23c3)[_0x17be('0x10')](function(_0x1ee322){logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));logger['debug'](_0x17be('0x13'),_0x589cdb,'request\x20sent',JSON[_0x17be('0x14')](_0x1ee322));if(_0x1ee322[_0x17be('0x15')]){if(_0x1ee322[_0x17be('0x15')][_0x17be('0x16')]===0x1f4){logger[_0x17be('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x1ee322[_0x17be('0x15')]['message']);return _0x520a49(_0x1ee322['error'][_0x17be('0x17')]);}logger['error'](_0x17be('0x18'),_0x589cdb,_0x1ee322['error'][_0x17be('0x17')]);return _0x2c276e(_0x1ee322[_0x17be('0x15')]['message']);}else{logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));_0x2c276e(_0x1ee322['result'][_0x17be('0x17')]);}})[_0x17be('0x19')](function(_0x416f81){logger[_0x17be('0x15')](_0x17be('0x18'),_0x589cdb,_0x416f81);_0x520a49(_0x416f81);});});}