Built motion from commit (unavailable).|2.5.22
[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 _0x3b1e=['jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x3b1e,0x1cc));var _0xe3b1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3b1e[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xe3b1('0x0'));var moment=require(_0xe3b1('0x1'));var BPromise=require('bluebird');var rs=require(_0xe3b1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3b1('0x3'))['db'];var utils=require(_0xe3b1('0x4'));var logger=require(_0xe3b1('0x5'))(_0xe3b1('0x6'));var config=require(_0xe3b1('0x7'));var jayson=require(_0xe3b1('0x8'));var client=jayson[_0xe3b1('0x9')][_0xe3b1('0xa')]({'port':0x232a});config[_0xe3b1('0xb')]=_[_0xe3b1('0xc')](config[_0xe3b1('0xb')],{'host':_0xe3b1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3b1('0xb')]));require(_0xe3b1('0xe'))[_0xe3b1('0xf')](socket);function respondWithRpcPromise(_0x15fb76,_0x5d779d,_0x46ceb2){return new BPromise(function(_0x3273e5,_0x2e36ea){return client[_0xe3b1('0x10')](_0x15fb76,_0x46ceb2)[_0xe3b1('0x11')](function(_0x3928cf){logger[_0xe3b1('0x12')](_0xe3b1('0x13'),_0x5d779d,'request\x20sent');logger['debug'](_0xe3b1('0x14'),_0x5d779d,_0xe3b1('0x15'),JSON['stringify'](_0x3928cf));if(_0x3928cf[_0xe3b1('0x16')]){if(_0x3928cf[_0xe3b1('0x16')][_0xe3b1('0x17')]===0x1f4){logger[_0xe3b1('0x16')](_0xe3b1('0x13'),_0x5d779d,_0x3928cf[_0xe3b1('0x16')][_0xe3b1('0x18')]);return _0x2e36ea(_0x3928cf[_0xe3b1('0x16')]['message']);}logger[_0xe3b1('0x16')](_0xe3b1('0x13'),_0x5d779d,_0x3928cf['error'][_0xe3b1('0x18')]);return _0x3273e5(_0x3928cf[_0xe3b1('0x16')][_0xe3b1('0x18')]);}else{logger[_0xe3b1('0x12')](_0xe3b1('0x13'),_0x5d779d,_0xe3b1('0x15'));_0x3273e5(_0x3928cf['result']['message']);}})[_0xe3b1('0x19')](function(_0x4c9c04){logger[_0xe3b1('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d779d,_0x4c9c04);_0x2e36ea(_0x4c9c04);});});}