7b1cead9355c31a9ec91963fee7088926186b541
[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 _0x7ed6=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info'];(function(_0x26b650,_0x12ecbd){var _0x10cdce=function(_0x58962c){while(--_0x58962c){_0x26b650['push'](_0x26b650['shift']());}};_0x10cdce(++_0x12ecbd);}(_0x7ed6,0xcc));var _0x67ed=function(_0x32034f,_0x3c97eb){_0x32034f=_0x32034f-0x0;var _0x3c2928=_0x7ed6[_0x32034f];return _0x3c2928;};'use strict';var _=require(_0x67ed('0x0'));var util=require(_0x67ed('0x1'));var moment=require(_0x67ed('0x2'));var BPromise=require(_0x67ed('0x3'));var rs=require(_0x67ed('0x4'));var fs=require('fs');var Redis=require(_0x67ed('0x5'));var db=require(_0x67ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x67ed('0x7'))(_0x67ed('0x8'));var config=require(_0x67ed('0x9'));var jayson=require(_0x67ed('0xa'));var client=jayson['client'][_0x67ed('0xb')]({'port':0x232a});config['redis']=_[_0x67ed('0xc')](config[_0x67ed('0xd')],{'host':_0x67ed('0xe'),'port':0x18eb});var socket=require(_0x67ed('0xf'))(new Redis(config[_0x67ed('0xd')]));require(_0x67ed('0x10'))[_0x67ed('0x11')](socket);function respondWithRpcPromise(_0x48d637,_0x1cc038,_0x313ec7){return new BPromise(function(_0xd657f3,_0x3d0548){return client['request'](_0x48d637,_0x313ec7)[_0x67ed('0x12')](function(_0x1f18f5){logger[_0x67ed('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x1cc038,_0x67ed('0x14'));logger[_0x67ed('0x15')](_0x67ed('0x16'),_0x1cc038,_0x67ed('0x14'),JSON['stringify'](_0x1f18f5));if(_0x1f18f5[_0x67ed('0x17')]){if(_0x1f18f5[_0x67ed('0x17')]['code']===0x1f4){logger[_0x67ed('0x17')](_0x67ed('0x18'),_0x1cc038,_0x1f18f5[_0x67ed('0x17')][_0x67ed('0x19')]);return _0x3d0548(_0x1f18f5[_0x67ed('0x17')][_0x67ed('0x19')]);}logger[_0x67ed('0x17')](_0x67ed('0x18'),_0x1cc038,_0x1f18f5[_0x67ed('0x17')]['message']);return _0xd657f3(_0x1f18f5['error'][_0x67ed('0x19')]);}else{logger[_0x67ed('0x13')](_0x67ed('0x18'),_0x1cc038,_0x67ed('0x14'));_0xd657f3(_0x1f18f5[_0x67ed('0x1a')]['message']);}})[_0x67ed('0x1b')](function(_0x1f242d){logger['error'](_0x67ed('0x18'),_0x1cc038,_0x1f242d);_0x3d0548(_0x1f242d);});});}