1e4af21ef979cc1c1f4f98f481df2d63adec0565
[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 _0xd86f=['../../config/utils','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x46ea28,_0x94368a){var _0x2ed772=function(_0x27b44e){while(--_0x27b44e){_0x46ea28['push'](_0x46ea28['shift']());}};_0x2ed772(++_0x94368a);}(_0xd86f,0xf6));var _0xfd86=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xd86f[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xfd86('0x0'));var util=require(_0xfd86('0x1'));var moment=require(_0xfd86('0x2'));var BPromise=require(_0xfd86('0x3'));var rs=require(_0xfd86('0x4'));var fs=require('fs');var Redis=require(_0xfd86('0x5'));var db=require(_0xfd86('0x6'))['db'];var utils=require(_0xfd86('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfd86('0x8'));var client=jayson[_0xfd86('0x9')][_0xfd86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52baeb,_0x4d1781,_0xa7cae3){return new BPromise(function(_0x5bf033,_0x4e5d6d){return client[_0xfd86('0xb')](_0x52baeb,_0xa7cae3)[_0xfd86('0xc')](function(_0x1a1932){logger[_0xfd86('0xd')](_0xfd86('0xe'),_0x4d1781,'request\x20sent');logger[_0xfd86('0xf')](_0xfd86('0x10'),_0x4d1781,'request\x20sent',JSON[_0xfd86('0x11')](_0x1a1932));if(_0x1a1932[_0xfd86('0x12')]){if(_0x1a1932[_0xfd86('0x12')]['code']===0x1f4){logger[_0xfd86('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4d1781,_0x1a1932['error'][_0xfd86('0x13')]);return _0x4e5d6d(_0x1a1932[_0xfd86('0x12')]['message']);}logger[_0xfd86('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4d1781,_0x1a1932[_0xfd86('0x12')][_0xfd86('0x13')]);return _0x5bf033(_0x1a1932[_0xfd86('0x12')][_0xfd86('0x13')]);}else{logger[_0xfd86('0xd')](_0xfd86('0xe'),_0x4d1781,_0xfd86('0x14'));_0x5bf033(_0x1a1932[_0xfd86('0x15')]['message']);}})[_0xfd86('0x16')](function(_0x23d34f){logger['error'](_0xfd86('0xe'),_0x4d1781,_0x23d34f);_0x4e5d6d(_0x23d34f);});});}