Built motion from commit b5413ace.|2.6.9
[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 _0xb7df=['http','then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1c22b9,_0x5b950d){var _0x8c986d=function(_0x2ecfc3){while(--_0x2ecfc3){_0x1c22b9['push'](_0x1c22b9['shift']());}};_0x8c986d(++_0x5b950d);}(_0xb7df,0x174));var _0xfb7d=function(_0x448988,_0xa08bc1){_0x448988=_0x448988-0x0;var _0x128849=_0xb7df[_0x448988];return _0x128849;};'use strict';var _=require(_0xfb7d('0x0'));var util=require('util');var moment=require(_0xfb7d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb7d('0x2'))['db'];var utils=require(_0xfb7d('0x3'));var logger=require(_0xfb7d('0x4'))(_0xfb7d('0x5'));var config=require('../../config/environment');var jayson=require(_0xfb7d('0x6'));var client=jayson[_0xfb7d('0x7')][_0xfb7d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5121ca,_0x42386f,_0x5d7bf1){return new BPromise(function(_0x5bf1bf,_0x47e07d){return client['request'](_0x5121ca,_0x5d7bf1)[_0xfb7d('0x9')](function(_0x487ccc){logger[_0xfb7d('0xa')]('ChatApplication,\x20%s,\x20%s',_0x42386f,'request\x20sent');logger[_0xfb7d('0xb')](_0xfb7d('0xc'),_0x42386f,_0xfb7d('0xd'),JSON['stringify'](_0x487ccc));if(_0x487ccc[_0xfb7d('0xe')]){if(_0x487ccc[_0xfb7d('0xe')][_0xfb7d('0xf')]===0x1f4){logger['error'](_0xfb7d('0x10'),_0x42386f,_0x487ccc[_0xfb7d('0xe')]['message']);return _0x47e07d(_0x487ccc[_0xfb7d('0xe')][_0xfb7d('0x11')]);}logger[_0xfb7d('0xe')](_0xfb7d('0x10'),_0x42386f,_0x487ccc[_0xfb7d('0xe')]['message']);return _0x5bf1bf(_0x487ccc[_0xfb7d('0xe')][_0xfb7d('0x11')]);}else{logger[_0xfb7d('0xa')]('ChatApplication,\x20%s,\x20%s',_0x42386f,_0xfb7d('0xd'));_0x5bf1bf(_0x487ccc['result'][_0xfb7d('0x11')]);}})[_0xfb7d('0x12')](function(_0x180fd9){logger[_0xfb7d('0xe')](_0xfb7d('0x10'),_0x42386f,_0x180fd9);_0x47e07d(_0x180fd9);});});}