Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / services / ami / 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x327e47,_0x1f69a3){var _0xd2b5cd=function(_0x53feec){while(--_0x53feec){_0x327e47['push'](_0x327e47['shift']());}};_0xd2b5cd(++_0x1f69a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client;