Built motion from commit (unavailable).|2.4.1
[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 _0xa659=['info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x240cee,_0x129992){var _0x2ca60d=function(_0x1a3e72){while(--_0x1a3e72){_0x240cee['push'](_0x240cee['shift']());}};_0x2ca60d(++_0x129992);}(_0xa659,0x1d1));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a65('0x0'));var BPromise=require(_0x9a65('0x1'));var rs=require(_0x9a65('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a65('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a65('0x4'))(_0x9a65('0x5'));var config=require(_0x9a65('0x6'));var jayson=require(_0x9a65('0x7'));var client=jayson[_0x9a65('0x8')][_0x9a65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5df2b7,_0x179286,_0x1b7165){return new BPromise(function(_0x5ef6dc,_0x4c3574){return client[_0x9a65('0xa')](_0x5df2b7,_0x1b7165)[_0x9a65('0xb')](function(_0x221a77){logger['info'](_0x9a65('0xc'),_0x179286,_0x9a65('0xd'));logger[_0x9a65('0xe')](_0x9a65('0xf'),_0x179286,_0x9a65('0xd'),JSON['stringify'](_0x221a77));if(_0x221a77[_0x9a65('0x10')]){if(_0x221a77['error']['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x179286,_0x221a77[_0x9a65('0x10')][_0x9a65('0x11')]);return _0x4c3574(_0x221a77[_0x9a65('0x10')][_0x9a65('0x11')]);}logger[_0x9a65('0x10')](_0x9a65('0xc'),_0x179286,_0x221a77[_0x9a65('0x10')][_0x9a65('0x11')]);return _0x5ef6dc(_0x221a77[_0x9a65('0x10')]['message']);}else{logger[_0x9a65('0x12')](_0x9a65('0xc'),_0x179286,_0x9a65('0xd'));_0x5ef6dc(_0x221a77[_0x9a65('0x13')]['message']);}})[_0x9a65('0x14')](function(_0x17ae4f){logger[_0x9a65('0x10')]('ChatApplication,\x20%s,\x20%s',_0x179286,_0x17ae4f);_0x4c3574(_0x17ae4f);});});}