Built motion from commit da24aabd.|2.6.20
[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 _0x56a4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2bb9b3,_0x1d2c25){var _0x601b6=function(_0x4f8d09){while(--_0x4f8d09){_0x2bb9b3['push'](_0x2bb9b3['shift']());}};_0x601b6(++_0x1d2c25);}(_0x56a4,0x73));var _0x456a=function(_0x4f8886,_0x9be826){_0x4f8886=_0x4f8886-0x0;var _0x3c49e4=_0x56a4[_0x4f8886];return _0x3c49e4;};'use strict';var _=require('lodash');var util=require(_0x456a('0x0'));var moment=require(_0x456a('0x1'));var BPromise=require(_0x456a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x456a('0x3'))['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson[_0x456a('0x9')][_0x456a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f7f60,_0x490cbc,_0x13d017){return new BPromise(function(_0x4a78f9,_0x4f815b){return client[_0x456a('0xb')](_0x4f7f60,_0x13d017)['then'](function(_0x317f3e){logger[_0x456a('0xc')](_0x456a('0xd'),_0x490cbc,_0x456a('0xe'));logger[_0x456a('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x490cbc,_0x456a('0xe'),JSON['stringify'](_0x317f3e));if(_0x317f3e['error']){if(_0x317f3e[_0x456a('0x10')][_0x456a('0x11')]===0x1f4){logger[_0x456a('0x10')](_0x456a('0xd'),_0x490cbc,_0x317f3e[_0x456a('0x10')][_0x456a('0x12')]);return _0x4f815b(_0x317f3e[_0x456a('0x10')]['message']);}logger[_0x456a('0x10')]('VoiceContext,\x20%s,\x20%s',_0x490cbc,_0x317f3e[_0x456a('0x10')]['message']);return _0x4a78f9(_0x317f3e[_0x456a('0x10')]['message']);}else{logger[_0x456a('0xc')]('VoiceContext,\x20%s,\x20%s',_0x490cbc,_0x456a('0xe'));_0x4a78f9(_0x317f3e['result'][_0x456a('0x12')]);}})[_0x456a('0x13')](function(_0x280952){logger[_0x456a('0x10')]('VoiceContext,\x20%s,\x20%s',_0x490cbc,_0x280952);_0x4f815b(_0x280952);});});}