Built motion from commit efa66e19.|2.6.22
[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 _0x92c2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','../../mysqldb'];(function(_0x1e0f48,_0x50829e){var _0x5dd59e=function(_0x177782){while(--_0x177782){_0x1e0f48['push'](_0x1e0f48['shift']());}};_0x5dd59e(++_0x50829e);}(_0x92c2,0x88));var _0x292c=function(_0x1065cc,_0x22cc35){_0x1065cc=_0x1065cc-0x0;var _0x4746f5=_0x92c2[_0x1065cc];return _0x4746f5;};'use strict';var _=require(_0x292c('0x0'));var util=require('util');var moment=require(_0x292c('0x1'));var BPromise=require(_0x292c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x292c('0x3'))['db'];var utils=require(_0x292c('0x4'));var logger=require(_0x292c('0x5'))(_0x292c('0x6'));var config=require(_0x292c('0x7'));var jayson=require(_0x292c('0x8'));var client=jayson[_0x292c('0x9')][_0x292c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58af00,_0x3415eb,_0x2458eb){return new BPromise(function(_0x11f1fd,_0x3959c0){return client[_0x292c('0xb')](_0x58af00,_0x2458eb)['then'](function(_0x4b9b6f){logger[_0x292c('0xc')](_0x292c('0xd'),_0x3415eb,_0x292c('0xe'));logger['debug'](_0x292c('0xf'),_0x3415eb,_0x292c('0xe'),JSON['stringify'](_0x4b9b6f));if(_0x4b9b6f[_0x292c('0x10')]){if(_0x4b9b6f[_0x292c('0x10')][_0x292c('0x11')]===0x1f4){logger[_0x292c('0x10')](_0x292c('0xd'),_0x3415eb,_0x4b9b6f['error'][_0x292c('0x12')]);return _0x3959c0(_0x4b9b6f['error'][_0x292c('0x12')]);}logger[_0x292c('0x10')](_0x292c('0xd'),_0x3415eb,_0x4b9b6f['error'][_0x292c('0x12')]);return _0x11f1fd(_0x4b9b6f['error']['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x3415eb,_0x292c('0xe'));_0x11f1fd(_0x4b9b6f[_0x292c('0x13')][_0x292c('0x12')]);}})['catch'](function(_0x4ecd26){logger['error'](_0x292c('0xd'),_0x3415eb,_0x4ecd26);_0x3959c0(_0x4ecd26);});});}