6d1c2ecb3ada8c83450a05b3e55f98d593d3c7e9
[motion2.git] / server / api / voicePrefix / voicePrefix.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 _0x6ca3=['result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1c7f48,_0x255687){var _0x274c31=function(_0x58e252){while(--_0x58e252){_0x1c7f48['push'](_0x1c7f48['shift']());}};_0x274c31(++_0x255687);}(_0x6ca3,0xba));var _0x36ca=function(_0x487cb0,_0x339d3e){_0x487cb0=_0x487cb0-0x0;var _0x5a8047=_0x6ca3[_0x487cb0];return _0x5a8047;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36ca('0x0'));var BPromise=require(_0x36ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36ca('0x2'));var db=require(_0x36ca('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x36ca('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x36ca('0x5'));var client=jayson[_0x36ca('0x6')][_0x36ca('0x7')]({'port':0x232a});config[_0x36ca('0x8')]=_['defaults'](config['redis'],{'host':_0x36ca('0x9'),'port':0x18eb});var socket=require(_0x36ca('0xa'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x36ca('0xb')](socket);function respondWithRpcPromise(_0x164357,_0x2f5acf,_0x394c7b){return new BPromise(function(_0x5d42d8,_0x302c9a){return client['request'](_0x164357,_0x394c7b)[_0x36ca('0xc')](function(_0xbe5b53){logger[_0x36ca('0xd')](_0x36ca('0xe'),_0x2f5acf,_0x36ca('0xf'));logger['debug'](_0x36ca('0x10'),_0x2f5acf,_0x36ca('0xf'),JSON[_0x36ca('0x11')](_0xbe5b53));if(_0xbe5b53['error']){if(_0xbe5b53[_0x36ca('0x12')][_0x36ca('0x13')]===0x1f4){logger[_0x36ca('0x12')](_0x36ca('0xe'),_0x2f5acf,_0xbe5b53[_0x36ca('0x12')][_0x36ca('0x14')]);return _0x302c9a(_0xbe5b53[_0x36ca('0x12')][_0x36ca('0x14')]);}logger[_0x36ca('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x2f5acf,_0xbe5b53[_0x36ca('0x12')][_0x36ca('0x14')]);return _0x5d42d8(_0xbe5b53[_0x36ca('0x12')][_0x36ca('0x14')]);}else{logger[_0x36ca('0xd')]('VoicePrefix,\x20%s,\x20%s',_0x2f5acf,'request\x20sent');_0x5d42d8(_0xbe5b53[_0x36ca('0x15')][_0x36ca('0x14')]);}})[_0x36ca('0x16')](function(_0x369e12){logger[_0x36ca('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x2f5acf,_0x369e12);_0x302c9a(_0x369e12);});});}