81ee44e6a11a3437cefa913fa6ecd10d68037801
[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 _0xa887=['rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38a56d,_0x447f6d){var _0x2594eb=function(_0x358bcb){while(--_0x358bcb){_0x38a56d['push'](_0x38a56d['shift']());}};_0x2594eb(++_0x447f6d);}(_0xa887,0x89));var _0x7a88=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa887[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x7a88('0x0'));var util=require('util');var moment=require(_0x7a88('0x1'));var BPromise=require(_0x7a88('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a88('0x3'));var db=require(_0x7a88('0x4'))['db'];var utils=require(_0x7a88('0x5'));var logger=require(_0x7a88('0x6'))(_0x7a88('0x7'));var config=require(_0x7a88('0x8'));var jayson=require(_0x7a88('0x9'));var client=jayson[_0x7a88('0xa')][_0x7a88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52edce,_0x3a49be,_0x2d0445){return new BPromise(function(_0x5d7a48,_0x34f335){return client['request'](_0x52edce,_0x2d0445)[_0x7a88('0xc')](function(_0x179388){logger[_0x7a88('0xd')]('VoiceContext,\x20%s,\x20%s',_0x3a49be,'request\x20sent');logger[_0x7a88('0xe')](_0x7a88('0xf'),_0x3a49be,_0x7a88('0x10'),JSON[_0x7a88('0x11')](_0x179388));if(_0x179388[_0x7a88('0x12')]){if(_0x179388[_0x7a88('0x12')][_0x7a88('0x13')]===0x1f4){logger[_0x7a88('0x12')]('VoiceContext,\x20%s,\x20%s',_0x3a49be,_0x179388[_0x7a88('0x12')]['message']);return _0x34f335(_0x179388[_0x7a88('0x12')][_0x7a88('0x14')]);}logger[_0x7a88('0x12')](_0x7a88('0x15'),_0x3a49be,_0x179388['error'][_0x7a88('0x14')]);return _0x5d7a48(_0x179388['error'][_0x7a88('0x14')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3a49be,'request\x20sent');_0x5d7a48(_0x179388[_0x7a88('0x16')]['message']);}})[_0x7a88('0x17')](function(_0x71c7b9){logger[_0x7a88('0x12')](_0x7a88('0x15'),_0x3a49be,_0x71c7b9);_0x34f335(_0x71c7b9);});});}