c260d5534b4cbf2df54486be0bf6fb757914b412
[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 _0xbaca=['jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbaca,0xfc));var _0xabac=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0xbaca[_0x48c4ef];return _0x435715;};'use strict';var _=require(_0xabac('0x0'));var util=require(_0xabac('0x1'));var moment=require('moment');var BPromise=require(_0xabac('0x2'));var rs=require(_0xabac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xabac('0x5'))(_0xabac('0x6'));var config=require(_0xabac('0x7'));var jayson=require(_0xabac('0x8'));var client=jayson[_0xabac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe9ff,_0x2e7faa,_0x683dde){return new BPromise(function(_0x4fa18f,_0x5b6f00){return client[_0xabac('0xa')](_0x4fe9ff,_0x683dde)[_0xabac('0xb')](function(_0x42f38a){logger['info'](_0xabac('0xc'),_0x2e7faa,_0xabac('0xd'));logger['debug'](_0xabac('0xe'),_0x2e7faa,'request\x20sent',JSON[_0xabac('0xf')](_0x42f38a));if(_0x42f38a[_0xabac('0x10')]){if(_0x42f38a[_0xabac('0x10')]['code']===0x1f4){logger[_0xabac('0x10')](_0xabac('0xc'),_0x2e7faa,_0x42f38a[_0xabac('0x10')]['message']);return _0x5b6f00(_0x42f38a['error']['message']);}logger[_0xabac('0x10')](_0xabac('0xc'),_0x2e7faa,_0x42f38a[_0xabac('0x10')][_0xabac('0x11')]);return _0x4fa18f(_0x42f38a['error'][_0xabac('0x11')]);}else{logger[_0xabac('0x12')](_0xabac('0xc'),_0x2e7faa,_0xabac('0xd'));_0x4fa18f(_0x42f38a['result'][_0xabac('0x11')]);}})[_0xabac('0x13')](function(_0x8f07d4){logger[_0xabac('0x10')](_0xabac('0xc'),_0x2e7faa,_0x8f07d4);_0x5b6f00(_0x8f07d4);});});}