Built motion from commit 753c950e.|2.5.42
[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 _0x5c34=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x4b69b9,_0x57ff57){var _0x17a245=function(_0x46604c){while(--_0x46604c){_0x4b69b9['push'](_0x4b69b9['shift']());}};_0x17a245(++_0x57ff57);}(_0x5c34,0x18d));var _0x45c3=function(_0x1ce711,_0x20b567){_0x1ce711=_0x1ce711-0x0;var _0x1bd983=_0x5c34[_0x1ce711];return _0x1bd983;};'use strict';var _=require(_0x45c3('0x0'));var util=require(_0x45c3('0x1'));var moment=require(_0x45c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x45c3('0x3'));var fs=require('fs');var Redis=require(_0x45c3('0x4'));var db=require(_0x45c3('0x5'))['db'];var utils=require(_0x45c3('0x6'));var logger=require(_0x45c3('0x7'))(_0x45c3('0x8'));var config=require(_0x45c3('0x9'));var jayson=require(_0x45c3('0xa'));var client=jayson[_0x45c3('0xb')][_0x45c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34ef02,_0x218c77,_0x107e08){return new BPromise(function(_0x12124b,_0x4dee51){return client[_0x45c3('0xd')](_0x34ef02,_0x107e08)[_0x45c3('0xe')](function(_0x3695df){logger[_0x45c3('0xf')]('ChatApplication,\x20%s,\x20%s',_0x218c77,_0x45c3('0x10'));logger['debug'](_0x45c3('0x11'),_0x218c77,'request\x20sent',JSON[_0x45c3('0x12')](_0x3695df));if(_0x3695df[_0x45c3('0x13')]){if(_0x3695df[_0x45c3('0x13')][_0x45c3('0x14')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x218c77,_0x3695df[_0x45c3('0x13')]['message']);return _0x4dee51(_0x3695df['error'][_0x45c3('0x15')]);}logger['error'](_0x45c3('0x16'),_0x218c77,_0x3695df[_0x45c3('0x13')][_0x45c3('0x15')]);return _0x12124b(_0x3695df[_0x45c3('0x13')][_0x45c3('0x15')]);}else{logger[_0x45c3('0xf')](_0x45c3('0x16'),_0x218c77,'request\x20sent');_0x12124b(_0x3695df[_0x45c3('0x17')]['message']);}})[_0x45c3('0x18')](function(_0x503fb3){logger[_0x45c3('0x13')]('ChatApplication,\x20%s,\x20%s',_0x218c77,_0x503fb3);_0x4dee51(_0x503fb3);});});}