Built motion from commit 85328c08.|2.5.50
[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 _0xf24b=['VoiceContext,\x20%s,\x20%s','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf24b,0xad));var _0xbf24=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0xf24b[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require(_0xbf24('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf24('0x4'))['db'];var utils=require(_0xbf24('0x5'));var logger=require('../../config/logger')(_0xbf24('0x6'));var config=require(_0xbf24('0x7'));var jayson=require(_0xbf24('0x8'));var client=jayson[_0xbf24('0x9')][_0xbf24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd757,_0x10ae5f,_0x3e983e){return new BPromise(function(_0x455e1e,_0x519ad7){return client['request'](_0x4dd757,_0x3e983e)[_0xbf24('0xb')](function(_0x3a94e7){logger[_0xbf24('0xc')]('VoiceContext,\x20%s,\x20%s',_0x10ae5f,_0xbf24('0xd'));logger['debug'](_0xbf24('0xe'),_0x10ae5f,'request\x20sent',JSON['stringify'](_0x3a94e7));if(_0x3a94e7[_0xbf24('0xf')]){if(_0x3a94e7[_0xbf24('0xf')]['code']===0x1f4){logger[_0xbf24('0xf')]('VoiceContext,\x20%s,\x20%s',_0x10ae5f,_0x3a94e7[_0xbf24('0xf')][_0xbf24('0x10')]);return _0x519ad7(_0x3a94e7[_0xbf24('0xf')][_0xbf24('0x10')]);}logger['error'](_0xbf24('0x11'),_0x10ae5f,_0x3a94e7[_0xbf24('0xf')]['message']);return _0x455e1e(_0x3a94e7['error'][_0xbf24('0x10')]);}else{logger[_0xbf24('0xc')](_0xbf24('0x11'),_0x10ae5f,_0xbf24('0xd'));_0x455e1e(_0x3a94e7[_0xbf24('0x12')][_0xbf24('0x10')]);}})['catch'](function(_0x188217){logger['error'](_0xbf24('0x11'),_0x10ae5f,_0x188217);_0x519ad7(_0x188217);});});}