c4840a8fc8295fe6d5dba964e4b94e7664a4a42b
[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 _0xcd31=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd31,0x15d));var _0x1cd3=function(_0x2bc68d,_0x3f3aae){_0x2bc68d=_0x2bc68d-0x0;var _0x14ed49=_0xcd31[_0x2bc68d];return _0x14ed49;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require(_0x1cd3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd3('0x3'));var db=require(_0x1cd3('0x4'))['db'];var utils=require(_0x1cd3('0x5'));var logger=require(_0x1cd3('0x6'))(_0x1cd3('0x7'));var config=require(_0x1cd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1cd3('0x9')][_0x1cd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xedb6d1,_0x49d849,_0x45cc24){return new BPromise(function(_0x11b139,_0x124659){return client['request'](_0xedb6d1,_0x45cc24)[_0x1cd3('0xb')](function(_0x3953d3){logger[_0x1cd3('0xc')](_0x1cd3('0xd'),_0x49d849,_0x1cd3('0xe'));logger[_0x1cd3('0xf')](_0x1cd3('0x10'),_0x49d849,'request\x20sent',JSON[_0x1cd3('0x11')](_0x3953d3));if(_0x3953d3[_0x1cd3('0x12')]){if(_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x13')]===0x1f4){logger['error'](_0x1cd3('0xd'),_0x49d849,_0x3953d3['error'][_0x1cd3('0x14')]);return _0x124659(_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x14')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x49d849,_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x14')]);return _0x11b139(_0x3953d3[_0x1cd3('0x12')]['message']);}else{logger[_0x1cd3('0xc')](_0x1cd3('0xd'),_0x49d849,_0x1cd3('0xe'));_0x11b139(_0x3953d3[_0x1cd3('0x15')]['message']);}})['catch'](function(_0x5531c5){logger['error']('VoiceContext,\x20%s,\x20%s',_0x49d849,_0x5531c5);_0x124659(_0x5531c5);});});}