Built motion from commit (unavailable).|2.5.29
[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 _0x3432=['../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20410e,_0x11ea83){var _0x18e1cc=function(_0x58a0f0){while(--_0x58a0f0){_0x20410e['push'](_0x20410e['shift']());}};_0x18e1cc(++_0x11ea83);}(_0x3432,0x199));var _0x2343=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3432[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2343('0x0'));var moment=require('moment');var BPromise=require(_0x2343('0x1'));var rs=require(_0x2343('0x2'));var fs=require('fs');var Redis=require(_0x2343('0x3'));var db=require(_0x2343('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2343('0x5'))('rpc');var config=require(_0x2343('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2343('0x7')]['http']({'port':0x232a});config[_0x2343('0x8')]=_[_0x2343('0x9')](config['redis'],{'host':_0x2343('0xa'),'port':0x18eb});var socket=require(_0x2343('0xb'))(new Redis(config[_0x2343('0x8')]));require(_0x2343('0xc'))['register'](socket);function respondWithRpcPromise(_0x573d0e,_0x323d1c,_0x1a38ed){return new BPromise(function(_0x213b20,_0x71deb3){return client[_0x2343('0xd')](_0x573d0e,_0x1a38ed)['then'](function(_0x4c3386){logger[_0x2343('0xe')](_0x2343('0xf'),_0x323d1c,_0x2343('0x10'));logger[_0x2343('0x11')](_0x2343('0x12'),_0x323d1c,_0x2343('0x10'),JSON['stringify'](_0x4c3386));if(_0x4c3386[_0x2343('0x13')]){if(_0x4c3386['error'][_0x2343('0x14')]===0x1f4){logger[_0x2343('0x13')](_0x2343('0xf'),_0x323d1c,_0x4c3386[_0x2343('0x13')][_0x2343('0x15')]);return _0x71deb3(_0x4c3386[_0x2343('0x13')][_0x2343('0x15')]);}logger[_0x2343('0x13')](_0x2343('0xf'),_0x323d1c,_0x4c3386['error'][_0x2343('0x15')]);return _0x213b20(_0x4c3386['error'][_0x2343('0x15')]);}else{logger[_0x2343('0xe')](_0x2343('0xf'),_0x323d1c,_0x2343('0x10'));_0x213b20(_0x4c3386['result']['message']);}})[_0x2343('0x16')](function(_0x10f34a){logger[_0x2343('0x13')](_0x2343('0xf'),_0x323d1c,_0x10f34a);_0x71deb3(_0x10f34a);});});}