Built motion from commit e02f907f.|2.6.14
[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 _0x659e=['jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/environment'];(function(_0x12fb37,_0x260e13){var _0x2b2e56=function(_0x5f4060){while(--_0x5f4060){_0x12fb37['push'](_0x12fb37['shift']());}};_0x2b2e56(++_0x260e13);}(_0x659e,0x117));var _0xe659=function(_0x3c9aef,_0x5d85f3){_0x3c9aef=_0x3c9aef-0x0;var _0x47c0dd=_0x659e[_0x3c9aef];return _0x47c0dd;};'use strict';var _=require(_0xe659('0x0'));var util=require('util');var moment=require(_0xe659('0x1'));var BPromise=require(_0xe659('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe659('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe659('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe659('0x5'));var jayson=require(_0xe659('0x6'));var client=jayson['client'][_0xe659('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51babb,_0x1a077b,_0x3207ea){return new BPromise(function(_0x8a8cc3,_0x2057cc){return client[_0xe659('0x8')](_0x51babb,_0x3207ea)[_0xe659('0x9')](function(_0x55c8df){logger[_0xe659('0xa')](_0xe659('0xb'),_0x1a077b,_0xe659('0xc'));logger[_0xe659('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1a077b,_0xe659('0xc'),JSON[_0xe659('0xe')](_0x55c8df));if(_0x55c8df[_0xe659('0xf')]){if(_0x55c8df[_0xe659('0xf')][_0xe659('0x10')]===0x1f4){logger['error'](_0xe659('0xb'),_0x1a077b,_0x55c8df[_0xe659('0xf')][_0xe659('0x11')]);return _0x2057cc(_0x55c8df[_0xe659('0xf')][_0xe659('0x11')]);}logger[_0xe659('0xf')](_0xe659('0xb'),_0x1a077b,_0x55c8df[_0xe659('0xf')][_0xe659('0x11')]);return _0x8a8cc3(_0x55c8df[_0xe659('0xf')][_0xe659('0x11')]);}else{logger[_0xe659('0xa')](_0xe659('0xb'),_0x1a077b,'request\x20sent');_0x8a8cc3(_0x55c8df['result'][_0xe659('0x11')]);}})[_0xe659('0x12')](function(_0x26e2e4){logger[_0xe659('0xf')]('VoiceContext,\x20%s,\x20%s',_0x1a077b,_0x26e2e4);_0x2057cc(_0x26e2e4);});});}