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 _0xdf2e=['catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdf2e,0x146));var _0xedf2=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0xdf2e[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0xedf2('0x0'));var util=require('util');var moment=require(_0xedf2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedf2('0x2'));var db=require(_0xedf2('0x3'))['db'];var utils=require(_0xedf2('0x4'));var logger=require(_0xedf2('0x5'))(_0xedf2('0x6'));var config=require(_0xedf2('0x7'));var jayson=require(_0xedf2('0x8'));var client=jayson['client'][_0xedf2('0x9')]({'port':0x232a});config[_0xedf2('0xa')]=_[_0xedf2('0xb')](config[_0xedf2('0xa')],{'host':_0xedf2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedf2('0xa')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4ebcad,_0x4252c3,_0x3ec3da){return new BPromise(function(_0x5fb36f,_0x36b183){return client[_0xedf2('0xd')](_0x4ebcad,_0x3ec3da)[_0xedf2('0xe')](function(_0x552563){logger[_0xedf2('0xf')](_0xedf2('0x10'),_0x4252c3,_0xedf2('0x11'));logger['debug'](_0xedf2('0x12'),_0x4252c3,_0xedf2('0x11'),JSON[_0xedf2('0x13')](_0x552563));if(_0x552563[_0xedf2('0x14')]){if(_0x552563[_0xedf2('0x14')][_0xedf2('0x15')]===0x1f4){logger[_0xedf2('0x14')](_0xedf2('0x10'),_0x4252c3,_0x552563['error'][_0xedf2('0x16')]);return _0x36b183(_0x552563[_0xedf2('0x14')][_0xedf2('0x16')]);}logger[_0xedf2('0x14')](_0xedf2('0x10'),_0x4252c3,_0x552563[_0xedf2('0x14')][_0xedf2('0x16')]);return _0x5fb36f(_0x552563[_0xedf2('0x14')][_0xedf2('0x16')]);}else{logger[_0xedf2('0xf')](_0xedf2('0x10'),_0x4252c3,_0xedf2('0x11'));_0x5fb36f(_0x552563[_0xedf2('0x17')][_0xedf2('0x16')]);}})[_0xedf2('0x18')](function(_0x46c5ce){logger[_0xedf2('0x14')](_0xedf2('0x10'),_0x4252c3,_0x46c5ce);_0x36b183(_0x46c5ce);});});}