9508f250091709a68dc06b661b2daa238c38f05e
[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 _0xb11a=['client','Request','request','then','debug','rpc','memberReport','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','ami'];(function(_0x4c0155,_0x5b20db){var _0x1276db=function(_0x3ff813){while(--_0x3ff813){_0x4c0155['push'](_0x4c0155['shift']());}};_0x1276db(++_0x5b20db);}(_0xb11a,0x8c));var _0xab11=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xb11a[_0x550d12];return _0x12103d;};'use strict';var jayson=require(_0xab11('0x0'));var BPromise=require(_0xab11('0x1'));var logger=require(_0xab11('0x2'))(_0xab11('0x3'));var client=jayson[_0xab11('0x4')]['http']({'port':0x2329});client[_0xab11('0x5')]=function(_0x43bbc2,_0x3a1131){return new BPromise(function(_0xe58aa3,_0x3417e7){return client[_0xab11('0x6')](_0x43bbc2,_0x3a1131)[_0xab11('0x7')](function(_0x1e73e4){logger[_0xab11('0x8')](_0xab11('0x9'),_0xab11('0xa'),_0x43bbc2,_0x3a1131,_0x1e73e4);if(_0x1e73e4[_0xab11('0xb')]){logger[_0xab11('0xb')](_0xab11('0x9'),_0xab11('0xa'),_0x43bbc2,_0x1e73e4['error'][_0xab11('0xc')],_0x3a1131);return _0x3417e7(_0x1e73e4['error'][_0xab11('0xc')]);}else{return _0xe58aa3(_0x1e73e4[_0xab11('0xd')]);}})[_0xab11('0xe')](function(_0x103510){logger[_0xab11('0xb')]('rpc','memberReport',_0x43bbc2,_0x103510,_0x3a1131);return _0x3417e7(_0x103510);});});};module[_0xab11('0xf')]=client;