Built motion from commit 4c579f6b.|2.5.32
[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 _0xaf4c=['../../config/environment','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4490b6,_0x345b80){var _0x5cb065=function(_0x13cc96){while(--_0x13cc96){_0x4490b6['push'](_0x4490b6['shift']());}};_0x5cb065(++_0x345b80);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0xb20b29,_0x3db0e4){_0xb20b29=_0xb20b29-0x0;var _0x5669c3=_0xaf4c[_0xb20b29];return _0x5669c3;};'use strict';var _=require('lodash');var util=require(_0xcaf4('0x0'));var moment=require(_0xcaf4('0x1'));var BPromise=require('bluebird');var rs=require(_0xcaf4('0x2'));var fs=require('fs');var Redis=require(_0xcaf4('0x3'));var db=require(_0xcaf4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaf4('0x5'))(_0xcaf4('0x6'));var config=require(_0xcaf4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcaf4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3de3af,_0x1dc542,_0xa95ea2){return new BPromise(function(_0x3380fa,_0x3a604b){return client[_0xcaf4('0x9')](_0x3de3af,_0xa95ea2)['then'](function(_0x5af977){logger[_0xcaf4('0xa')](_0xcaf4('0xb'),_0x1dc542,_0xcaf4('0xc'));logger[_0xcaf4('0xd')](_0xcaf4('0xe'),_0x1dc542,_0xcaf4('0xc'),JSON[_0xcaf4('0xf')](_0x5af977));if(_0x5af977[_0xcaf4('0x10')]){if(_0x5af977[_0xcaf4('0x10')]['code']===0x1f4){logger[_0xcaf4('0x10')](_0xcaf4('0xb'),_0x1dc542,_0x5af977['error'][_0xcaf4('0x11')]);return _0x3a604b(_0x5af977[_0xcaf4('0x10')][_0xcaf4('0x11')]);}logger['error'](_0xcaf4('0xb'),_0x1dc542,_0x5af977[_0xcaf4('0x10')]['message']);return _0x3380fa(_0x5af977[_0xcaf4('0x10')]['message']);}else{logger[_0xcaf4('0xa')](_0xcaf4('0xb'),_0x1dc542,_0xcaf4('0xc'));_0x3380fa(_0x5af977[_0xcaf4('0x12')][_0xcaf4('0x11')]);}})[_0xcaf4('0x13')](function(_0x4d2817){logger[_0xcaf4('0x10')]('VoiceContext,\x20%s,\x20%s',_0x1dc542,_0x4d2817);_0x3a604b(_0x4d2817);});});}