Built motion from commit (unavailable).|2.5.4
[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 _0xc69c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x46688a,_0x52b8d4){var _0x4b7d58=function(_0x385c0b){while(--_0x385c0b){_0x46688a['push'](_0x46688a['shift']());}};_0x4b7d58(++_0x52b8d4);}(_0xc69c,0x190));var _0xcc69=function(_0x226e5b,_0x4935ed){_0x226e5b=_0x226e5b-0x0;var _0x3c44d3=_0xc69c[_0x226e5b];return _0x3c44d3;};'use strict';var _=require(_0xcc69('0x0'));var util=require(_0xcc69('0x1'));var moment=require(_0xcc69('0x2'));var BPromise=require(_0xcc69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc69('0x4'))['db'];var utils=require(_0xcc69('0x5'));var logger=require(_0xcc69('0x6'))(_0xcc69('0x7'));var config=require(_0xcc69('0x8'));var jayson=require(_0xcc69('0x9'));var client=jayson[_0xcc69('0xa')]['http']({'port':0x232a});config['redis']=_[_0xcc69('0xb')](config[_0xcc69('0xc')],{'host':_0xcc69('0xd'),'port':0x18eb});var socket=require(_0xcc69('0xe'))(new Redis(config['redis']));require(_0xcc69('0xf'))[_0xcc69('0x10')](socket);function respondWithRpcPromise(_0x265c26,_0x254e7e,_0x317048){return new BPromise(function(_0x452523,_0x21980b){return client['request'](_0x265c26,_0x317048)['then'](function(_0x27aeeb){logger[_0xcc69('0x11')](_0xcc69('0x12'),_0x254e7e,_0xcc69('0x13'));logger[_0xcc69('0x14')](_0xcc69('0x15'),_0x254e7e,_0xcc69('0x13'),JSON[_0xcc69('0x16')](_0x27aeeb));if(_0x27aeeb[_0xcc69('0x17')]){if(_0x27aeeb['error']['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x254e7e,_0x27aeeb['error'][_0xcc69('0x18')]);return _0x21980b(_0x27aeeb[_0xcc69('0x17')][_0xcc69('0x18')]);}logger[_0xcc69('0x17')](_0xcc69('0x12'),_0x254e7e,_0x27aeeb[_0xcc69('0x17')][_0xcc69('0x18')]);return _0x452523(_0x27aeeb[_0xcc69('0x17')]['message']);}else{logger[_0xcc69('0x11')](_0xcc69('0x12'),_0x254e7e,'request\x20sent');_0x452523(_0x27aeeb[_0xcc69('0x19')]['message']);}})[_0xcc69('0x1a')](function(_0x4dd351){logger[_0xcc69('0x17')](_0xcc69('0x12'),_0x254e7e,_0x4dd351);_0x21980b(_0x4dd351);});});}