eee64075cc7a4678bfcc8f372e89661b89a963d3
[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 _0x39d2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x39d2,0xf5));var _0x239d=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x39d2[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0x239d('0x0'));var util=require('util');var moment=require(_0x239d('0x1'));var BPromise=require(_0x239d('0x2'));var rs=require(_0x239d('0x3'));var fs=require('fs');var Redis=require(_0x239d('0x4'));var db=require(_0x239d('0x5'))['db'];var utils=require(_0x239d('0x6'));var logger=require(_0x239d('0x7'))(_0x239d('0x8'));var config=require(_0x239d('0x9'));var jayson=require(_0x239d('0xa'));var client=jayson[_0x239d('0xb')][_0x239d('0xc')]({'port':0x232a});config[_0x239d('0xd')]=_['defaults'](config[_0x239d('0xd')],{'host':_0x239d('0xe'),'port':0x18eb});var socket=require(_0x239d('0xf'))(new Redis(config[_0x239d('0xd')]));require(_0x239d('0x10'))[_0x239d('0x11')](socket);function respondWithRpcPromise(_0x23a47c,_0x2cf18b,_0x542157){return new BPromise(function(_0x6273ef,_0x4d5406){return client[_0x239d('0x12')](_0x23a47c,_0x542157)[_0x239d('0x13')](function(_0x2af4eb){logger[_0x239d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x2cf18b,'request\x20sent');logger[_0x239d('0x15')](_0x239d('0x16'),_0x2cf18b,_0x239d('0x17'),JSON[_0x239d('0x18')](_0x2af4eb));if(_0x2af4eb[_0x239d('0x19')]){if(_0x2af4eb[_0x239d('0x19')][_0x239d('0x1a')]===0x1f4){logger[_0x239d('0x19')](_0x239d('0x1b'),_0x2cf18b,_0x2af4eb['error'][_0x239d('0x1c')]);return _0x4d5406(_0x2af4eb[_0x239d('0x19')][_0x239d('0x1c')]);}logger[_0x239d('0x19')](_0x239d('0x1b'),_0x2cf18b,_0x2af4eb['error']['message']);return _0x6273ef(_0x2af4eb[_0x239d('0x19')]['message']);}else{logger[_0x239d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x2cf18b,_0x239d('0x17'));_0x6273ef(_0x2af4eb[_0x239d('0x1d')][_0x239d('0x1c')]);}})[_0x239d('0x1e')](function(_0x3b1f15){logger[_0x239d('0x19')](_0x239d('0x1b'),_0x2cf18b,_0x3b1f15);_0x4d5406(_0x3b1f15);});});}