Built motion from commit b7e79837.|2.6.29
[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 _0xf86f=['../../config/environment','jayson/promise','client','request','then','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x35e84b,_0x454479){var _0x4fb29e=function(_0x551707){while(--_0x551707){_0x35e84b['push'](_0x35e84b['shift']());}};_0x4fb29e(++_0x454479);}(_0xf86f,0x129));var _0xff86=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xf86f[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xff86('0x0'));var util=require(_0xff86('0x1'));var moment=require(_0xff86('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff86('0x3'));var db=require(_0xff86('0x4'))['db'];var utils=require(_0xff86('0x5'));var logger=require(_0xff86('0x6'))('rpc');var config=require(_0xff86('0x7'));var jayson=require(_0xff86('0x8'));var client=jayson[_0xff86('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ba864,_0x28f860,_0x3499dc){return new BPromise(function(_0x35c6b8,_0x44d93a){return client[_0xff86('0xa')](_0x2ba864,_0x3499dc)[_0xff86('0xb')](function(_0x197d94){logger['info']('ChatApplication,\x20%s,\x20%s',_0x28f860,_0xff86('0xc'));logger['debug'](_0xff86('0xd'),_0x28f860,_0xff86('0xc'),JSON['stringify'](_0x197d94));if(_0x197d94[_0xff86('0xe')]){if(_0x197d94['error'][_0xff86('0xf')]===0x1f4){logger[_0xff86('0xe')](_0xff86('0x10'),_0x28f860,_0x197d94[_0xff86('0xe')]['message']);return _0x44d93a(_0x197d94[_0xff86('0xe')][_0xff86('0x11')]);}logger[_0xff86('0xe')](_0xff86('0x10'),_0x28f860,_0x197d94['error'][_0xff86('0x11')]);return _0x35c6b8(_0x197d94[_0xff86('0xe')][_0xff86('0x11')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x28f860,_0xff86('0xc'));_0x35c6b8(_0x197d94[_0xff86('0x12')]['message']);}})['catch'](function(_0x38d102){logger['error'](_0xff86('0x10'),_0x28f860,_0x38d102);_0x44d93a(_0x38d102);});});}