Built motion from commit 44b1f254.|2.6.26
[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 _0x790d=['ChatApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x11cb2b,_0x36ff63){var _0x1bc84b=function(_0x575632){while(--_0x575632){_0x11cb2b['push'](_0x11cb2b['shift']());}};_0x1bc84b(++_0x36ff63);}(_0x790d,0x1e4));var _0xd790=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0x790d[_0x4f34d8];return _0xc97536;};'use strict';var _=require(_0xd790('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd790('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd790('0x2'));var logger=require(_0xd790('0x3'))(_0xd790('0x4'));var config=require('../../config/environment');var jayson=require(_0xd790('0x5'));var client=jayson[_0xd790('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19bcd6,_0x4c7971,_0x19a884){return new BPromise(function(_0x379712,_0x1ff052){return client[_0xd790('0x7')](_0x19bcd6,_0x19a884)[_0xd790('0x8')](function(_0x4ab167){logger[_0xd790('0x9')](_0xd790('0xa'),_0x4c7971,'request\x20sent');logger[_0xd790('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4c7971,_0xd790('0xc'),JSON[_0xd790('0xd')](_0x4ab167));if(_0x4ab167[_0xd790('0xe')]){if(_0x4ab167[_0xd790('0xe')][_0xd790('0xf')]===0x1f4){logger[_0xd790('0xe')](_0xd790('0xa'),_0x4c7971,_0x4ab167['error'][_0xd790('0x10')]);return _0x1ff052(_0x4ab167[_0xd790('0xe')][_0xd790('0x10')]);}logger[_0xd790('0xe')](_0xd790('0xa'),_0x4c7971,_0x4ab167[_0xd790('0xe')][_0xd790('0x10')]);return _0x379712(_0x4ab167[_0xd790('0xe')]['message']);}else{logger[_0xd790('0x9')]('ChatApplication,\x20%s,\x20%s',_0x4c7971,_0xd790('0xc'));_0x379712(_0x4ab167[_0xd790('0x11')]['message']);}})[_0xd790('0x12')](function(_0x257cd9){logger[_0xd790('0xe')]('ChatApplication,\x20%s,\x20%s',_0x4c7971,_0x257cd9);_0x1ff052(_0x257cd9);});});}