Built motion from commit 14588770.|2.5.38
[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 _0x8561=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','localhost','then','info','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','util','moment','randomstring'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8561,0x1b2));var _0x1856=function(_0x4ea5eb,_0x190c43){_0x4ea5eb=_0x4ea5eb-0x0;var _0x2133cf=_0x8561[_0x4ea5eb];return _0x2133cf;};'use strict';var _=require('lodash');var util=require(_0x1856('0x0'));var moment=require(_0x1856('0x1'));var BPromise=require('bluebird');var rs=require(_0x1856('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1856('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1856('0x4'))('rpc');var config=require(_0x1856('0x5'));var jayson=require(_0x1856('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1856('0x7')]=_['defaults'](config['redis'],{'host':_0x1856('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x1bfad8,_0x3e47b3,_0x510505){return new BPromise(function(_0x55fe85,_0x97f276){return client['request'](_0x1bfad8,_0x510505)[_0x1856('0x9')](function(_0x584a8e){logger[_0x1856('0xa')]('VoicePrefix,\x20%s,\x20%s',_0x3e47b3,_0x1856('0xb'));logger[_0x1856('0xc')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3e47b3,_0x1856('0xb'),JSON[_0x1856('0xd')](_0x584a8e));if(_0x584a8e[_0x1856('0xe')]){if(_0x584a8e['error'][_0x1856('0xf')]===0x1f4){logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x584a8e['error'][_0x1856('0x11')]);return _0x97f276(_0x584a8e[_0x1856('0xe')][_0x1856('0x11')]);}logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x584a8e[_0x1856('0xe')][_0x1856('0x11')]);return _0x55fe85(_0x584a8e['error']['message']);}else{logger[_0x1856('0xa')]('VoicePrefix,\x20%s,\x20%s',_0x3e47b3,'request\x20sent');_0x55fe85(_0x584a8e[_0x1856('0x12')][_0x1856('0x11')]);}})['catch'](function(_0x4f5381){logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x4f5381);_0x97f276(_0x4f5381);});});}