ff5bb1f117b5b9b0408f44ba5bc0db9a2f9e7c08
[motion2.git] / server / api / chatApplication / chatApplication.rpc.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 _0xa32e=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0xa32e,0x79));var _0xea32=function(_0x34a597,_0x184dfd){_0x34a597=_0x34a597-0x0;var _0x591722=_0xa32e[_0x34a597];return _0x591722;};'use strict';var _=require(_0xea32('0x0'));var util=require('util');var moment=require(_0xea32('0x1'));var BPromise=require(_0xea32('0x2'));var rs=require(_0xea32('0x3'));var fs=require('fs');var Redis=require(_0xea32('0x4'));var db=require(_0xea32('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea32('0x6'));var config=require(_0xea32('0x7'));var jayson=require(_0xea32('0x8'));var client=jayson[_0xea32('0x9')][_0xea32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77ae1c,_0x52552f,_0x90f173){return new BPromise(function(_0xec602e,_0xcb0cb8){return client[_0xea32('0xb')](_0x77ae1c,_0x90f173)['then'](function(_0x2cf3b6){logger[_0xea32('0xc')](_0xea32('0xd'),_0x52552f,_0xea32('0xe'));logger[_0xea32('0xf')](_0xea32('0x10'),_0x52552f,'request\x20sent',JSON[_0xea32('0x11')](_0x2cf3b6));if(_0x2cf3b6[_0xea32('0x12')]){if(_0x2cf3b6[_0xea32('0x12')][_0xea32('0x13')]===0x1f4){logger[_0xea32('0x12')](_0xea32('0xd'),_0x52552f,_0x2cf3b6['error'][_0xea32('0x14')]);return _0xcb0cb8(_0x2cf3b6[_0xea32('0x12')][_0xea32('0x14')]);}logger[_0xea32('0x12')]('ChatApplication,\x20%s,\x20%s',_0x52552f,_0x2cf3b6[_0xea32('0x12')]['message']);return _0xec602e(_0x2cf3b6['error'][_0xea32('0x14')]);}else{logger['info'](_0xea32('0xd'),_0x52552f,_0xea32('0xe'));_0xec602e(_0x2cf3b6[_0xea32('0x15')]['message']);}})[_0xea32('0x16')](function(_0x532a1e){logger[_0xea32('0x12')](_0xea32('0xd'),_0x52552f,_0x532a1e);_0xcb0cb8(_0x532a1e);});});}