f45cc9799bfd8e7cca214cbb7ead0c8ec8cd2df6
[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 _0x75bd=['rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','../../mysqldb'];(function(_0x4746cc,_0xe1e47d){var _0x51b5ad=function(_0x3acadc){while(--_0x3acadc){_0x4746cc['push'](_0x4746cc['shift']());}};_0x51b5ad(++_0xe1e47d);}(_0x75bd,0x119));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xd75b('0x0'));var moment=require('moment');var BPromise=require(_0xd75b('0x1'));var rs=require(_0xd75b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd75b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd75b('0x4'));var config=require(_0xd75b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd75b('0x6')][_0xd75b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a403d,_0x3d024b,_0x470b18){return new BPromise(function(_0x16c78a,_0x103f4b){return client[_0xd75b('0x8')](_0x3a403d,_0x470b18)[_0xd75b('0x9')](function(_0x4fd9b6){logger['info']('ChatApplication,\x20%s,\x20%s',_0x3d024b,_0xd75b('0xa'));logger[_0xd75b('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3d024b,_0xd75b('0xa'),JSON[_0xd75b('0xc')](_0x4fd9b6));if(_0x4fd9b6['error']){if(_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0xe')]===0x1f4){logger['error'](_0xd75b('0xf'),_0x3d024b,_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0x10')]);return _0x103f4b(_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0x10')]);}logger[_0xd75b('0xd')](_0xd75b('0xf'),_0x3d024b,_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0x10')]);return _0x16c78a(_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0x10')]);}else{logger[_0xd75b('0x11')](_0xd75b('0xf'),_0x3d024b,_0xd75b('0xa'));_0x16c78a(_0x4fd9b6['result'][_0xd75b('0x10')]);}})[_0xd75b('0x12')](function(_0x2fd927){logger['error'](_0xd75b('0xf'),_0x3d024b,_0x2fd927);_0x103f4b(_0x2fd927);});});}