408dd49ca29b93defbf49001610f4ed8b9f151b0
[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 _0xc68e=['rpc','message','result','catch','exports','jayson/promise','../../config/logger','ami','client','request','then','debug','memberReport','error'];(function(_0x49d55b,_0x439332){var _0x459027=function(_0x1cd626){while(--_0x1cd626){_0x49d55b['push'](_0x49d55b['shift']());}};_0x459027(++_0x439332);}(_0xc68e,0x91));var _0xec68=function(_0x5e0c27,_0xfe9ee0){_0x5e0c27=_0x5e0c27-0x0;var _0x495393=_0xc68e[_0x5e0c27];return _0x495393;};'use strict';var jayson=require(_0xec68('0x0'));var BPromise=require('bluebird');var logger=require(_0xec68('0x1'))(_0xec68('0x2'));var client=jayson[_0xec68('0x3')]['http']({'port':0x2329});client['Request']=function(_0x413a1c,_0x32db43){return new BPromise(function(_0x189a71,_0x592d1a){return client[_0xec68('0x4')](_0x413a1c,_0x32db43)[_0xec68('0x5')](function(_0x14b3fa){logger[_0xec68('0x6')]('rpc',_0xec68('0x7'),_0x413a1c,_0x32db43,_0x14b3fa);if(_0x14b3fa[_0xec68('0x8')]){logger['error'](_0xec68('0x9'),_0xec68('0x7'),_0x413a1c,_0x14b3fa['error'][_0xec68('0xa')],_0x32db43);return _0x592d1a(_0x14b3fa['error'][_0xec68('0xa')]);}else{return _0x189a71(_0x14b3fa[_0xec68('0xb')]);}})[_0xec68('0xc')](function(_0x4c5d39){logger['error'](_0xec68('0x9'),_0xec68('0x7'),_0x413a1c,_0x4c5d39,_0x32db43);return _0x592d1a(_0x4c5d39);});});};module[_0xec68('0xd')]=client;