c78ae661748ec50503ae316114a338fa6e8ccabe
[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 _0xe534=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17d703,_0x2266eb){var _0x4fd652=function(_0x4147ad){while(--_0x4147ad){_0x17d703['push'](_0x17d703['shift']());}};_0x4fd652(++_0x2266eb);}(_0xe534,0x1de));var _0x4e53=function(_0x39f77e,_0x1aed05){_0x39f77e=_0x39f77e-0x0;var _0x193066=_0xe534[_0x39f77e];return _0x193066;};'use strict';var _=require(_0x4e53('0x0'));var util=require(_0x4e53('0x1'));var moment=require(_0x4e53('0x2'));var BPromise=require(_0x4e53('0x3'));var rs=require(_0x4e53('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e53('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e53('0x6'))(_0x4e53('0x7'));var config=require(_0x4e53('0x8'));var jayson=require(_0x4e53('0x9'));var client=jayson[_0x4e53('0xa')]['http']({'port':0x232a});config['redis']=_[_0x4e53('0xb')](config[_0x4e53('0xc')],{'host':_0x4e53('0xd'),'port':0x18eb});var socket=require(_0x4e53('0xe'))(new Redis(config[_0x4e53('0xc')]));require(_0x4e53('0xf'))[_0x4e53('0x10')](socket);function respondWithRpcPromise(_0xcb2d48,_0x5d6801,_0x224e8a){return new BPromise(function(_0x5282cb,_0x1a1996){return client[_0x4e53('0x11')](_0xcb2d48,_0x224e8a)[_0x4e53('0x12')](function(_0x24405f){logger[_0x4e53('0x13')](_0x4e53('0x14'),_0x5d6801,_0x4e53('0x15'));logger[_0x4e53('0x16')](_0x4e53('0x17'),_0x5d6801,_0x4e53('0x15'),JSON[_0x4e53('0x18')](_0x24405f));if(_0x24405f[_0x4e53('0x19')]){if(_0x24405f['error']['code']===0x1f4){logger[_0x4e53('0x19')](_0x4e53('0x14'),_0x5d6801,_0x24405f[_0x4e53('0x19')][_0x4e53('0x1a')]);return _0x1a1996(_0x24405f[_0x4e53('0x19')][_0x4e53('0x1a')]);}logger[_0x4e53('0x19')](_0x4e53('0x14'),_0x5d6801,_0x24405f[_0x4e53('0x19')]['message']);return _0x5282cb(_0x24405f[_0x4e53('0x19')][_0x4e53('0x1a')]);}else{logger[_0x4e53('0x13')](_0x4e53('0x14'),_0x5d6801,_0x4e53('0x15'));_0x5282cb(_0x24405f[_0x4e53('0x1b')][_0x4e53('0x1a')]);}})['catch'](function(_0x2ce2f4){logger[_0x4e53('0x19')](_0x4e53('0x14'),_0x5d6801,_0x2ce2f4);_0x1a1996(_0x2ce2f4);});});}