567a75c591aa6deb4319b96dbe806d825d2f67a0
[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 _0x1950=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','request\x20sent','debug'];(function(_0x378ce2,_0x489661){var _0x12e8dc=function(_0x5acadb){while(--_0x5acadb){_0x378ce2['push'](_0x378ce2['shift']());}};_0x12e8dc(++_0x489661);}(_0x1950,0x1bf));var _0x0195=function(_0x4db7a5,_0x44d702){_0x4db7a5=_0x4db7a5-0x0;var _0x5ccc62=_0x1950[_0x4db7a5];return _0x5ccc62;};'use strict';var _=require('lodash');var util=require(_0x0195('0x0'));var moment=require('moment');var BPromise=require(_0x0195('0x1'));var rs=require(_0x0195('0x2'));var fs=require('fs');var Redis=require(_0x0195('0x3'));var db=require(_0x0195('0x4'))['db'];var utils=require(_0x0195('0x5'));var logger=require(_0x0195('0x6'))('rpc');var config=require(_0x0195('0x7'));var jayson=require(_0x0195('0x8'));var client=jayson['client'][_0x0195('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26d0ae,_0x597eb1,_0x1d73d8){return new BPromise(function(_0x1d5c28,_0x381b81){return client['request'](_0x26d0ae,_0x1d73d8)[_0x0195('0xa')](function(_0x343c9d){logger['info']('VoiceContext,\x20%s,\x20%s',_0x597eb1,_0x0195('0xb'));logger[_0x0195('0xc')](_0x0195('0xd'),_0x597eb1,_0x0195('0xb'),JSON[_0x0195('0xe')](_0x343c9d));if(_0x343c9d[_0x0195('0xf')]){if(_0x343c9d[_0x0195('0xf')][_0x0195('0x10')]===0x1f4){logger[_0x0195('0xf')](_0x0195('0x11'),_0x597eb1,_0x343c9d['error'][_0x0195('0x12')]);return _0x381b81(_0x343c9d[_0x0195('0xf')][_0x0195('0x12')]);}logger[_0x0195('0xf')]('VoiceContext,\x20%s,\x20%s',_0x597eb1,_0x343c9d[_0x0195('0xf')][_0x0195('0x12')]);return _0x1d5c28(_0x343c9d['error']['message']);}else{logger['info'](_0x0195('0x11'),_0x597eb1,_0x0195('0xb'));_0x1d5c28(_0x343c9d['result'][_0x0195('0x12')]);}})[_0x0195('0x13')](function(_0x4eef40){logger[_0x0195('0xf')](_0x0195('0x11'),_0x597eb1,_0x4eef40);_0x381b81(_0x4eef40);});});}