88e8e06e38b92b63a8980a80a36ca2a81a39945d
[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 _0x7e04=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7e04,0xd6));var _0x47e0=function(_0x3bb43c,_0x5e18f3){_0x3bb43c=_0x3bb43c-0x0;var _0x1c5bf9=_0x7e04[_0x3bb43c];return _0x1c5bf9;};'use strict';var _=require(_0x47e0('0x0'));var util=require(_0x47e0('0x1'));var moment=require(_0x47e0('0x2'));var BPromise=require('bluebird');var rs=require(_0x47e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x47e0('0x4'));var logger=require(_0x47e0('0x5'))('rpc');var config=require(_0x47e0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x47e0('0x7')][_0x47e0('0x8')]({'port':0x232a});config[_0x47e0('0x9')]=_['defaults'](config['redis'],{'host':_0x47e0('0xa'),'port':0x18eb});var socket=require(_0x47e0('0xb'))(new Redis(config[_0x47e0('0x9')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x3dc947,_0x142e5a,_0x10303c){return new BPromise(function(_0x2696f2,_0x2f7940){return client[_0x47e0('0xc')](_0x3dc947,_0x10303c)[_0x47e0('0xd')](function(_0x4db9cb){logger[_0x47e0('0xe')](_0x47e0('0xf'),_0x142e5a,_0x47e0('0x10'));logger[_0x47e0('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x142e5a,_0x47e0('0x10'),JSON[_0x47e0('0x12')](_0x4db9cb));if(_0x4db9cb[_0x47e0('0x13')]){if(_0x4db9cb['error'][_0x47e0('0x14')]===0x1f4){logger[_0x47e0('0x13')](_0x47e0('0xf'),_0x142e5a,_0x4db9cb[_0x47e0('0x13')][_0x47e0('0x15')]);return _0x2f7940(_0x4db9cb['error'][_0x47e0('0x15')]);}logger['error'](_0x47e0('0xf'),_0x142e5a,_0x4db9cb[_0x47e0('0x13')][_0x47e0('0x15')]);return _0x2696f2(_0x4db9cb[_0x47e0('0x13')][_0x47e0('0x15')]);}else{logger['info'](_0x47e0('0xf'),_0x142e5a,_0x47e0('0x10'));_0x2696f2(_0x4db9cb[_0x47e0('0x16')]['message']);}})['catch'](function(_0x31ffc7){logger[_0x47e0('0x13')](_0x47e0('0xf'),_0x142e5a,_0x31ffc7);_0x2f7940(_0x31ffc7);});});}