Built motion from commit 9d7072cc.|2.5.39
[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 _0x689b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','lodash','moment'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x689b,0x142));var _0xb689=function(_0x3e9c46,_0x1e7e82){_0x3e9c46=_0x3e9c46-0x0;var _0x61d175=_0x689b[_0x3e9c46];return _0x61d175;};'use strict';var _=require(_0xb689('0x0'));var util=require('util');var moment=require(_0xb689('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb689('0x2'));var db=require(_0xb689('0x3'))['db'];var utils=require(_0xb689('0x4'));var logger=require(_0xb689('0x5'))(_0xb689('0x6'));var config=require(_0xb689('0x7'));var jayson=require(_0xb689('0x8'));var client=jayson['client'][_0xb689('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ee263,_0x47752c,_0x56c6ba){return new BPromise(function(_0x6eaf58,_0x1cad3e){return client[_0xb689('0xa')](_0x5ee263,_0x56c6ba)['then'](function(_0x14ef33){logger['info']('VoiceContext,\x20%s,\x20%s',_0x47752c,_0xb689('0xb'));logger['debug'](_0xb689('0xc'),_0x47752c,'request\x20sent',JSON[_0xb689('0xd')](_0x14ef33));if(_0x14ef33[_0xb689('0xe')]){if(_0x14ef33[_0xb689('0xe')][_0xb689('0xf')]===0x1f4){logger[_0xb689('0xe')](_0xb689('0x10'),_0x47752c,_0x14ef33[_0xb689('0xe')][_0xb689('0x11')]);return _0x1cad3e(_0x14ef33[_0xb689('0xe')]['message']);}logger[_0xb689('0xe')](_0xb689('0x10'),_0x47752c,_0x14ef33[_0xb689('0xe')][_0xb689('0x11')]);return _0x6eaf58(_0x14ef33[_0xb689('0xe')][_0xb689('0x11')]);}else{logger['info'](_0xb689('0x10'),_0x47752c,_0xb689('0xb'));_0x6eaf58(_0x14ef33['result'][_0xb689('0x11')]);}})['catch'](function(_0xf950eb){logger['error']('VoiceContext,\x20%s,\x20%s',_0x47752c,_0xf950eb);_0x1cad3e(_0xf950eb);});});}