Built motion from commit e0fa946e.|2.6.5
[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 _0xb6c8=['error','message','result','catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x325c5a,_0x19f729){var _0x4e1e41=function(_0x325e40){while(--_0x325e40){_0x325c5a['push'](_0x325c5a['shift']());}};_0x4e1e41(++_0x19f729);}(_0xb6c8,0x121));var _0x8b6c=function(_0x3446cc,_0x4e46d6){_0x3446cc=_0x3446cc-0x0;var _0x2c2703=_0xb6c8[_0x3446cc];return _0x2c2703;};'use strict';var _=require(_0x8b6c('0x0'));var util=require('util');var moment=require(_0x8b6c('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b6c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b6c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8b6c('0x4'));var config=require(_0x8b6c('0x5'));var jayson=require(_0x8b6c('0x6'));var client=jayson[_0x8b6c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48e1d5,_0x3cb1db,_0x1b6649){return new BPromise(function(_0x40f1ad,_0x13041d){return client[_0x8b6c('0x8')](_0x48e1d5,_0x1b6649)[_0x8b6c('0x9')](function(_0x31c7fd){logger[_0x8b6c('0xa')](_0x8b6c('0xb'),_0x3cb1db,_0x8b6c('0xc'));logger[_0x8b6c('0xd')](_0x8b6c('0xe'),_0x3cb1db,'request\x20sent',JSON['stringify'](_0x31c7fd));if(_0x31c7fd[_0x8b6c('0xf')]){if(_0x31c7fd[_0x8b6c('0xf')]['code']===0x1f4){logger[_0x8b6c('0xf')](_0x8b6c('0xb'),_0x3cb1db,_0x31c7fd[_0x8b6c('0xf')][_0x8b6c('0x10')]);return _0x13041d(_0x31c7fd[_0x8b6c('0xf')][_0x8b6c('0x10')]);}logger[_0x8b6c('0xf')]('ChatApplication,\x20%s,\x20%s',_0x3cb1db,_0x31c7fd['error'][_0x8b6c('0x10')]);return _0x40f1ad(_0x31c7fd[_0x8b6c('0xf')][_0x8b6c('0x10')]);}else{logger[_0x8b6c('0xa')](_0x8b6c('0xb'),_0x3cb1db,_0x8b6c('0xc'));_0x40f1ad(_0x31c7fd[_0x8b6c('0x11')][_0x8b6c('0x10')]);}})[_0x8b6c('0x12')](function(_0x527cd4){logger['error'](_0x8b6c('0xb'),_0x3cb1db,_0x527cd4);_0x13041d(_0x527cd4);});});}