85ab5da13dec75c9589b39ef8c1734855b4f428e
[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 _0xac6a=['localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x12f654,_0x2977b4){var _0x45d229=function(_0x152e96){while(--_0x152e96){_0x12f654['push'](_0x12f654['shift']());}};_0x45d229(++_0x2977b4);}(_0xac6a,0xc2));var _0xaac6=function(_0x25c342,_0x4993bb){_0x25c342=_0x25c342-0x0;var _0x567f30=_0xac6a[_0x25c342];return _0x567f30;};'use strict';var _=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var moment=require(_0xaac6('0x2'));var BPromise=require(_0xaac6('0x3'));var rs=require(_0xaac6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac6('0x6'))(_0xaac6('0x7'));var config=require(_0xaac6('0x8'));var jayson=require(_0xaac6('0x9'));var client=jayson[_0xaac6('0xa')][_0xaac6('0xb')]({'port':0x232a});config[_0xaac6('0xc')]=_[_0xaac6('0xd')](config[_0xaac6('0xc')],{'host':_0xaac6('0xe'),'port':0x18eb});var socket=require(_0xaac6('0xf'))(new Redis(config[_0xaac6('0xc')]));require('./voicePrefix.socket')[_0xaac6('0x10')](socket);function respondWithRpcPromise(_0x160834,_0x31fa92,_0x37c3ba){return new BPromise(function(_0x19345a,_0x2b9460){return client['request'](_0x160834,_0x37c3ba)[_0xaac6('0x11')](function(_0x1605a3){logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));logger['debug'](_0xaac6('0x15'),_0x31fa92,_0xaac6('0x14'),JSON['stringify'](_0x1605a3));if(_0x1605a3['error']){if(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x17')]===0x1f4){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x2b9460(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);}logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x19345a(_0x1605a3['error']['message']);}else{logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));_0x19345a(_0x1605a3[_0xaac6('0x19')][_0xaac6('0x18')]);}})['catch'](function(_0x22d66e){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x22d66e);_0x2b9460(_0x22d66e);});});}