3c5495d73360a427f4f5153d14db5a151803230b
[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 _0x27f3=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x30b833,_0x258925){var _0x53e532=function(_0x52e10c){while(--_0x52e10c){_0x30b833['push'](_0x30b833['shift']());}};_0x53e532(++_0x258925);}(_0x27f3,0x1e9));var _0x327f=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x27f3[_0x954b3a];return _0x3a313e;};'use strict';var _=require(_0x327f('0x0'));var util=require(_0x327f('0x1'));var moment=require('moment');var BPromise=require(_0x327f('0x2'));var rs=require(_0x327f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x327f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x327f('0x5'))(_0x327f('0x6'));var config=require(_0x327f('0x7'));var jayson=require(_0x327f('0x8'));var client=jayson[_0x327f('0x9')][_0x327f('0xa')]({'port':0x232a});config[_0x327f('0xb')]=_[_0x327f('0xc')](config['redis'],{'host':_0x327f('0xd'),'port':0x18eb});var socket=require(_0x327f('0xe'))(new Redis(config[_0x327f('0xb')]));require(_0x327f('0xf'))[_0x327f('0x10')](socket);function respondWithRpcPromise(_0x18c142,_0x501f8b,_0x25295d){return new BPromise(function(_0x119120,_0x434e5a){return client[_0x327f('0x11')](_0x18c142,_0x25295d)[_0x327f('0x12')](function(_0xb2fd19){logger[_0x327f('0x13')](_0x327f('0x14'),_0x501f8b,'request\x20sent');logger[_0x327f('0x15')](_0x327f('0x16'),_0x501f8b,_0x327f('0x17'),JSON[_0x327f('0x18')](_0xb2fd19));if(_0xb2fd19[_0x327f('0x19')]){if(_0xb2fd19[_0x327f('0x19')][_0x327f('0x1a')]===0x1f4){logger[_0x327f('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x501f8b,_0xb2fd19['error'][_0x327f('0x1b')]);return _0x434e5a(_0xb2fd19[_0x327f('0x19')][_0x327f('0x1b')]);}logger[_0x327f('0x19')](_0x327f('0x14'),_0x501f8b,_0xb2fd19[_0x327f('0x19')][_0x327f('0x1b')]);return _0x119120(_0xb2fd19[_0x327f('0x19')][_0x327f('0x1b')]);}else{logger[_0x327f('0x13')](_0x327f('0x14'),_0x501f8b,'request\x20sent');_0x119120(_0xb2fd19[_0x327f('0x1c')][_0x327f('0x1b')]);}})[_0x327f('0x1d')](function(_0x26a217){logger[_0x327f('0x19')](_0x327f('0x14'),_0x501f8b,_0x26a217);_0x434e5a(_0x26a217);});});}