6530e1692cd4a3cb7972c1c293ed35d6d3a9fc3f
[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 _0x95a1=['rpc','message','result','catch','exports','jayson/promise','../../config/logger','ami','client','http','Request','request','then','debug','memberReport','error'];(function(_0x3b6d82,_0x346f1e){var _0x35cf06=function(_0x57fd53){while(--_0x57fd53){_0x3b6d82['push'](_0x3b6d82['shift']());}};_0x35cf06(++_0x346f1e);}(_0x95a1,0x165));var _0x195a=function(_0x5e99c9,_0x2d9a74){_0x5e99c9=_0x5e99c9-0x0;var _0x2e519d=_0x95a1[_0x5e99c9];return _0x2e519d;};'use strict';var jayson=require(_0x195a('0x0'));var BPromise=require('bluebird');var logger=require(_0x195a('0x1'))(_0x195a('0x2'));var client=jayson[_0x195a('0x3')][_0x195a('0x4')]({'port':0x2329});client[_0x195a('0x5')]=function(_0x4a67ce,_0x412612){return new BPromise(function(_0x1d5db9,_0xeb8bcf){return client[_0x195a('0x6')](_0x4a67ce,_0x412612)[_0x195a('0x7')](function(_0x51e129){logger[_0x195a('0x8')]('rpc',_0x195a('0x9'),_0x4a67ce,_0x412612,_0x51e129);if(_0x51e129['error']){logger[_0x195a('0xa')](_0x195a('0xb'),_0x195a('0x9'),_0x4a67ce,_0x51e129[_0x195a('0xa')][_0x195a('0xc')],_0x412612);return _0xeb8bcf(_0x51e129[_0x195a('0xa')]['message']);}else{return _0x1d5db9(_0x51e129[_0x195a('0xd')]);}})[_0x195a('0xe')](function(_0x3d4579){logger['error'](_0x195a('0xb'),_0x195a('0x9'),_0x4a67ce,_0x3d4579,_0x412612);return _0xeb8bcf(_0x3d4579);});});};module[_0x195a('0xf')]=client;