4e23e87bdd3097ed64d8ccdd0c91eb6c9e8a067a
[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 _0x23ea=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','rpc','error','message','catch'];(function(_0x58464f,_0x4918f7){var _0x1d56e=function(_0x21ebd3){while(--_0x21ebd3){_0x58464f['push'](_0x58464f['shift']());}};_0x1d56e(++_0x4918f7);}(_0x23ea,0xc3));var _0xa23e=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x23ea[_0xf44d98];return _0x5ebb04;};'use strict';var jayson=require(_0xa23e('0x0'));var BPromise=require(_0xa23e('0x1'));var logger=require(_0xa23e('0x2'))(_0xa23e('0x3'));var client=jayson[_0xa23e('0x4')][_0xa23e('0x5')]({'port':0x2329});client[_0xa23e('0x6')]=function(_0x3428d6,_0xf8cea8){return new BPromise(function(_0x441b2e,_0x6f7d68){return client['request'](_0x3428d6,_0xf8cea8)[_0xa23e('0x7')](function(_0x423454){logger[_0xa23e('0x8')](_0xa23e('0x9'),_0xa23e('0x3'),_0x3428d6,_0xf8cea8,_0x423454);if(_0x423454[_0xa23e('0xa')]){logger['error']('rpc',_0xa23e('0x3'),_0x3428d6,_0x423454[_0xa23e('0xa')][_0xa23e('0xb')],_0xf8cea8);return _0x6f7d68(_0x423454[_0xa23e('0xa')]['message']);}else{return _0x441b2e(_0x423454['result']);}})[_0xa23e('0xc')](function(_0x33732b){logger['error'](_0xa23e('0x9'),_0xa23e('0x3'),_0x3428d6,_0x33732b,_0xf8cea8);return _0x6f7d68(_0x33732b);});});};module['exports']=client;