48da66843bf2776f645fd2f046ff6fde465f1433
[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 _0x10a5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x10a5,0x163));var _0x510a=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x10a5[_0x2a0350];return _0x425220;};'use strict';var _=require(_0x510a('0x0'));var util=require(_0x510a('0x1'));var moment=require(_0x510a('0x2'));var BPromise=require(_0x510a('0x3'));var rs=require(_0x510a('0x4'));var fs=require('fs');var Redis=require(_0x510a('0x5'));var db=require(_0x510a('0x6'))['db'];var utils=require(_0x510a('0x7'));var logger=require(_0x510a('0x8'))(_0x510a('0x9'));var config=require(_0x510a('0xa'));var jayson=require(_0x510a('0xb'));var client=jayson[_0x510a('0xc')][_0x510a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4bdf71,_0x5a9ffa,_0x1484a1){return new BPromise(function(_0x1639dc,_0x149a3d){return client[_0x510a('0xe')](_0x4bdf71,_0x1484a1)[_0x510a('0xf')](function(_0x4737d0){logger[_0x510a('0x10')](_0x510a('0x11'),_0x5a9ffa,_0x510a('0x12'));logger['debug'](_0x510a('0x13'),_0x5a9ffa,_0x510a('0x12'),JSON['stringify'](_0x4737d0));if(_0x4737d0[_0x510a('0x14')]){if(_0x4737d0[_0x510a('0x14')][_0x510a('0x15')]===0x1f4){logger[_0x510a('0x14')](_0x510a('0x11'),_0x5a9ffa,_0x4737d0[_0x510a('0x14')][_0x510a('0x16')]);return _0x149a3d(_0x4737d0[_0x510a('0x14')]['message']);}logger[_0x510a('0x14')](_0x510a('0x11'),_0x5a9ffa,_0x4737d0['error']['message']);return _0x1639dc(_0x4737d0['error'][_0x510a('0x16')]);}else{logger[_0x510a('0x10')](_0x510a('0x11'),_0x5a9ffa,_0x510a('0x12'));_0x1639dc(_0x4737d0[_0x510a('0x17')][_0x510a('0x16')]);}})['catch'](function(_0x19f5c4){logger[_0x510a('0x14')]('VoiceContext,\x20%s,\x20%s',_0x5a9ffa,_0x19f5c4);_0x149a3d(_0x19f5c4);});});}