Built motion from commit a61a4a20.|2.5.46
[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 _0x8c51=['code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5e1aa5,_0x2046cb){var _0x44e7f3=function(_0x380261){while(--_0x380261){_0x5e1aa5['push'](_0x5e1aa5['shift']());}};_0x44e7f3(++_0x2046cb);}(_0x8c51,0x100));var _0x18c5=function(_0x3529a9,_0x471307){_0x3529a9=_0x3529a9-0x0;var _0x2afd90=_0x8c51[_0x3529a9];return _0x2afd90;};'use strict';var _=require('lodash');var util=require(_0x18c5('0x0'));var moment=require(_0x18c5('0x1'));var BPromise=require(_0x18c5('0x2'));var rs=require(_0x18c5('0x3'));var fs=require('fs');var Redis=require(_0x18c5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x18c5('0x5'));var logger=require(_0x18c5('0x6'))(_0x18c5('0x7'));var config=require(_0x18c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x18c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5de3c0,_0x15d4cd,_0x18fc19){return new BPromise(function(_0x51d7b2,_0xb3b16d){return client[_0x18c5('0xa')](_0x5de3c0,_0x18fc19)['then'](function(_0x3ae1fa){logger['info'](_0x18c5('0xb'),_0x15d4cd,_0x18c5('0xc'));logger[_0x18c5('0xd')](_0x18c5('0xe'),_0x15d4cd,_0x18c5('0xc'),JSON[_0x18c5('0xf')](_0x3ae1fa));if(_0x3ae1fa['error']){if(_0x3ae1fa[_0x18c5('0x10')][_0x18c5('0x11')]===0x1f4){logger['error'](_0x18c5('0xb'),_0x15d4cd,_0x3ae1fa['error'][_0x18c5('0x12')]);return _0xb3b16d(_0x3ae1fa[_0x18c5('0x10')]['message']);}logger[_0x18c5('0x10')](_0x18c5('0xb'),_0x15d4cd,_0x3ae1fa[_0x18c5('0x10')][_0x18c5('0x12')]);return _0x51d7b2(_0x3ae1fa['error']['message']);}else{logger[_0x18c5('0x13')](_0x18c5('0xb'),_0x15d4cd,_0x18c5('0xc'));_0x51d7b2(_0x3ae1fa[_0x18c5('0x14')][_0x18c5('0x12')]);}})['catch'](function(_0x484c9c){logger['error']('VoiceContext,\x20%s,\x20%s',_0x15d4cd,_0x484c9c);_0xb3b16d(_0x484c9c);});});}