Built motion from commit (unavailable).|2.5.30
[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 _0x6b9b=['message','result','util','randomstring','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','VoicePrefix,\x20%s,\x20%s'];(function(_0x17d97d,_0x2b5b56){var _0x2f473f=function(_0x1cb9ed){while(--_0x1cb9ed){_0x17d97d['push'](_0x17d97d['shift']());}};_0x2f473f(++_0x2b5b56);}(_0x6b9b,0x19a));var _0xb6b9=function(_0x2f61e4,_0x26bafd){_0x2f61e4=_0x2f61e4-0x0;var _0x200171=_0x6b9b[_0x2f61e4];return _0x200171;};'use strict';var _=require('lodash');var util=require(_0xb6b9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb6b9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6b9('0x2'));var logger=require(_0xb6b9('0x3'))(_0xb6b9('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb6b9('0x5')][_0xb6b9('0x6')]({'port':0x232a});config['redis']=_[_0xb6b9('0x7')](config[_0xb6b9('0x8')],{'host':_0xb6b9('0x9'),'port':0x18eb});var socket=require(_0xb6b9('0xa'))(new Redis(config[_0xb6b9('0x8')]));require(_0xb6b9('0xb'))[_0xb6b9('0xc')](socket);function respondWithRpcPromise(_0x2f5e84,_0x5caa8c,_0x1ea149){return new BPromise(function(_0x4b8976,_0x1fbfeb){return client[_0xb6b9('0xd')](_0x2f5e84,_0x1ea149)[_0xb6b9('0xe')](function(_0x465df4){logger[_0xb6b9('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x5caa8c,_0xb6b9('0x10'));logger[_0xb6b9('0x11')](_0xb6b9('0x12'),_0x5caa8c,_0xb6b9('0x10'),JSON['stringify'](_0x465df4));if(_0x465df4[_0xb6b9('0x13')]){if(_0x465df4[_0xb6b9('0x13')][_0xb6b9('0x14')]===0x1f4){logger[_0xb6b9('0x13')](_0xb6b9('0x15'),_0x5caa8c,_0x465df4[_0xb6b9('0x13')]['message']);return _0x1fbfeb(_0x465df4[_0xb6b9('0x13')][_0xb6b9('0x16')]);}logger[_0xb6b9('0x13')](_0xb6b9('0x15'),_0x5caa8c,_0x465df4[_0xb6b9('0x13')][_0xb6b9('0x16')]);return _0x4b8976(_0x465df4[_0xb6b9('0x13')][_0xb6b9('0x16')]);}else{logger['info'](_0xb6b9('0x15'),_0x5caa8c,_0xb6b9('0x10'));_0x4b8976(_0x465df4[_0xb6b9('0x17')][_0xb6b9('0x16')]);}})['catch'](function(_0x4e5e95){logger[_0xb6b9('0x13')](_0xb6b9('0x15'),_0x5caa8c,_0x4e5e95);_0x1fbfeb(_0x4e5e95);});});}