30cfe4b1aece40a6b12e2bbf42e66d575894aa52
[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 _0xf828=['message','result','catch','exports','jayson/promise','../../config/logger','routing','client','then','debug','rpc','error'];(function(_0x343a85,_0x22aa4f){var _0x53cb93=function(_0x316086){while(--_0x316086){_0x343a85['push'](_0x343a85['shift']());}};_0x53cb93(++_0x22aa4f);}(_0xf828,0x118));var _0x8f82=function(_0x4e021d,_0x4d2039){_0x4e021d=_0x4e021d-0x0;var _0xd07182=_0xf828[_0x4e021d];return _0xd07182;};'use strict';var jayson=require(_0x8f82('0x0'));var BPromise=require('bluebird');var logger=require(_0x8f82('0x1'))(_0x8f82('0x2'));var client=jayson[_0x8f82('0x3')]['http']({'port':0x2329});client['Request']=function(_0x261464,_0x2cd093){return new BPromise(function(_0xeb69c1,_0x4a16f8){return client['request'](_0x261464,_0x2cd093)[_0x8f82('0x4')](function(_0x2dbf07){logger[_0x8f82('0x5')](_0x8f82('0x6'),_0x8f82('0x2'),_0x261464,_0x2cd093,_0x2dbf07);if(_0x2dbf07['error']){logger['error']('rpc','routing',_0x261464,_0x2dbf07[_0x8f82('0x7')][_0x8f82('0x8')],_0x2cd093);return _0x4a16f8(_0x2dbf07[_0x8f82('0x7')]['message']);}else{return _0xeb69c1(_0x2dbf07[_0x8f82('0x9')]);}})[_0x8f82('0xa')](function(_0x427001){logger['error'](_0x8f82('0x6'),_0x8f82('0x2'),_0x261464,_0x427001,_0x2cd093);return _0x4a16f8(_0x427001);});});};module[_0x8f82('0xb')]=client;