Built motion from commit 9d1906d1.|2.5.40
[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 _0x223e=['../../config/logger','rpc','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa4e554,_0x3c7c10){var _0x2369cd=function(_0x2528f8){while(--_0x2528f8){_0xa4e554['push'](_0xa4e554['shift']());}};_0x2369cd(++_0x3c7c10);}(_0x223e,0x1b1));var _0xe223=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x223e[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0xe223('0x0'));var util=require(_0xe223('0x1'));var moment=require(_0xe223('0x2'));var BPromise=require('bluebird');var rs=require(_0xe223('0x3'));var fs=require('fs');var Redis=require(_0xe223('0x4'));var db=require(_0xe223('0x5'))['db'];var utils=require(_0xe223('0x6'));var logger=require(_0xe223('0x7'))(_0xe223('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe223('0x9')][_0xe223('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a8891,_0x24fdd9,_0x366d9b){return new BPromise(function(_0x4cffbb,_0x4370e1){return client[_0xe223('0xb')](_0x4a8891,_0x366d9b)[_0xe223('0xc')](function(_0x42d99a){logger[_0xe223('0xd')]('VoiceContext,\x20%s,\x20%s',_0x24fdd9,_0xe223('0xe'));logger['debug'](_0xe223('0xf'),_0x24fdd9,_0xe223('0xe'),JSON[_0xe223('0x10')](_0x42d99a));if(_0x42d99a[_0xe223('0x11')]){if(_0x42d99a[_0xe223('0x11')]['code']===0x1f4){logger[_0xe223('0x11')](_0xe223('0x12'),_0x24fdd9,_0x42d99a[_0xe223('0x11')][_0xe223('0x13')]);return _0x4370e1(_0x42d99a[_0xe223('0x11')][_0xe223('0x13')]);}logger[_0xe223('0x11')]('VoiceContext,\x20%s,\x20%s',_0x24fdd9,_0x42d99a[_0xe223('0x11')][_0xe223('0x13')]);return _0x4cffbb(_0x42d99a[_0xe223('0x11')][_0xe223('0x13')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x24fdd9,_0xe223('0xe'));_0x4cffbb(_0x42d99a['result'][_0xe223('0x13')]);}})['catch'](function(_0x746d36){logger['error']('VoiceContext,\x20%s,\x20%s',_0x24fdd9,_0x746d36);_0x4370e1(_0x746d36);});});}