a2e4519136ad09349531362868d53faa2328ff08
[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 _0x4a1b=['localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x12c824,_0x13e6b3){var _0x19414f=function(_0x389813){while(--_0x389813){_0x12c824['push'](_0x12c824['shift']());}};_0x19414f(++_0x13e6b3);}(_0x4a1b,0x7f));var _0xb4a1=function(_0x163f58,_0x1c8ae4){_0x163f58=_0x163f58-0x0;var _0x472ed9=_0x4a1b[_0x163f58];return _0x472ed9;};'use strict';var _=require(_0xb4a1('0x0'));var util=require(_0xb4a1('0x1'));var moment=require(_0xb4a1('0x2'));var BPromise=require(_0xb4a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4a1('0x4'));var db=require(_0xb4a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb4a1('0x6'));var config=require(_0xb4a1('0x7'));var jayson=require(_0xb4a1('0x8'));var client=jayson[_0xb4a1('0x9')][_0xb4a1('0xa')]({'port':0x232a});config['redis']=_[_0xb4a1('0xb')](config[_0xb4a1('0xc')],{'host':_0xb4a1('0xd'),'port':0x18eb});var socket=require(_0xb4a1('0xe'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xb4a1('0xf')](socket);function respondWithRpcPromise(_0x4121a4,_0x57e540,_0x99f9a9){return new BPromise(function(_0x1a6cb6,_0x251711){return client[_0xb4a1('0x10')](_0x4121a4,_0x99f9a9)[_0xb4a1('0x11')](function(_0xe1c9ae){logger[_0xb4a1('0x12')](_0xb4a1('0x13'),_0x57e540,_0xb4a1('0x14'));logger['debug'](_0xb4a1('0x15'),_0x57e540,_0xb4a1('0x14'),JSON[_0xb4a1('0x16')](_0xe1c9ae));if(_0xe1c9ae['error']){if(_0xe1c9ae[_0xb4a1('0x17')][_0xb4a1('0x18')]===0x1f4){logger['error'](_0xb4a1('0x13'),_0x57e540,_0xe1c9ae[_0xb4a1('0x17')][_0xb4a1('0x19')]);return _0x251711(_0xe1c9ae[_0xb4a1('0x17')][_0xb4a1('0x19')]);}logger['error'](_0xb4a1('0x13'),_0x57e540,_0xe1c9ae[_0xb4a1('0x17')][_0xb4a1('0x19')]);return _0x1a6cb6(_0xe1c9ae[_0xb4a1('0x17')][_0xb4a1('0x19')]);}else{logger[_0xb4a1('0x12')](_0xb4a1('0x13'),_0x57e540,'request\x20sent');_0x1a6cb6(_0xe1c9ae[_0xb4a1('0x1a')][_0xb4a1('0x19')]);}})[_0xb4a1('0x1b')](function(_0x33c78a){logger[_0xb4a1('0x17')](_0xb4a1('0x13'),_0x57e540,_0x33c78a);_0x251711(_0x33c78a);});});}