539ff3926d9f8295c7d17fa17a0e9805074b0ec0
[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 _0x1a57=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s'];(function(_0x3c79ae,_0x2a953b){var _0x2c922a=function(_0x231179){while(--_0x231179){_0x3c79ae['push'](_0x3c79ae['shift']());}};_0x2c922a(++_0x2a953b);}(_0x1a57,0x1e4));var _0x71a5=function(_0x5530d5,_0x4e1f72){_0x5530d5=_0x5530d5-0x0;var _0x1c560a=_0x1a57[_0x5530d5];return _0x1c560a;};'use strict';var _=require(_0x71a5('0x0'));var util=require(_0x71a5('0x1'));var moment=require(_0x71a5('0x2'));var BPromise=require(_0x71a5('0x3'));var rs=require(_0x71a5('0x4'));var fs=require('fs');var Redis=require(_0x71a5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x71a5('0x6'));var config=require(_0x71a5('0x7'));var jayson=require(_0x71a5('0x8'));var client=jayson[_0x71a5('0x9')][_0x71a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a656f,_0x438fc7,_0x26fc8e){return new BPromise(function(_0x1b4175,_0x175a1){return client[_0x71a5('0xb')](_0x4a656f,_0x26fc8e)[_0x71a5('0xc')](function(_0x5ea3ef){logger['info']('ChatApplication,\x20%s,\x20%s',_0x438fc7,_0x71a5('0xd'));logger[_0x71a5('0xe')](_0x71a5('0xf'),_0x438fc7,_0x71a5('0xd'),JSON[_0x71a5('0x10')](_0x5ea3ef));if(_0x5ea3ef[_0x71a5('0x11')]){if(_0x5ea3ef[_0x71a5('0x11')][_0x71a5('0x12')]===0x1f4){logger[_0x71a5('0x11')](_0x71a5('0x13'),_0x438fc7,_0x5ea3ef[_0x71a5('0x11')][_0x71a5('0x14')]);return _0x175a1(_0x5ea3ef[_0x71a5('0x11')][_0x71a5('0x14')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x438fc7,_0x5ea3ef[_0x71a5('0x11')][_0x71a5('0x14')]);return _0x1b4175(_0x5ea3ef['error'][_0x71a5('0x14')]);}else{logger[_0x71a5('0x15')](_0x71a5('0x13'),_0x438fc7,'request\x20sent');_0x1b4175(_0x5ea3ef[_0x71a5('0x16')][_0x71a5('0x14')]);}})[_0x71a5('0x17')](function(_0x5a5131){logger[_0x71a5('0x11')](_0x71a5('0x13'),_0x438fc7,_0x5a5131);_0x175a1(_0x5a5131);});});}