1121bbf63d79dacc58202752155047f857be8e63
[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 _0xf793=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb'];(function(_0x328111,_0x1c3a1c){var _0x3f676c=function(_0x583ebc){while(--_0x583ebc){_0x328111['push'](_0x328111['shift']());}};_0x3f676c(++_0x1c3a1c);}(_0xf793,0x1ac));var _0x3f79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf793[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x3f79('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3f79('0x1'));var fs=require('fs');var Redis=require(_0x3f79('0x2'));var db=require(_0x3f79('0x3'))['db'];var utils=require(_0x3f79('0x4'));var logger=require(_0x3f79('0x5'))(_0x3f79('0x6'));var config=require(_0x3f79('0x7'));var jayson=require(_0x3f79('0x8'));var client=jayson[_0x3f79('0x9')][_0x3f79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x571a80,_0x562431,_0x5c52a5){return new BPromise(function(_0x5f4ddc,_0x5d64d8){return client[_0x3f79('0xb')](_0x571a80,_0x5c52a5)[_0x3f79('0xc')](function(_0x1bbf9f){logger[_0x3f79('0xd')](_0x3f79('0xe'),_0x562431,_0x3f79('0xf'));logger[_0x3f79('0x10')](_0x3f79('0x11'),_0x562431,_0x3f79('0xf'),JSON[_0x3f79('0x12')](_0x1bbf9f));if(_0x1bbf9f[_0x3f79('0x13')]){if(_0x1bbf9f['error'][_0x3f79('0x14')]===0x1f4){logger['error'](_0x3f79('0xe'),_0x562431,_0x1bbf9f[_0x3f79('0x13')][_0x3f79('0x15')]);return _0x5d64d8(_0x1bbf9f[_0x3f79('0x13')][_0x3f79('0x15')]);}logger[_0x3f79('0x13')](_0x3f79('0xe'),_0x562431,_0x1bbf9f['error'][_0x3f79('0x15')]);return _0x5f4ddc(_0x1bbf9f[_0x3f79('0x13')]['message']);}else{logger['info'](_0x3f79('0xe'),_0x562431,'request\x20sent');_0x5f4ddc(_0x1bbf9f[_0x3f79('0x16')][_0x3f79('0x15')]);}})[_0x3f79('0x17')](function(_0x496537){logger[_0x3f79('0x13')]('VoiceContext,\x20%s,\x20%s',_0x562431,_0x496537);_0x5d64d8(_0x496537);});});}