Built motion from commit 06a208af.|2.6.26
[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 _0x11b6=['bluebird','../../config/logger','http','Request','request','then','routing','error','message','result','rpc'];(function(_0x400aac,_0x3af01c){var _0x8c3676=function(_0x537b24){while(--_0x537b24){_0x400aac['push'](_0x400aac['shift']());}};_0x8c3676(++_0x3af01c);}(_0x11b6,0x1c3));var _0x611b=function(_0x1a7d40,_0x27105c){_0x1a7d40=_0x1a7d40-0x0;var _0x408e7b=_0x11b6[_0x1a7d40];return _0x408e7b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x611b('0x0'));var logger=require(_0x611b('0x1'))('routing');var client=jayson['client'][_0x611b('0x2')]({'port':0x2329});client[_0x611b('0x3')]=function(_0x4d99f2,_0x977b54){return new BPromise(function(_0xecfcb4,_0x5eef60){return client[_0x611b('0x4')](_0x4d99f2,_0x977b54)[_0x611b('0x5')](function(_0x2b5281){logger['debug']('rpc',_0x611b('0x6'),_0x4d99f2,_0x977b54,_0x2b5281);if(_0x2b5281[_0x611b('0x7')]){logger[_0x611b('0x7')]('rpc','routing',_0x4d99f2,_0x2b5281['error']['message'],_0x977b54);return _0x5eef60(_0x2b5281[_0x611b('0x7')][_0x611b('0x8')]);}else{return _0xecfcb4(_0x2b5281[_0x611b('0x9')]);}})['catch'](function(_0x4c3943){logger[_0x611b('0x7')](_0x611b('0xa'),_0x611b('0x6'),_0x4d99f2,_0x4c3943,_0x977b54);return _0x5eef60(_0x4c3943);});});};module['exports']=client;