473933943a150287fc9618b0611248734ef8d99f
[motion2.git] / server / services / routing / client.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 _0xf977=['jayson/promise','bluebird','routing','client','request','debug','error','rpc','message','catch'];(function(_0x4494bd,_0x5d4c66){var _0x49ede9=function(_0x360670){while(--_0x360670){_0x4494bd['push'](_0x4494bd['shift']());}};_0x49ede9(++_0x5d4c66);}(_0xf977,0x1ea));var _0x7f97=function(_0x4b9c55,_0x4b54a2){_0x4b9c55=_0x4b9c55-0x0;var _0x2758ca=_0xf977[_0x4b9c55];return _0x2758ca;};'use strict';var jayson=require(_0x7f97('0x0'));var BPromise=require(_0x7f97('0x1'));var logger=require('../../config/logger')(_0x7f97('0x2'));var client=jayson[_0x7f97('0x3')]['http']({'port':0x2329});client['Request']=function(_0x497337,_0x3cba96){return new BPromise(function(_0x1d3eaa,_0x4f583f){return client[_0x7f97('0x4')](_0x497337,_0x3cba96)['then'](function(_0x13a5bb){logger[_0x7f97('0x5')]('rpc',_0x7f97('0x2'),_0x497337,_0x3cba96,_0x13a5bb);if(_0x13a5bb[_0x7f97('0x6')]){logger['error'](_0x7f97('0x7'),'routing',_0x497337,_0x13a5bb['error'][_0x7f97('0x8')],_0x3cba96);return _0x4f583f(_0x13a5bb[_0x7f97('0x6')][_0x7f97('0x8')]);}else{return _0x1d3eaa(_0x13a5bb['result']);}})[_0x7f97('0x9')](function(_0x1f4894){logger[_0x7f97('0x6')](_0x7f97('0x7'),'routing',_0x497337,_0x1f4894,_0x3cba96);return _0x4f583f(_0x1f4894);});});};module['exports']=client;