ca008b1528b0da1de0903db3fe44bf57211a4f03
[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 _0xa28c=['result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1ab327,_0x424250){var _0x5e43cf=function(_0xec4983){while(--_0xec4983){_0x1ab327['push'](_0x1ab327['shift']());}};_0x5e43cf(++_0x424250);}(_0xa28c,0x1e5));var _0xca28=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xa28c[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xca28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca28('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca28('0x2'))['db'];var utils=require(_0xca28('0x3'));var logger=require(_0xca28('0x4'))(_0xca28('0x5'));var config=require(_0xca28('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xca28('0x7')][_0xca28('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21f5fd,_0x149a55,_0x3300d5){return new BPromise(function(_0x27479c,_0x6834){return client[_0xca28('0x9')](_0x21f5fd,_0x3300d5)['then'](function(_0x3452e1){logger[_0xca28('0xa')](_0xca28('0xb'),_0x149a55,_0xca28('0xc'));logger[_0xca28('0xd')](_0xca28('0xe'),_0x149a55,_0xca28('0xc'),JSON[_0xca28('0xf')](_0x3452e1));if(_0x3452e1[_0xca28('0x10')]){if(_0x3452e1[_0xca28('0x10')][_0xca28('0x11')]===0x1f4){logger['error'](_0xca28('0xb'),_0x149a55,_0x3452e1[_0xca28('0x10')][_0xca28('0x12')]);return _0x6834(_0x3452e1[_0xca28('0x10')][_0xca28('0x12')]);}logger[_0xca28('0x10')](_0xca28('0xb'),_0x149a55,_0x3452e1['error'][_0xca28('0x12')]);return _0x27479c(_0x3452e1[_0xca28('0x10')][_0xca28('0x12')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x149a55,'request\x20sent');_0x27479c(_0x3452e1[_0xca28('0x13')]['message']);}})[_0xca28('0x14')](function(_0x10615e){logger['error']('VoiceContext,\x20%s,\x20%s',_0x149a55,_0x10615e);_0x6834(_0x10615e);});});}