Built motion from commit e0fa946e.|2.6.5
[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 _0x5ed9=['defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5ed9[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});config[_0x95ed('0xa')]=_[_0x95ed('0xb')](config[_0x95ed('0xa')],{'host':_0x95ed('0xc'),'port':0x18eb});var socket=require(_0x95ed('0xd'))(new Redis(config[_0x95ed('0xa')]));require('./voicePrefix.socket')[_0x95ed('0xe')](socket);function respondWithRpcPromise(_0x2e1994,_0x295fd7,_0x49d6dc){return new BPromise(function(_0x435110,_0x478a34){return client[_0x95ed('0xf')](_0x2e1994,_0x49d6dc)[_0x95ed('0x10')](function(_0x2d4091){logger[_0x95ed('0x11')](_0x95ed('0x12'),_0x295fd7,'request\x20sent');logger['debug'](_0x95ed('0x13'),_0x295fd7,_0x95ed('0x14'),JSON['stringify'](_0x2d4091));if(_0x2d4091['error']){if(_0x2d4091[_0x95ed('0x15')][_0x95ed('0x16')]===0x1f4){logger[_0x95ed('0x15')](_0x95ed('0x12'),_0x295fd7,_0x2d4091['error'][_0x95ed('0x17')]);return _0x478a34(_0x2d4091[_0x95ed('0x15')][_0x95ed('0x17')]);}logger[_0x95ed('0x15')](_0x95ed('0x12'),_0x295fd7,_0x2d4091['error'][_0x95ed('0x17')]);return _0x435110(_0x2d4091['error']['message']);}else{logger['info'](_0x95ed('0x12'),_0x295fd7,'request\x20sent');_0x435110(_0x2d4091[_0x95ed('0x18')][_0x95ed('0x17')]);}})['catch'](function(_0xa5a91){logger[_0x95ed('0x15')](_0x95ed('0x12'),_0x295fd7,_0xa5a91);_0x478a34(_0xa5a91);});});}