Built motion from commit 639a1a7f.|2.6.19
[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 _0x2162=['error','VoiceContext,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','stringify'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x2162,0x110));var _0x2216=function(_0x39941c,_0x4ad1bb){_0x39941c=_0x39941c-0x0;var _0x52d9c7=_0x2162[_0x39941c];return _0x52d9c7;};'use strict';var _=require('lodash');var util=require(_0x2216('0x0'));var moment=require('moment');var BPromise=require(_0x2216('0x1'));var rs=require(_0x2216('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2216('0x3'))['db'];var utils=require(_0x2216('0x4'));var logger=require('../../config/logger')(_0x2216('0x5'));var config=require(_0x2216('0x6'));var jayson=require(_0x2216('0x7'));var client=jayson['client'][_0x2216('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4db005,_0x4e1280,_0x32cf2d){return new BPromise(function(_0x2fe93c,_0x2a01d1){return client[_0x2216('0x9')](_0x4db005,_0x32cf2d)['then'](function(_0x5dc257){logger['info']('VoiceContext,\x20%s,\x20%s',_0x4e1280,_0x2216('0xa'));logger[_0x2216('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4e1280,_0x2216('0xa'),JSON[_0x2216('0xc')](_0x5dc257));if(_0x5dc257[_0x2216('0xd')]){if(_0x5dc257[_0x2216('0xd')]['code']===0x1f4){logger[_0x2216('0xd')](_0x2216('0xe'),_0x4e1280,_0x5dc257[_0x2216('0xd')][_0x2216('0xf')]);return _0x2a01d1(_0x5dc257[_0x2216('0xd')][_0x2216('0xf')]);}logger[_0x2216('0xd')](_0x2216('0xe'),_0x4e1280,_0x5dc257['error'][_0x2216('0xf')]);return _0x2fe93c(_0x5dc257[_0x2216('0xd')]['message']);}else{logger[_0x2216('0x10')]('VoiceContext,\x20%s,\x20%s',_0x4e1280,_0x2216('0xa'));_0x2fe93c(_0x5dc257[_0x2216('0x11')][_0x2216('0xf')]);}})[_0x2216('0x12')](function(_0x219326){logger[_0x2216('0xd')](_0x2216('0xe'),_0x4e1280,_0x219326);_0x2a01d1(_0x219326);});});}