Built motion from commit (unavailable).|2.4.17
[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 _0xc73a=['request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x241de0,_0x5389bc){var _0x55b150=function(_0x340272){while(--_0x340272){_0x241de0['push'](_0x241de0['shift']());}};_0x55b150(++_0x5389bc);}(_0xc73a,0x1c4));var _0xac73=function(_0x1f9166,_0x3d5426){_0x1f9166=_0x1f9166-0x0;var _0x5200a8=_0xc73a[_0x1f9166];return _0x5200a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac73('0x0'));var BPromise=require(_0xac73('0x1'));var rs=require(_0xac73('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac73('0x3'))['db'];var utils=require(_0xac73('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xac73('0x5'));var jayson=require(_0xac73('0x6'));var client=jayson[_0xac73('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1afb8f,_0x25b936,_0x2fce1f){return new BPromise(function(_0x390a6a,_0x372c37){return client[_0xac73('0x8')](_0x1afb8f,_0x2fce1f)[_0xac73('0x9')](function(_0x59a8fb){logger[_0xac73('0xa')](_0xac73('0xb'),_0x25b936,'request\x20sent');logger[_0xac73('0xc')](_0xac73('0xd'),_0x25b936,_0xac73('0xe'),JSON[_0xac73('0xf')](_0x59a8fb));if(_0x59a8fb[_0xac73('0x10')]){if(_0x59a8fb['error'][_0xac73('0x11')]===0x1f4){logger[_0xac73('0x10')](_0xac73('0xb'),_0x25b936,_0x59a8fb[_0xac73('0x10')]['message']);return _0x372c37(_0x59a8fb[_0xac73('0x10')]['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x25b936,_0x59a8fb[_0xac73('0x10')][_0xac73('0x12')]);return _0x390a6a(_0x59a8fb[_0xac73('0x10')][_0xac73('0x12')]);}else{logger[_0xac73('0xa')]('VoiceContext,\x20%s,\x20%s',_0x25b936,'request\x20sent');_0x390a6a(_0x59a8fb[_0xac73('0x13')][_0xac73('0x12')]);}})['catch'](function(_0xa937a5){logger['error'](_0xac73('0xb'),_0x25b936,_0xa937a5);_0x372c37(_0xa937a5);});});}