Built motion from commit 497d3d92.|2.5.43
[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 _0x11f3=['redis','defaults','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','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x5a67da,_0x406e90){var _0xddccbf=function(_0xd645b){while(--_0xd645b){_0x5a67da['push'](_0x5a67da['shift']());}};_0xddccbf(++_0x406e90);}(_0x11f3,0x149));var _0x311f=function(_0xd99fc0,_0x154359){_0xd99fc0=_0xd99fc0-0x0;var _0x39728d=_0x11f3[_0xd99fc0];return _0x39728d;};'use strict';var _=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var moment=require(_0x311f('0x2'));var BPromise=require('bluebird');var rs=require(_0x311f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x311f('0x4'))['db'];var utils=require(_0x311f('0x5'));var logger=require(_0x311f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x311f('0x7'));var client=jayson['client'][_0x311f('0x8')]({'port':0x232a});config[_0x311f('0x9')]=_[_0x311f('0xa')](config[_0x311f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x311f('0xb'))(new Redis(config[_0x311f('0x9')]));require(_0x311f('0xc'))[_0x311f('0xd')](socket);function respondWithRpcPromise(_0x7cd779,_0x495f48,_0x20de65){return new BPromise(function(_0x292325,_0x2e45d1){return client[_0x311f('0xe')](_0x7cd779,_0x20de65)[_0x311f('0xf')](function(_0x1d70ea){logger[_0x311f('0x10')](_0x311f('0x11'),_0x495f48,_0x311f('0x12'));logger[_0x311f('0x13')](_0x311f('0x14'),_0x495f48,_0x311f('0x12'),JSON[_0x311f('0x15')](_0x1d70ea));if(_0x1d70ea[_0x311f('0x16')]){if(_0x1d70ea[_0x311f('0x16')][_0x311f('0x17')]===0x1f4){logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x1d70ea[_0x311f('0x16')]['message']);return _0x2e45d1(_0x1d70ea['error']['message']);}logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x1d70ea[_0x311f('0x16')][_0x311f('0x18')]);return _0x292325(_0x1d70ea[_0x311f('0x16')][_0x311f('0x18')]);}else{logger[_0x311f('0x10')](_0x311f('0x11'),_0x495f48,_0x311f('0x12'));_0x292325(_0x1d70ea['result'][_0x311f('0x18')]);}})[_0x311f('0x19')](function(_0x3b9ca8){logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x3b9ca8);_0x2e45d1(_0x3b9ca8);});});}