Built motion from commit (unavailable).|2.5.31
[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 _0x4afa=['http','redis','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x28a2a1,_0x4734d8){var _0x43f4e2=function(_0x4375f9){while(--_0x4375f9){_0x28a2a1['push'](_0x28a2a1['shift']());}};_0x43f4e2(++_0x4734d8);}(_0x4afa,0x10c));var _0xa4af=function(_0x4419a9,_0x283aaf){_0x4419a9=_0x4419a9-0x0;var _0x50d90a=_0x4afa[_0x4419a9];return _0x50d90a;};'use strict';var _=require('lodash');var util=require(_0xa4af('0x0'));var moment=require(_0xa4af('0x1'));var BPromise=require('bluebird');var rs=require(_0xa4af('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4af('0x3'))['db'];var utils=require(_0xa4af('0x4'));var logger=require(_0xa4af('0x5'))(_0xa4af('0x6'));var config=require('../../config/environment');var jayson=require(_0xa4af('0x7'));var client=jayson['client'][_0xa4af('0x8')]({'port':0x232a});config[_0xa4af('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa4af('0xa'))(new Redis(config[_0xa4af('0x9')]));require('./voicePrefix.socket')[_0xa4af('0xb')](socket);function respondWithRpcPromise(_0x19dc13,_0x40f3a5,_0x3d48f1){return new BPromise(function(_0x4674fd,_0x4a8ea7){return client['request'](_0x19dc13,_0x3d48f1)[_0xa4af('0xc')](function(_0x574356){logger[_0xa4af('0xd')](_0xa4af('0xe'),_0x40f3a5,'request\x20sent');logger[_0xa4af('0xf')](_0xa4af('0x10'),_0x40f3a5,_0xa4af('0x11'),JSON[_0xa4af('0x12')](_0x574356));if(_0x574356['error']){if(_0x574356[_0xa4af('0x13')][_0xa4af('0x14')]===0x1f4){logger[_0xa4af('0x13')](_0xa4af('0xe'),_0x40f3a5,_0x574356[_0xa4af('0x13')][_0xa4af('0x15')]);return _0x4a8ea7(_0x574356[_0xa4af('0x13')]['message']);}logger['error'](_0xa4af('0xe'),_0x40f3a5,_0x574356[_0xa4af('0x13')][_0xa4af('0x15')]);return _0x4674fd(_0x574356[_0xa4af('0x13')][_0xa4af('0x15')]);}else{logger[_0xa4af('0xd')](_0xa4af('0xe'),_0x40f3a5,'request\x20sent');_0x4674fd(_0x574356['result']['message']);}})[_0xa4af('0x16')](function(_0x4cf37a){logger[_0xa4af('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x40f3a5,_0x4cf37a);_0x4a8ea7(_0x4cf37a);});});}