22884be7fdf6b56abbb78a59c9ef732ef51d39e8
[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 _0x7840=['localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x543037,_0x141966){var _0x154b30=function(_0x2ddbe0){while(--_0x2ddbe0){_0x543037['push'](_0x543037['shift']());}};_0x154b30(++_0x141966);}(_0x7840,0x68));var _0x0784=function(_0x121656,_0x26c4e2){_0x121656=_0x121656-0x0;var _0x1d12aa=_0x7840[_0x121656];return _0x1d12aa;};'use strict';var _=require('lodash');var util=require(_0x0784('0x0'));var moment=require(_0x0784('0x1'));var BPromise=require(_0x0784('0x2'));var rs=require(_0x0784('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0784('0x4'))['db'];var utils=require(_0x0784('0x5'));var logger=require(_0x0784('0x6'))(_0x0784('0x7'));var config=require('../../config/environment');var jayson=require(_0x0784('0x8'));var client=jayson[_0x0784('0x9')][_0x0784('0xa')]({'port':0x232a});config[_0x0784('0xb')]=_['defaults'](config[_0x0784('0xb')],{'host':_0x0784('0xc'),'port':0x18eb});var socket=require(_0x0784('0xd'))(new Redis(config[_0x0784('0xb')]));require(_0x0784('0xe'))[_0x0784('0xf')](socket);function respondWithRpcPromise(_0x1ada58,_0x13ff4c,_0x2d0d57){return new BPromise(function(_0x33238e,_0x450158){return client[_0x0784('0x10')](_0x1ada58,_0x2d0d57)[_0x0784('0x11')](function(_0x260999){logger['info'](_0x0784('0x12'),_0x13ff4c,_0x0784('0x13'));logger[_0x0784('0x14')](_0x0784('0x15'),_0x13ff4c,_0x0784('0x13'),JSON[_0x0784('0x16')](_0x260999));if(_0x260999['error']){if(_0x260999['error'][_0x0784('0x17')]===0x1f4){logger[_0x0784('0x18')](_0x0784('0x12'),_0x13ff4c,_0x260999['error'][_0x0784('0x19')]);return _0x450158(_0x260999[_0x0784('0x18')][_0x0784('0x19')]);}logger[_0x0784('0x18')](_0x0784('0x12'),_0x13ff4c,_0x260999['error'][_0x0784('0x19')]);return _0x33238e(_0x260999[_0x0784('0x18')][_0x0784('0x19')]);}else{logger[_0x0784('0x1a')](_0x0784('0x12'),_0x13ff4c,_0x0784('0x13'));_0x33238e(_0x260999[_0x0784('0x1b')][_0x0784('0x19')]);}})[_0x0784('0x1c')](function(_0xdadf04){logger[_0x0784('0x18')](_0x0784('0x12'),_0x13ff4c,_0xdadf04);_0x450158(_0xdadf04);});});}