690332f00b8a14bd78eeb5d416ecef8efbd966ae
[motion2.git] / server / api / voiceContext / voiceContext.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 _0x37ca=['then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x3e3e1f,_0x576859){var _0x2d357c=function(_0x2b4479){while(--_0x2b4479){_0x3e3e1f['push'](_0x3e3e1f['shift']());}};_0x2d357c(++_0x576859);}(_0x37ca,0x112));var _0xa37c=function(_0x30a3bb,_0x4c6979){_0x30a3bb=_0x30a3bb-0x0;var _0x4ffb15=_0x37ca[_0x30a3bb];return _0x4ffb15;};'use strict';var _=require(_0xa37c('0x0'));var util=require(_0xa37c('0x1'));var moment=require(_0xa37c('0x2'));var BPromise=require('bluebird');var rs=require(_0xa37c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa37c('0x4'))['db'];var utils=require(_0xa37c('0x5'));var logger=require(_0xa37c('0x6'))(_0xa37c('0x7'));var config=require(_0xa37c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa37c('0x9')][_0xa37c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c628f,_0xb756e9,_0xd08583){return new BPromise(function(_0x352793,_0x2dde95){return client[_0xa37c('0xb')](_0x2c628f,_0xd08583)[_0xa37c('0xc')](function(_0x933e21){logger[_0xa37c('0xd')](_0xa37c('0xe'),_0xb756e9,_0xa37c('0xf'));logger[_0xa37c('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xb756e9,_0xa37c('0xf'),JSON[_0xa37c('0x11')](_0x933e21));if(_0x933e21['error']){if(_0x933e21[_0xa37c('0x12')]['code']===0x1f4){logger[_0xa37c('0x12')](_0xa37c('0xe'),_0xb756e9,_0x933e21['error'][_0xa37c('0x13')]);return _0x2dde95(_0x933e21['error'][_0xa37c('0x13')]);}logger['error'](_0xa37c('0xe'),_0xb756e9,_0x933e21[_0xa37c('0x12')][_0xa37c('0x13')]);return _0x352793(_0x933e21[_0xa37c('0x12')][_0xa37c('0x13')]);}else{logger[_0xa37c('0xd')]('VoiceContext,\x20%s,\x20%s',_0xb756e9,_0xa37c('0xf'));_0x352793(_0x933e21[_0xa37c('0x14')][_0xa37c('0x13')]);}})[_0xa37c('0x15')](function(_0x4e0c1a){logger[_0xa37c('0x12')]('VoiceContext,\x20%s,\x20%s',_0xb756e9,_0x4e0c1a);_0x2dde95(_0x4e0c1a);});});}