Built motion from commit (unavailable).|2.5.15
[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 _0x1311=['catch','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x4552ea,_0x5c6323){var _0x45499a=function(_0x174340){while(--_0x174340){_0x4552ea['push'](_0x4552ea['shift']());}};_0x45499a(++_0x5c6323);}(_0x1311,0x127));var _0x1131=function(_0x2ea445,_0x1da228){_0x2ea445=_0x2ea445-0x0;var _0x390525=_0x1311[_0x2ea445];return _0x390525;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1131('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1131('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1131('0x2'));var logger=require(_0x1131('0x3'))(_0x1131('0x4'));var config=require(_0x1131('0x5'));var jayson=require(_0x1131('0x6'));var client=jayson[_0x1131('0x7')][_0x1131('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4af8b6,_0x3494d9,_0x9d7b44){return new BPromise(function(_0x8a1a6c,_0x5a7351){return client[_0x1131('0x9')](_0x4af8b6,_0x9d7b44)[_0x1131('0xa')](function(_0x1628eb){logger[_0x1131('0xb')](_0x1131('0xc'),_0x3494d9,'request\x20sent');logger[_0x1131('0xd')](_0x1131('0xe'),_0x3494d9,'request\x20sent',JSON[_0x1131('0xf')](_0x1628eb));if(_0x1628eb['error']){if(_0x1628eb[_0x1131('0x10')][_0x1131('0x11')]===0x1f4){logger[_0x1131('0x10')](_0x1131('0xc'),_0x3494d9,_0x1628eb[_0x1131('0x10')][_0x1131('0x12')]);return _0x5a7351(_0x1628eb[_0x1131('0x10')][_0x1131('0x12')]);}logger[_0x1131('0x10')](_0x1131('0xc'),_0x3494d9,_0x1628eb[_0x1131('0x10')]['message']);return _0x8a1a6c(_0x1628eb['error']['message']);}else{logger[_0x1131('0xb')](_0x1131('0xc'),_0x3494d9,_0x1131('0x13'));_0x8a1a6c(_0x1628eb['result'][_0x1131('0x12')]);}})[_0x1131('0x14')](function(_0xe967ab){logger[_0x1131('0x10')](_0x1131('0xc'),_0x3494d9,_0xe967ab);_0x5a7351(_0xe967ab);});});}