Built motion from commit 1fa89557.|2.6.10
[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 _0x39aa=['VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then'];(function(_0x1598e8,_0x5df7a7){var _0x1f71da=function(_0x4a2f0a){while(--_0x4a2f0a){_0x1598e8['push'](_0x1598e8['shift']());}};_0x1f71da(++_0x5df7a7);}(_0x39aa,0x11b));var _0xa39a=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0x39aa[_0x380a3f];return _0x2b4eca;};'use strict';var _=require(_0xa39a('0x0'));var util=require(_0xa39a('0x1'));var moment=require('moment');var BPromise=require(_0xa39a('0x2'));var rs=require(_0xa39a('0x3'));var fs=require('fs');var Redis=require(_0xa39a('0x4'));var db=require(_0xa39a('0x5'))['db'];var utils=require(_0xa39a('0x6'));var logger=require(_0xa39a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa39a('0x8')][_0xa39a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ab0fe,_0x229a62,_0xfd86fe){return new BPromise(function(_0x1106eb,_0xfba40){return client['request'](_0x2ab0fe,_0xfd86fe)[_0xa39a('0xa')](function(_0x50f3dc){logger['info'](_0xa39a('0xb'),_0x229a62,'request\x20sent');logger['debug'](_0xa39a('0xc'),_0x229a62,_0xa39a('0xd'),JSON[_0xa39a('0xe')](_0x50f3dc));if(_0x50f3dc[_0xa39a('0xf')]){if(_0x50f3dc[_0xa39a('0xf')][_0xa39a('0x10')]===0x1f4){logger[_0xa39a('0xf')](_0xa39a('0xb'),_0x229a62,_0x50f3dc[_0xa39a('0xf')]['message']);return _0xfba40(_0x50f3dc['error'][_0xa39a('0x11')]);}logger[_0xa39a('0xf')]('VoiceContext,\x20%s,\x20%s',_0x229a62,_0x50f3dc[_0xa39a('0xf')]['message']);return _0x1106eb(_0x50f3dc[_0xa39a('0xf')]['message']);}else{logger[_0xa39a('0x12')]('VoiceContext,\x20%s,\x20%s',_0x229a62,_0xa39a('0xd'));_0x1106eb(_0x50f3dc[_0xa39a('0x13')][_0xa39a('0x11')]);}})[_0xa39a('0x14')](function(_0x3ae5ca){logger[_0xa39a('0xf')]('VoiceContext,\x20%s,\x20%s',_0x229a62,_0x3ae5ca);_0xfba40(_0x3ae5ca);});});}