Built motion from commit 775e2a94.|2.6.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 _0x84c6=['request\x20sent','error','code','message','info','result','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x3cbe5f,_0x32b366){var _0x2a1a06=function(_0x4884e6){while(--_0x4884e6){_0x3cbe5f['push'](_0x3cbe5f['shift']());}};_0x2a1a06(++_0x32b366);}(_0x84c6,0xe7));var _0x684c=function(_0x2626d6,_0x31a009){_0x2626d6=_0x2626d6-0x0;var _0x510e0e=_0x84c6[_0x2626d6];return _0x510e0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x684c('0x0'));var BPromise=require(_0x684c('0x1'));var rs=require(_0x684c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x684c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x684c('0x4'))(_0x684c('0x5'));var config=require(_0x684c('0x6'));var jayson=require(_0x684c('0x7'));var client=jayson[_0x684c('0x8')][_0x684c('0x9')]({'port':0x232a});config[_0x684c('0xa')]=_[_0x684c('0xb')](config[_0x684c('0xa')],{'host':_0x684c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x684c('0xa')]));require(_0x684c('0xd'))['register'](socket);function respondWithRpcPromise(_0x764ffa,_0x51c50b,_0x2049a3){return new BPromise(function(_0x35bbc9,_0x25af75){return client[_0x684c('0xe')](_0x764ffa,_0x2049a3)[_0x684c('0xf')](function(_0x5dc55e){logger['info'](_0x684c('0x10'),_0x51c50b,'request\x20sent');logger[_0x684c('0x11')](_0x684c('0x12'),_0x51c50b,_0x684c('0x13'),JSON['stringify'](_0x5dc55e));if(_0x5dc55e[_0x684c('0x14')]){if(_0x5dc55e['error'][_0x684c('0x15')]===0x1f4){logger[_0x684c('0x14')](_0x684c('0x10'),_0x51c50b,_0x5dc55e[_0x684c('0x14')][_0x684c('0x16')]);return _0x25af75(_0x5dc55e[_0x684c('0x14')][_0x684c('0x16')]);}logger[_0x684c('0x14')](_0x684c('0x10'),_0x51c50b,_0x5dc55e['error'][_0x684c('0x16')]);return _0x35bbc9(_0x5dc55e['error']['message']);}else{logger[_0x684c('0x17')](_0x684c('0x10'),_0x51c50b,_0x684c('0x13'));_0x35bbc9(_0x5dc55e[_0x684c('0x18')][_0x684c('0x16')]);}})['catch'](function(_0x3f9968){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x51c50b,_0x3f9968);_0x25af75(_0x3f9968);});});}