72e4efbe3371f73121780993382f756615fd8bb5
[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 _0x6c58=['ChatApplication,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','stringify','error','code'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x6c58,0xb7));var _0x86c5=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6c58[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0x86c5('0x0'));var moment=require('moment');var BPromise=require(_0x86c5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86c5('0x2'));var db=require(_0x86c5('0x3'))['db'];var utils=require(_0x86c5('0x4'));var logger=require(_0x86c5('0x5'))(_0x86c5('0x6'));var config=require(_0x86c5('0x7'));var jayson=require(_0x86c5('0x8'));var client=jayson[_0x86c5('0x9')][_0x86c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x146b40,_0x321ae2,_0x15ab4d){return new BPromise(function(_0x6a6cbb,_0x2b7fea){return client[_0x86c5('0xb')](_0x146b40,_0x15ab4d)[_0x86c5('0xc')](function(_0xcb5aba){logger[_0x86c5('0xd')]('ChatApplication,\x20%s,\x20%s',_0x321ae2,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x321ae2,'request\x20sent',JSON[_0x86c5('0xe')](_0xcb5aba));if(_0xcb5aba[_0x86c5('0xf')]){if(_0xcb5aba[_0x86c5('0xf')][_0x86c5('0x10')]===0x1f4){logger['error'](_0x86c5('0x11'),_0x321ae2,_0xcb5aba[_0x86c5('0xf')][_0x86c5('0x12')]);return _0x2b7fea(_0xcb5aba[_0x86c5('0xf')]['message']);}logger['error'](_0x86c5('0x11'),_0x321ae2,_0xcb5aba[_0x86c5('0xf')][_0x86c5('0x12')]);return _0x6a6cbb(_0xcb5aba[_0x86c5('0xf')][_0x86c5('0x12')]);}else{logger[_0x86c5('0xd')](_0x86c5('0x11'),_0x321ae2,'request\x20sent');_0x6a6cbb(_0xcb5aba[_0x86c5('0x13')][_0x86c5('0x12')]);}})['catch'](function(_0x3f4098){logger[_0x86c5('0xf')](_0x86c5('0x11'),_0x321ae2,_0x3f4098);_0x2b7fea(_0x3f4098);});});}