c1ee0c2cf1a9b7e26a1b2eabbf72a2cb52586231
[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 _0x361a=['then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','info','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2f1d50,_0x4dfc3a){var _0x4471ca=function(_0x231ad4){while(--_0x231ad4){_0x2f1d50['push'](_0x2f1d50['shift']());}};_0x4471ca(++_0x4dfc3a);}(_0x361a,0x8e));var _0xa361=function(_0x20960c,_0x7df974){_0x20960c=_0x20960c-0x0;var _0x2de4e7=_0x361a[_0x20960c];return _0x2de4e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa361('0x0'));var rs=require(_0xa361('0x1'));var fs=require('fs');var Redis=require(_0xa361('0x2'));var db=require(_0xa361('0x3'))['db'];var utils=require(_0xa361('0x4'));var logger=require(_0xa361('0x5'))(_0xa361('0x6'));var config=require(_0xa361('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa361('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x497bff,_0xb522ea,_0x5813a5){return new BPromise(function(_0x2f9520,_0x555065){return client[_0xa361('0x9')](_0x497bff,_0x5813a5)[_0xa361('0xa')](function(_0x94daa2){logger['info']('VoiceContext,\x20%s,\x20%s',_0xb522ea,_0xa361('0xb'));logger[_0xa361('0xc')](_0xa361('0xd'),_0xb522ea,'request\x20sent',JSON[_0xa361('0xe')](_0x94daa2));if(_0x94daa2[_0xa361('0xf')]){if(_0x94daa2[_0xa361('0xf')]['code']===0x1f4){logger[_0xa361('0xf')](_0xa361('0x10'),_0xb522ea,_0x94daa2[_0xa361('0xf')][_0xa361('0x11')]);return _0x555065(_0x94daa2[_0xa361('0xf')][_0xa361('0x11')]);}logger[_0xa361('0xf')]('VoiceContext,\x20%s,\x20%s',_0xb522ea,_0x94daa2[_0xa361('0xf')][_0xa361('0x11')]);return _0x2f9520(_0x94daa2['error'][_0xa361('0x11')]);}else{logger[_0xa361('0x12')](_0xa361('0x10'),_0xb522ea,_0xa361('0xb'));_0x2f9520(_0x94daa2['result'][_0xa361('0x11')]);}})['catch'](function(_0x227747){logger[_0xa361('0xf')](_0xa361('0x10'),_0xb522ea,_0x227747);_0x555065(_0x227747);});});}