Built motion from commit 10af8726.|2.6.34
[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 _0x4248=['result','rpc','exports','../../config/logger','routing','client','request','then','debug','error','message'];(function(_0x158705,_0x492c09){var _0x2d2edd=function(_0x1dbf8e){while(--_0x1dbf8e){_0x158705['push'](_0x158705['shift']());}};_0x2d2edd(++_0x492c09);}(_0x4248,0x87));var _0x8424=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x4248[_0x3c487b];return _0x1d65f6;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x8424('0x0'))(_0x8424('0x1'));var client=jayson[_0x8424('0x2')]['http']({'port':0x2329});client['Request']=function(_0x431efc,_0x326f2d){return new BPromise(function(_0x4afd37,_0x227a4a){return client[_0x8424('0x3')](_0x431efc,_0x326f2d)[_0x8424('0x4')](function(_0x13d7b5){logger[_0x8424('0x5')]('rpc',_0x8424('0x1'),_0x431efc,_0x326f2d,_0x13d7b5);if(_0x13d7b5[_0x8424('0x6')]){logger[_0x8424('0x6')]('rpc','routing',_0x431efc,_0x13d7b5[_0x8424('0x6')][_0x8424('0x7')],_0x326f2d);return _0x227a4a(_0x13d7b5[_0x8424('0x6')]['message']);}else{return _0x4afd37(_0x13d7b5[_0x8424('0x8')]);}})['catch'](function(_0x3c0e29){logger[_0x8424('0x6')](_0x8424('0x9'),'routing',_0x431efc,_0x3c0e29,_0x326f2d);return _0x227a4a(_0x3c0e29);});});};module[_0x8424('0xa')]=client;