08bf3abbee8bcef35d9a8d077ea865e7053e62e7
[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 _0x87a2=['../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','stringify','code','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x418cbb,_0x50d41e){var _0x2f13ae=function(_0x4124f4){while(--_0x4124f4){_0x418cbb['push'](_0x418cbb['shift']());}};_0x2f13ae(++_0x50d41e);}(_0x87a2,0x14a));var _0x287a=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x87a2[_0x148879];return _0x4f7027;};'use strict';var _=require(_0x287a('0x0'));var util=require(_0x287a('0x1'));var moment=require(_0x287a('0x2'));var BPromise=require('bluebird');var rs=require(_0x287a('0x3'));var fs=require('fs');var Redis=require(_0x287a('0x4'));var db=require(_0x287a('0x5'))['db'];var utils=require(_0x287a('0x6'));var logger=require(_0x287a('0x7'))(_0x287a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x287a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24d941,_0x268463,_0x1a7bc5){return new BPromise(function(_0x4e1235,_0x585723){return client['request'](_0x24d941,_0x1a7bc5)[_0x287a('0xa')](function(_0x225cc0){logger[_0x287a('0xb')]('VoiceContext,\x20%s,\x20%s',_0x268463,_0x287a('0xc'));logger[_0x287a('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x268463,_0x287a('0xc'),JSON[_0x287a('0xe')](_0x225cc0));if(_0x225cc0['error']){if(_0x225cc0['error'][_0x287a('0xf')]===0x1f4){logger[_0x287a('0x10')](_0x287a('0x11'),_0x268463,_0x225cc0['error']['message']);return _0x585723(_0x225cc0['error'][_0x287a('0x12')]);}logger[_0x287a('0x10')](_0x287a('0x11'),_0x268463,_0x225cc0[_0x287a('0x10')]['message']);return _0x4e1235(_0x225cc0[_0x287a('0x10')][_0x287a('0x12')]);}else{logger[_0x287a('0xb')](_0x287a('0x11'),_0x268463,_0x287a('0xc'));_0x4e1235(_0x225cc0[_0x287a('0x13')]['message']);}})[_0x287a('0x14')](function(_0x3aa35f){logger[_0x287a('0x10')](_0x287a('0x11'),_0x268463,_0x3aa35f);_0x585723(_0x3aa35f);});});}