Built motion from commit (unavailable).|2.5.15
[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 _0x3ad7=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x3b11a2,_0x44a644){var _0x592fd4=function(_0xbd108e){while(--_0xbd108e){_0x3b11a2['push'](_0x3b11a2['shift']());}};_0x592fd4(++_0x44a644);}(_0x3ad7,0x1af));var _0x73ad=function(_0x46b1b8,_0x4c310b){_0x46b1b8=_0x46b1b8-0x0;var _0x583b24=_0x3ad7[_0x46b1b8];return _0x583b24;};'use strict';var _=require(_0x73ad('0x0'));var util=require(_0x73ad('0x1'));var moment=require('moment');var BPromise=require(_0x73ad('0x2'));var rs=require(_0x73ad('0x3'));var fs=require('fs');var Redis=require(_0x73ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x73ad('0x5'));var logger=require(_0x73ad('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x73ad('0x7'));var client=jayson[_0x73ad('0x8')][_0x73ad('0x9')]({'port':0x232a});config['redis']=_[_0x73ad('0xa')](config[_0x73ad('0xb')],{'host':_0x73ad('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73ad('0xb')]));require('./openchannelAccount.socket')[_0x73ad('0xd')](socket);function respondWithRpcPromise(_0x345b4e,_0x103274,_0x2ef13e){return new BPromise(function(_0x2b4081,_0x230f2d){return client[_0x73ad('0xe')](_0x345b4e,_0x2ef13e)[_0x73ad('0xf')](function(_0x413120){logger['info'](_0x73ad('0x10'),_0x103274,_0x73ad('0x11'));logger[_0x73ad('0x12')](_0x73ad('0x13'),_0x103274,_0x73ad('0x11'),JSON[_0x73ad('0x14')](_0x413120));if(_0x413120[_0x73ad('0x15')]){if(_0x413120['error'][_0x73ad('0x16')]===0x1f4){logger[_0x73ad('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x103274,_0x413120[_0x73ad('0x15')][_0x73ad('0x17')]);return _0x230f2d(_0x413120['error'][_0x73ad('0x17')]);}logger[_0x73ad('0x15')](_0x73ad('0x10'),_0x103274,_0x413120[_0x73ad('0x15')][_0x73ad('0x17')]);return _0x2b4081(_0x413120[_0x73ad('0x15')][_0x73ad('0x17')]);}else{logger[_0x73ad('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x103274,_0x73ad('0x11'));_0x2b4081(_0x413120[_0x73ad('0x19')]['message']);}})[_0x73ad('0x1a')](function(_0x1adab1){logger[_0x73ad('0x15')](_0x73ad('0x10'),_0x103274,_0x1adab1);_0x230f2d(_0x1adab1);});});}