cd2188c688f297e7b17a032bb9cb7b46b9faaecf
[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 _0x3fc6=['request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x56553a,_0x458912){var _0x408e7e=function(_0x50b67b){while(--_0x50b67b){_0x56553a['push'](_0x56553a['shift']());}};_0x408e7e(++_0x458912);}(_0x3fc6,0x115));var _0x63fc=function(_0x5bf3c6,_0x317114){_0x5bf3c6=_0x5bf3c6-0x0;var _0x53f9a8=_0x3fc6[_0x5bf3c6];return _0x53f9a8;};'use strict';var _=require(_0x63fc('0x0'));var util=require('util');var moment=require(_0x63fc('0x1'));var BPromise=require(_0x63fc('0x2'));var rs=require(_0x63fc('0x3'));var fs=require('fs');var Redis=require(_0x63fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63fc('0x5'));var logger=require(_0x63fc('0x6'))(_0x63fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x63fc('0x8'));var client=jayson['client'][_0x63fc('0x9')]({'port':0x232a});config[_0x63fc('0xa')]=_[_0x63fc('0xb')](config['redis'],{'host':_0x63fc('0xc'),'port':0x18eb});var socket=require(_0x63fc('0xd'))(new Redis(config[_0x63fc('0xa')]));require(_0x63fc('0xe'))[_0x63fc('0xf')](socket);function respondWithRpcPromise(_0x5f328c,_0x319f1e,_0x544f22){return new BPromise(function(_0x5ad9a0,_0x6b8e8f){return client[_0x63fc('0x10')](_0x5f328c,_0x544f22)[_0x63fc('0x11')](function(_0x4445ba){logger[_0x63fc('0x12')](_0x63fc('0x13'),_0x319f1e,_0x63fc('0x14'));logger[_0x63fc('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x319f1e,_0x63fc('0x14'),JSON[_0x63fc('0x16')](_0x4445ba));if(_0x4445ba[_0x63fc('0x17')]){if(_0x4445ba['error'][_0x63fc('0x18')]===0x1f4){logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x4445ba['error'][_0x63fc('0x19')]);return _0x6b8e8f(_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);}logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);return _0x5ad9a0(_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);}else{logger[_0x63fc('0x12')](_0x63fc('0x13'),_0x319f1e,_0x63fc('0x14'));_0x5ad9a0(_0x4445ba[_0x63fc('0x1a')][_0x63fc('0x19')]);}})['catch'](function(_0x225c93){logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x225c93);_0x6b8e8f(_0x225c93);});});}