1a194283972a96bee367d73b7b61cbd12cc138ad
[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 _0x2ac1=['rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b0ba2,_0x24842f){var _0xad2b84=function(_0x10f9cb){while(--_0x10f9cb){_0x3b0ba2['push'](_0x3b0ba2['shift']());}};_0xad2b84(++_0x24842f);}(_0x2ac1,0xa6));var _0x12ac=function(_0x319ca2,_0x45774a){_0x319ca2=_0x319ca2-0x0;var _0x243a33=_0x2ac1[_0x319ca2];return _0x243a33;};'use strict';var _=require(_0x12ac('0x0'));var util=require(_0x12ac('0x1'));var moment=require(_0x12ac('0x2'));var BPromise=require(_0x12ac('0x3'));var rs=require(_0x12ac('0x4'));var fs=require('fs');var Redis=require(_0x12ac('0x5'));var db=require(_0x12ac('0x6'))['db'];var utils=require(_0x12ac('0x7'));var logger=require(_0x12ac('0x8'))(_0x12ac('0x9'));var config=require(_0x12ac('0xa'));var jayson=require(_0x12ac('0xb'));var client=jayson[_0x12ac('0xc')][_0x12ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x6c48ef,_0x2c144a,_0x2a64cf){return new BPromise(function(_0x2e59a1,_0x3aebf6){return client['request'](_0x6c48ef,_0x2a64cf)[_0x12ac('0xe')](function(_0x4a1425){logger['info']('VoiceContext,\x20%s,\x20%s',_0x2c144a,_0x12ac('0xf'));logger[_0x12ac('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2c144a,_0x12ac('0xf'),JSON[_0x12ac('0x11')](_0x4a1425));if(_0x4a1425[_0x12ac('0x12')]){if(_0x4a1425[_0x12ac('0x12')][_0x12ac('0x13')]===0x1f4){logger['error'](_0x12ac('0x14'),_0x2c144a,_0x4a1425['error'][_0x12ac('0x15')]);return _0x3aebf6(_0x4a1425[_0x12ac('0x12')][_0x12ac('0x15')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x2c144a,_0x4a1425[_0x12ac('0x12')]['message']);return _0x2e59a1(_0x4a1425[_0x12ac('0x12')][_0x12ac('0x15')]);}else{logger[_0x12ac('0x16')](_0x12ac('0x14'),_0x2c144a,'request\x20sent');_0x2e59a1(_0x4a1425[_0x12ac('0x17')][_0x12ac('0x15')]);}})[_0x12ac('0x18')](function(_0x2c0e0e){logger[_0x12ac('0x12')]('VoiceContext,\x20%s,\x20%s',_0x2c144a,_0x2c0e0e);_0x3aebf6(_0x2c0e0e);});});}