8d80e6acf9e436d084212de1565a87a086aa815b
[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 _0x01a5=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch'];(function(_0x25fb13,_0x97d44d){var _0x5ca820=function(_0x23bfbf){while(--_0x23bfbf){_0x25fb13['push'](_0x25fb13['shift']());}};_0x5ca820(++_0x97d44d);}(_0x01a5,0xf2));var _0x501a=function(_0x26c8ba,_0x29029e){_0x26c8ba=_0x26c8ba-0x0;var _0x22cb6d=_0x01a5[_0x26c8ba];return _0x22cb6d;};'use strict';var _=require(_0x501a('0x0'));var util=require(_0x501a('0x1'));var moment=require(_0x501a('0x2'));var BPromise=require(_0x501a('0x3'));var rs=require(_0x501a('0x4'));var fs=require('fs');var Redis=require(_0x501a('0x5'));var db=require(_0x501a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x501a('0x7'))(_0x501a('0x8'));var config=require(_0x501a('0x9'));var jayson=require(_0x501a('0xa'));var client=jayson['client'][_0x501a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54f83a,_0x4c6238,_0x2b008b){return new BPromise(function(_0x486df7,_0x455ee3){return client['request'](_0x54f83a,_0x2b008b)[_0x501a('0xc')](function(_0x24e294){logger['info'](_0x501a('0xd'),_0x4c6238,_0x501a('0xe'));logger[_0x501a('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4c6238,_0x501a('0xe'),JSON[_0x501a('0x10')](_0x24e294));if(_0x24e294[_0x501a('0x11')]){if(_0x24e294[_0x501a('0x11')]['code']===0x1f4){logger[_0x501a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x4c6238,_0x24e294['error'][_0x501a('0x12')]);return _0x455ee3(_0x24e294['error'][_0x501a('0x12')]);}logger['error'](_0x501a('0xd'),_0x4c6238,_0x24e294[_0x501a('0x11')][_0x501a('0x12')]);return _0x486df7(_0x24e294[_0x501a('0x11')][_0x501a('0x12')]);}else{logger[_0x501a('0x13')](_0x501a('0xd'),_0x4c6238,_0x501a('0xe'));_0x486df7(_0x24e294[_0x501a('0x14')]['message']);}})[_0x501a('0x15')](function(_0x34f2e7){logger[_0x501a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x4c6238,_0x34f2e7);_0x455ee3(_0x34f2e7);});});}