e5bd96be9cd95898ad22a0febafd2d4833265877
[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 _0xca6e=['http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xca6e,0x1c1));var _0xeca6=function(_0x19f514,_0x56d767){_0x19f514=_0x19f514-0x0;var _0x19d72f=_0xca6e[_0x19f514];return _0x19d72f;};'use strict';var _=require(_0xeca6('0x0'));var util=require(_0xeca6('0x1'));var moment=require(_0xeca6('0x2'));var BPromise=require(_0xeca6('0x3'));var rs=require(_0xeca6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeca6('0x5'))['db'];var utils=require(_0xeca6('0x6'));var logger=require('../../config/logger')(_0xeca6('0x7'));var config=require('../../config/environment');var jayson=require(_0xeca6('0x8'));var client=jayson[_0xeca6('0x9')][_0xeca6('0xa')]({'port':0x232a});config['redis']=_[_0xeca6('0xb')](config['redis'],{'host':_0xeca6('0xc'),'port':0x18eb});var socket=require(_0xeca6('0xd'))(new Redis(config[_0xeca6('0xe')]));require(_0xeca6('0xf'))[_0xeca6('0x10')](socket);function respondWithRpcPromise(_0x4a3a13,_0xbf428e,_0xd946bf){return new BPromise(function(_0x31db18,_0x1499a2){return client[_0xeca6('0x11')](_0x4a3a13,_0xd946bf)['then'](function(_0x1f8b3d){logger[_0xeca6('0x12')](_0xeca6('0x13'),_0xbf428e,_0xeca6('0x14'));logger[_0xeca6('0x15')](_0xeca6('0x16'),_0xbf428e,'request\x20sent',JSON['stringify'](_0x1f8b3d));if(_0x1f8b3d[_0xeca6('0x17')]){if(_0x1f8b3d[_0xeca6('0x17')][_0xeca6('0x18')]===0x1f4){logger[_0xeca6('0x17')]('VoicePrefix,\x20%s,\x20%s',_0xbf428e,_0x1f8b3d[_0xeca6('0x17')]['message']);return _0x1499a2(_0x1f8b3d[_0xeca6('0x17')][_0xeca6('0x19')]);}logger[_0xeca6('0x17')](_0xeca6('0x13'),_0xbf428e,_0x1f8b3d[_0xeca6('0x17')]['message']);return _0x31db18(_0x1f8b3d[_0xeca6('0x17')]['message']);}else{logger[_0xeca6('0x12')]('VoicePrefix,\x20%s,\x20%s',_0xbf428e,_0xeca6('0x14'));_0x31db18(_0x1f8b3d[_0xeca6('0x1a')][_0xeca6('0x19')]);}})['catch'](function(_0x516b94){logger[_0xeca6('0x17')](_0xeca6('0x13'),_0xbf428e,_0x516b94);_0x1499a2(_0x516b94);});});}