Built motion from commit (unavailable).|2.4.3
[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 _0xd146=['./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3b8266,_0x4bcafc){var _0x34b571=function(_0x463680){while(--_0x463680){_0x3b8266['push'](_0x3b8266['shift']());}};_0x34b571(++_0x4bcafc);}(_0xd146,0x17a));var _0x6d14=function(_0x5345df,_0x39481b){_0x5345df=_0x5345df-0x0;var _0x305a6f=_0xd146[_0x5345df];return _0x305a6f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d14('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d14('0x1'));var db=require(_0x6d14('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d14('0x3'))(_0x6d14('0x4'));var config=require('../../config/environment');var jayson=require(_0x6d14('0x5'));var client=jayson[_0x6d14('0x6')][_0x6d14('0x7')]({'port':0x232a});config[_0x6d14('0x8')]=_[_0x6d14('0x9')](config['redis'],{'host':_0x6d14('0xa'),'port':0x18eb});var socket=require(_0x6d14('0xb'))(new Redis(config[_0x6d14('0x8')]));require(_0x6d14('0xc'))[_0x6d14('0xd')](socket);function respondWithRpcPromise(_0x37ac46,_0x12f2df,_0x1bef3d){return new BPromise(function(_0x490ffa,_0xb0c2f1){return client[_0x6d14('0xe')](_0x37ac46,_0x1bef3d)[_0x6d14('0xf')](function(_0x529a96){logger[_0x6d14('0x10')](_0x6d14('0x11'),_0x12f2df,'request\x20sent');logger['debug'](_0x6d14('0x12'),_0x12f2df,_0x6d14('0x13'),JSON[_0x6d14('0x14')](_0x529a96));if(_0x529a96['error']){if(_0x529a96[_0x6d14('0x15')][_0x6d14('0x16')]===0x1f4){logger[_0x6d14('0x15')](_0x6d14('0x11'),_0x12f2df,_0x529a96[_0x6d14('0x15')][_0x6d14('0x17')]);return _0xb0c2f1(_0x529a96[_0x6d14('0x15')][_0x6d14('0x17')]);}logger[_0x6d14('0x15')](_0x6d14('0x11'),_0x12f2df,_0x529a96['error']['message']);return _0x490ffa(_0x529a96[_0x6d14('0x15')]['message']);}else{logger[_0x6d14('0x10')](_0x6d14('0x11'),_0x12f2df,'request\x20sent');_0x490ffa(_0x529a96[_0x6d14('0x18')]['message']);}})[_0x6d14('0x19')](function(_0xdb7c5b){logger['error'](_0x6d14('0x11'),_0x12f2df,_0xdb7c5b);_0xb0c2f1(_0xdb7c5b);});});}